8000 Improve `codecs` stubs by AlexWaygood · Pull Request #7199 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Improve codecs stubs #7199

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 1 commit into from
Feb 14, 2022
Merged
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
12 changes: 5 additions & 7 deletions stdlib/codecs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,10 @@ class StreamReaderWriter(TextIO):
def readlines(self, sizehint: int | None = ...) -> list[str]: ...
def __next__(self) -> str: ...
def __iter__(self: Self) -> Self: ...
# This actually returns None, but that's incompatible with the supertype
def write(self, data: str) -> int: ...
def write(self, data: str) -> None: ... # type: ignore[override]
def writelines(self, list: Iterable[str]) -> None: ...
def reset(self) -> None: ...
# Same as write()
def seek(self, offset: int, whence: int = ...) -> int: ...
def seek(self, offset: int, whence: int = ...) -> None: ... # type: ignore[override]
def __enter__(self: Self) -> Self: ...
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __getattr__(self, name: str) -> Any: ...
Expand Down Expand Up @@ -253,15 +251,15 @@ class StreamRecoder(BinaryIO):
def readlines(self, sizehint: int | None = ...) -> list[bytes]: ...
def __next__(self) -> bytes: ...
def __iter__(self: Self) -> Self: ...
def write(self, data: bytes) -> int: ...
def writelines(self, list: Iterable[bytes]) -> int: ... # type: ignore # it's supposed to return None
def write(self, data: bytes) -> None: ... # type: ignore[override]
def writelines(self, list: Iterable[bytes]) -> None: ...
def reset(self) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
def seek(self, offset: int, whence: int = ...) -> None: ... # type: ignore[override]
Copy link
Member Author

Choose a reason for hiding this comment

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

seek does actually exist directly, which is why I've moved it above the comment.

# These methods don't actually exist directly, but they are needed to satisfy the BinaryIO
# interface. At runtime, they are delegated through __getattr__.
def seek(self, offset: int, whence: int = ...) -> int: ...
def close(self) -> None: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
Expand Down
0