GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tempfile.SpooledTemporaryFile: inherit from IOBase on 3.11 by JelleZijlstra · Pull Request #7802 · python/typeshed

tempfile.SpooledTemporaryFile: inherit from IOBase on 3.11 #7802

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.

Sign up for GitHub

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
JelleZijlstra merged 13 commits into master from JelleZijlstra-patch-7
May 18, 2022

Uh oh!

There was an error while loading. Please reload this page.

Merged

tempfile.SpooledTemporaryFile: inherit from IOBase on 3.11 #7802

Changes from 8 commits
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
52c19bf
tempfile.SpooledTemporaryFile: inherit from IOBase on 3.11
JelleZijlstra May 7, 2022
3381dba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 7, 2022
5d41486
Add missing import
AlexWaygood May 7, 2022
20bbbca
Fix pre-3.11 lies
JelleZijlstra May 8, 2022
2f480cd
goodbye LSP
JelleZijlstra May 8, 2022
14ed18d
less cryptic name
JelleZijlstra May 8, 2022
c8793ec
another one
JelleZijlstra May 8, 2022
091a826
add .detach()
JelleZijlstra May 8, 2022
0dbb9ec
Merge branch 'master' into JelleZijlstra-patch-7
AlexWaygood May 17, 2022
d4d73e5
stubtest
JelleZijlstra May 17, 2022
1106632
pos-only args
JelleZijlstra May 18, 2022
4a27d2d
comments
JelleZijlstra May 18, 2022
ce2f8c2
Merge branch 'master' into JelleZijlstra-patch-7
JelleZijlstra May 18, 2022
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

32 changes: 22 additions & 10 deletions 32 stdlib/tempfile.pyi
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import io
import os
import sys
from _typeshed import Self
from _typeshed import Self, WriteableBuffer
from collections.abc import Iterable, Iterator
from types import TracebackType
from typing import IO, Any, AnyStr, Generic, overload
Expand Down Expand Up @@ -217,9 +218,14 @@ class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]):
def write(self, s: AnyStr) -> int: ...
def writelines(self, lines: Iterable[AnyStr]) -> None: ...

# It does not actually derive from IO[AnyStr], but it does implement the
# protocol.
class SpooledTemporaryFile(IO[AnyStr]):
# It does not actually derive from IO[AnyStr], but it does mostly behave
# like one.
Comment thread Outdated

@srittau srittau May 17, 2022

Copy link
Copy Markdown
Collaborator

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.

The comment should probably be moved down above the class itself.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@JelleZijlstra JelleZijlstra May 18, 2022

Copy link
Copy Markdown
Member Author

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.

Done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
if sys.version_info >= (3, 11):
_SpooledTemporaryFileBase = io.IOBase
else:
_SpooledTemporaryFileBase = object

class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase):
@property
def encoding(self) -> str: ... # undocumented
@property
Expand Down Expand Up @@ -318,20 +324,26 @@ class SpooledTemporaryFile(IO[AnyStr]):
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
if sys.version_info >= (3, 11):
def read1(self, __size: int = ...) -> AnyStr: ...
def readinto(self, b: WriteableBuffer) -> int: ...
def readinto1(self, b: WriteableBuffer) -> int: ...
Comment thread
JelleZijlstra marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

def detach(self) -> io.RawIOBase: ...

def read(self, n: int = ...) -> AnyStr: ...
def readline(self, limit: int = ...) -> AnyStr: ...
def readlines(self, hint: int = ...) -> list[AnyStr]: ...
def readline(self, limit: int | None = ...) -> AnyStr: ... # type: ignore[override]
def readlines(self, hint: int = ...) -> list[AnyStr]: ... # type: ignore[override]
Comment thread
JelleZijlstra marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
def truncate(self, size: int | None = ...) -> None: ... # type: ignore[override]
def write(self, s: AnyStr) -> int: ...
def writelines(self, iterable: Iterable[AnyStr]) -> None: ...
def __iter__(self) -> Iterator[AnyStr]: ...
# Other than the following methods, which do not exist on SpooledTemporaryFile
def writelines(self, iterable: Iterable[AnyStr]) -> None: ... # type: ignore[override]
def __iter__(self) -> Iterator[AnyStr]: ... # type: ignore[override]
# These exist at runtime only on 3.11+.
def readable(self) -> bool: ...
def seekable(self) -> bool: ...
def writable(self) -> bool: ...
def __next__(self) -> AnyStr: ...
def __next__(self) -> AnyStr: ... # type: ignore[override]
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.