Repository navigation
Fix abstract classes in 2.7 #2247
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,53 @@ | ||
| # Stubs for tempfile | ||
| # Ron Murawski <[email protected]> | ||
|
|
||
| # based on http: //docs.python.org/3.3/library/tempfile.html | ||
| # Adapted for Python 2.7 by Michal Pokorny | ||
|
|
||
| # TODO: Don't use basestring. Use Union[str, bytes] or AnyStr for arguments. | ||
| # Avoid using Union[str, bytes] for return values, as it implies that | ||
| # an isinstance() check will often be required, which is inconvenient. | ||
|
|
||
| from typing import Tuple, IO, Union, AnyStr, Any, overload, Iterator, List, Type, Optional | ||
|
|
||
| import thread | ||
| import random | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two imports are actually used below. I would actually write them as |
||
| from typing import Tuple, IO, Union, AnyStr, Any, overload, Iterator, List, Iterable, Optional | ||
| from thread import LockType | ||
| from random import Random | ||
|
|
||
| TMP_MAX = ... # type: int | ||
| tempdir = ... # type: str | ||
| template = ... # type: str | ||
| _name_sequence = ... # type: Optional[_RandomNameSequence] | ||
|
|
||
| class _RandomNameSequence: | ||
| _rng = ... # type: random.Random | ||
| _rng_pid = ... # type: int | ||
| characters = ... # type: str | ||
| mutex = ... # type: thread.LockType | ||
| rng = ... # type: random.Random | ||
| def __iter__(self) -> "_RandomNameSequence": ... | ||
| characters: str = ... | ||
| mutex: LockType | ||
| @property | ||
| def rng(self) -> Random: ... | ||
| def __iter__(self) -> _RandomNameSequence: ... | ||
| def next(self) -> str: ... | ||
| # from os.path: | ||
| def normcase(self, path: AnyStr) -> AnyStr: ... | ||
|
|
||
| class _TemporaryFileWrapper(IO[str]): | ||
| close_called = ... # type: bool | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This attribute doesn't actually exist on _TemporaryFileWrapper. |
||
| delete = ... # type: bool | ||
| file = ... # type: IO | ||
| name = ... # type: Any | ||
| def __init__(self, file: IO, name, delete: bool = ...) -> None: ... | ||
| delete: bool | ||
| file: IO | ||
| name: Any | ||
| def __init__(self, file: IO, name: Any, delete: bool = ...) -> None: ... | ||
| def __del__(self) -> None: ... | ||
| def __enter__(self) -> "_TemporaryFileWrapper": ... | ||
| def __enter__(self) -> _TemporaryFileWrapper: ... | ||
| def __exit__(self, exc, value, tb) -> bool: ... | ||
| def __getattr__(self, name: unicode) -> Any: ... | ||
| def close(self) -> None: ... | ||
| def unlink(self, path: unicode) -> None: ... | ||
| # These methods don't exist directly on this object, but | ||
| # are delegated to the underlying IO object through __getattr__. | ||
| # We need to add them here so that this class is concrete. | ||
| def __iter__(self) -> Iterator[str]: ... | ||
| def fileno(self) -> int: ... | ||
| def flush(self) -> None: ... | ||
| def isatty(self) -> bool: ... | ||
| def next(self) -> str: ... | ||
| def read(self, n: int = ...) -> str: ... | ||
| def readable(self) -> bool: ... | ||
| def readline(self, limit: int = ...) -> str: ... | ||
| def readlines(self, hint: int = ...) -> List[str]: ... | ||
| def seek(self, offset: int, whence: int = ...) -> int: ... | ||
| def seekable(self) -> bool: ... | ||
| def tell(self) -> int: ... | ||
| def truncate(self, size: Optional[int] = ...) -> int: ... | ||
| def writable(self) -> bool: ... | ||
| def write(self, s: str) -> int: ... | ||
| def writelines(self, lines: Iterable[str]) -> None: ... | ||
|
|
||
|
|
||
| # TODO text files | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of these TODOs still applies: the file contains no mention of basestring and no Union return types.