mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-09 04:52:23 +08:00
Consider __doc__ always Optional. (#641)
python/mypy#2380 showed a discrepancy between object and FunctionType in stdlib2. The first defined __doc__ to be str, the second Optional[str]. As FunctionType depends on object, this is no longer valid. As suggested by @gvanrossum in python/mypy#2380, all __doc__ should be considered Optional. (Final verdict was just to remove most __doc__ attributes since it's inherited from object.)
This commit is contained in:
committed by
Guido van Rossum
parent
1d47c6fdb8
commit
15ec66cdd6
@@ -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]
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -28,7 +28,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]
|
||||
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user