Skip to content

Consider __doc__ always Optional. Fixes issues surfaced with python/mypy#2380. #641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ The below is an excerpt from the types for the `datetime` module.
```
MAXYEAR = ... # type: int
MINYEAR = ... # type: int
__doc__ = ... # type: str
__file__ = ... # type: str
__name__ = ... # type: str
__package__ = ... # type: None

class date(object):
def __init__(self, year: int, month: int, day: int) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/2/__builtin__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class staticmethod: pass # Special, only valid as a decorator.
class classmethod: pass # Special, only valid as a decorator.

class object:
__doc__ = ... # type: str
__doc__ = ... # type: Optional[str]
__class__ = ... # type: type

def __init__(self) -> None: ...
Expand Down
2 changes: 0 additions & 2 deletions stdlib/2/abc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def abstractmethod(funcobj: Any) -> Any: ...
class ABCMeta(type):
# TODO: FrozenSet
__abstractmethods__ = ... # type: Set[Any]
__doc__ = ... # type: str
_abc_cache = ... # type: _weakrefset.WeakSet
_abc_invalidation_counter = ... # type: int
_abc_negative_cache = ... # type: _weakrefset.WeakSet
Expand All @@ -31,7 +30,6 @@ class _C:
# TODO: The real abc.abstractproperty inherits from "property".
class abstractproperty(object):
def __new__(cls, func: Any) -> Any: ...
__doc__ = ... # type: str
__isabstractmethod__ = ... # type: bool
doc = ... # type: Any
fdel = ... # type: Any
Expand Down
2 changes: 0 additions & 2 deletions stdlib/2/ast.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ def literal_eval(node_or_string: Union[str, AST]) -> Any: ...
def walk(node: AST) -> Iterator[AST]: ...

class NodeVisitor():
__doc__ = ... # type: str
def visit(self, node: AST) -> Any: ...
def generic_visit(self, node: AST) -> None: ...

class NodeTransformer(NodeVisitor):
__doc__ = ... # type: str
def generic_visit(self, node: AST) -> None: ...


Expand Down
6 changes: 0 additions & 6 deletions stdlib/2/optparse.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class OptParseError(Exception):
def __init__(self, msg) -> None: ...

class BadOptionError(OptParseError):
__doc__ = ... # type: str
opt_str = ... # type: Any
def __init__(self, opt_str) -> None: ...

Expand Down Expand Up @@ -65,7 +64,6 @@ class HelpFormatter:
def store_option_strings(self, parser) -> None: ...

class IndentedHelpFormatter(HelpFormatter):
__doc__ = ... # type: str
_long_opt_fmt = ... # type: str
_short_opt_fmt = ... # type: str
current_indent = ... # type: int
Expand Down Expand Up @@ -93,7 +91,6 @@ class Option:
TYPED_ACTIONS = ... # type: Tuple[str, ...]
TYPES = ... # type: Tuple[str, ...]
TYPE_CHECKER = ... # type: Dict[str, Callable]
__doc__ = ... # type: str
_long_opts = ... # type: List[Text]
_short_opts = ... # type: List[Text]
action = ... # type: str
Expand Down Expand Up @@ -162,7 +159,6 @@ class OptionGroup(OptionContainer):
def set_title(self, title) -> None: ...

class OptionParser(OptionContainer):
__doc__ = ... # type: str
_long_opt = ... # type: Dict[Text, Any]
_short_opt = ... # type: Dict[Any, Any]
allow_interspersed_args = ... # type: bool
Expand Down Expand Up @@ -220,11 +216,9 @@ class OptionParser(OptionContainer):
def set_usage(self, usage: Text) -> None: ...

class OptionValueError(OptParseError):
__doc__ = ... # type: str
msg = ... # type: Any

class TitledHelpFormatter(HelpFormatter):
__doc__ = ... # type: str
_long_opt_fmt = ... # type: str
_short_opt_fmt = ... # type: str
current_indent = ... # type: int
Expand Down
2 changes: 0 additions & 2 deletions stdlib/2/tempfile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ template = ... # type: str
_name_sequence = ... # type: Optional[_RandomNameSequence]

class _RandomNameSequence:
__doc__ = ... # type: str
_rng = ... # type: random.Random
_rng_pid = ... # type: int
characters = ... # type: str
Expand All @@ -31,7 +30,6 @@ class _RandomNameSequence:
def normcase(path: AnyStr) -> AnyStr: ...

class _TemporaryFileWrapper(IO[str]):
__doc__ = ... # type: str
close_called = ... # type: bool
delete = ... # type: bool
file = ... # type: IO
Expand Down
1 change: 0 additions & 1 deletion stdlib/2/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class FunctionType:
__code__ = func_code
__defaults__ = func_defaults
__dict__ = func_dict
__doc__ = func_doc
__globals__ = func_globals
__name__ = func_name
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/_importlib_modulespec.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ if sys.version_info >= (3, 4):
class ModuleType:
__name__ = ... # type: str
__file__ = ... # type: str
__doc__ = ... # type: Optional[str]
if sys.version_info >= (3, 4):
__loader__ = ... # type: Optional[Loader]
__package__ = ... # type: Optional[str]
Expand Down
2 changes: 0 additions & 2 deletions stdlib/3/ast.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ from _ast import (
)

class NodeVisitor():
__doc__ = ... # type: str
def visit(self, node: AST) -> Any: ...
def generic_visit(self, node: AST) -> None: ...

class NodeTransformer(NodeVisitor):
__doc__ = ... # type: str
def generic_visit(self, node: AST) -> None: ...

def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> AST: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class staticmethod: pass # Special, only valid as a decorator.
class classmethod: pass # Special, only valid as a decorator.

class object:
__doc__ = ... # type: str
__doc__ = ... # type: Optional[str]
__class__ = ... # type: type
__dict__ = ... # type: Dict[str, Any]

Expand Down
1 change: 0 additions & 1 deletion stdlib/3/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class FunctionType:
__code__ = ... # type: CodeType
__defaults__ = ... # type: Optional[Tuple[Any, ...]]
__dict__ = ... # type: Dict[str, Any]
__doc__ = ... # type: Optional[str]
__globals__ = ... # type: Dict[str, Any]
__name__ = ... # type: str
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
Expand Down
2 changes: 0 additions & 2 deletions third_party/2/sqlalchemy/util/langhelpers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def as_interface(obj, cls=..., methods=..., required=...): ...

class memoized_property:
fget = ... # type: Any
__doc__ = ... # type: Any
__name__ = ... # type: Any
def __init__(self, fget, doc=...) -> None: ...
def __get__(self, obj, cls): ...
Expand Down Expand Up @@ -92,7 +91,6 @@ def assert_arg_type(arg, argtype, name): ...
def dictlike_iteritems(dictlike): ...

class classproperty:
__doc__ = ... # type: Any
def __init__(self, fget, *arg, **kw) -> None: ...
def __get__(desc, self, cls): ...

Expand Down
2 changes: 0 additions & 2 deletions third_party/3/typed_ast/ast27.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import typing
from typing import Any, Optional, Union, Generic, Iterator

class NodeVisitor():
__doc__ = ... # type: str
def visit(self, node: AST) -> Any: ...
def generic_visit(self, node: AST) -> None: ...

class NodeTransformer(NodeVisitor):
__doc__ = ... # type: str
def generic_visit(self, node: AST) -> None: ...

def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> AST: ...
Expand Down
2 changes: 0 additions & 2 deletions third_party/3/typed_ast/ast35.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import typing
from typing import Any, Optional, Union, Generic, Iterator

class NodeVisitor():
__doc__ = ... # type: str
def visit(self, node: AST) -> Any: ...
def generic_visit(self, node: AST) -> None: ...

class NodeTransformer(NodeVisitor):
__doc__ = ... # type: str
def generic_visit(self, node: AST) -> None: ...

def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> AST: ...
Expand Down