Skip to content
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

Fix stub for SpooledTemporaryFile #2452

Merged
merged 7 commits into from
Nov 20, 2018
Merged
Changes from 1 commit
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
20 changes: 14 additions & 6 deletions stdlib/3/tempfile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,20 @@ if sys.version_info >= (3, 5):
dir: Optional[AnyStr] = ..., delete: bool =...
) -> IO[Any]:
...
def SpooledTemporaryFile(
max_size: int = ..., mode: str = ..., buffering: int = ...,
encoding: str = ..., newline: str = ..., suffix: Optional[AnyStr] = ...,
prefix: Optional[AnyStr] = ..., dir: Optional[AnyStr] = ...
) -> IO[Any]:
...

# It does not actually derive from IO[Any], but it does implement the
# protocol.
class SpooledTemporaryFile(IO[Any]):
srittau marked this conversation as resolved.
Show resolved Hide resolved
def __init__(self, max_size: int = ..., mode: str = ...,
buffering: int = ..., encoding: Optional[str] = ...,
newline: Optional[str] = ..., suffix: Optional[str] = ...,
prefix: Optional[str] = ..., dir: Optional[str] = ...
) -> None: ...
def rollover(self) -> None: ...
def __enter__(self) -> 'SpooledTemporaryFile': ...
Copy link
Member

Choose a reason for hiding this comment

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

Quoting is not necessary in stubs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType]) -> bool: ...

class TemporaryDirectory(Generic[AnyStr]):
name = ... # type: str
Expand Down