Skip to content

Remove all mention of 'module' from typeshed. #1156

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
Apr 13, 2017
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
5 changes: 0 additions & 5 deletions stdlib/2/__builtin__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,6 @@ class xrange(Sized, Iterable[int], Reversible[int]):
def __getitem__(self, i: int) -> int: ...
def __reversed__(self) -> Iterator[int]: ...

class module:
__name__ = ... # type: str
__file__ = ... # type: str
__dict__ = ... # type: Dict[unicode, Any]

class property(object):
def __init__(self, fget: Callable[[Any], Any] = None,
fset: Callable[[Any, Any], None] = None,
Expand Down
9 changes: 1 addition & 8 deletions stdlib/2/abc.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
from typing import Any, Dict, Set, Tuple, Type
import _weakrefset

# mypy has special processing for ABCMeta and abstractmethod.

WeakSet = ... # type: _weakrefset.WeakSet
_InstanceType = ... # type: type
types = ... # type: module
# NOTE: mypy has special processing for ABCMeta and abstractmethod.

def abstractmethod(funcobj: Any) -> Any: ...

Expand All @@ -23,9 +19,6 @@ class ABCMeta(type):
def _dump_registry(cls: "ABCMeta", *args: Any, **kwargs: Any) -> None: ...
def register(cls: "ABCMeta", subclass: Type[Any]) -> None: ...

class _C:
pass

# TODO: The real abc.abstractproperty inherits from "property".
class abstractproperty(object):
def __new__(cls, func: Any) -> Any: ...
Expand Down
4 changes: 0 additions & 4 deletions stdlib/2/tokenize.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,11 @@ chain = ... # type: type
double3prog = ... # type: type
endprogs = ... # type: Dict[str, Any]
pseudoprog = ... # type: type
re = ... # type: module
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove re = ... entirely.

Copy link
Member Author

@gvanrossum gvanrossum Apr 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly a lot here should probably be removed -- it's only there because that's how pytype generates stubs (every imported thing ends up in the stub, even if it's clearly for purely internal reasons, and it never generates import statements). But I think that's a cleanup for a separate PR.

single3prog = ... # type: type
single_quoted = ... # type: Dict[str, str]
string = ... # type: module
sys = ... # type: module
t = ... # type: str
tabsize = ... # type: int
tok_name = ... # type: Dict[int, str]
token = ... # type: module
tokenprog = ... # type: type
triple_quoted = ... # type: Dict[str, str]
x = ... # type: str
Expand Down
1 change: 1 addition & 0 deletions stdlib/2/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class ModuleType:
__name__ = ... # type: str
__package__ = ... # type: Optional[str]
__path__ = ... # type: Optional[Iterable[str]]
__dict__ = ... # type: Dict[str, Any]
def __init__(self, name: str, doc: Optional[str] = ...) -> None: ...
FileType = file
XRangeType = xrange
Expand Down
3 changes: 2 additions & 1 deletion stdlib/2/unittest.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ from typing import (
overload, Set, FrozenSet, TypeVar, Union, Pattern, Type
)
from abc import abstractmethod, ABCMeta
import types

_T = TypeVar('_T')
_FT = TypeVar('_FT')
Expand Down Expand Up @@ -173,4 +174,4 @@ def main(module: str = ..., defaultTest: str = ...,
testLoader: Any = ...) -> None: ... # TODO types

# private but occasionally used
util = ... # type: module
util = ... # type: types.ModuleType
3 changes: 2 additions & 1 deletion stdlib/3/_importlib_modulespec.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from abc import ABCMeta
import sys
from typing import Any, Optional
from typing import Dict, Any, Optional

if sys.version_info >= (3, 4):
class ModuleSpec:
Expand All @@ -26,6 +26,7 @@ if sys.version_info >= (3, 4):
class ModuleType:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__doc__ = ... # type: Optional[str]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be needed, since __doc__ is defined on object, which is implicitly inherited.

__name__ = ... # type: str
__file__ = ... # type: str
__dict__ = ... # type: Dict[str, Any]
if sys.version_info >= (3, 4):
__loader__ = ... # type: Optional[Loader]
__package__ = ... # type: Optional[str]
Expand Down
6 changes: 0 additions & 6 deletions stdlib/3/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -731,12 +731,6 @@ class range(Sequence[int]):
def __repr__(self) -> str: ...
def __reversed__(self) -> Iterator[int]: ...

class module:
# TODO not defined in builtins!
__name__ = ... # type: str
__file__ = ... # type: str
__dict__ = ... # type: Dict[str, Any]

class property:
def __init__(self, fget: Callable[[Any], Any] = None,
fset: Callable[[Any, Any], None] = None,
Expand Down