8000 Fix return types in `codecs` (#7199) · python/typeshed@f3ad017 · GitHub
[go: up one dir, main page]

Skip to content

Commit f3ad017

Browse files
authored
Fix return types in codecs (#7199)
1 parent 7682ae9 commit f3ad017

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

stdlib/codecs.pyi

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,10 @@ class StreamReaderWriter(TextIO):
217217
def readlines(self, sizehint: int | None = ...) -> list[str]: ...
218218
def __next__(self) -> str: ...
219219
def __iter__(self: Self) -> Self: ...
220-
# This actually returns None, but that's incompatible with the supertype
221-
def write(self, data: str) -> int: ...
220+
def write(self, data: str) -> None: ... # type: ignore[override]
222221
def writelines(self, list: Iterable[str]) -> None: ...
223222
def reset(self) -> None: ...
224-
# Same as write()
225-
def seek(self, offset: int, whence: int = ...) -> int: ...
223+
def seek(self, offset: int, whence: int = ...) -> None: ... # type: ignore[override]
226224
def __enter__(self: Self) -> Self: ...
227225
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
22822 8000 6
def __getattr__(self, name: str) -> Any: ...
@@ -253,15 +251,15 @@ class StreamRecoder(BinaryIO):
253251
def readlines(self, sizehint: int | None = ...) -> list[bytes]: ...
254252
def __next__(self) -> bytes: ...
255253
def __iter__(self: Self) -> Self: ...
256-
def write(self, data: bytes) -> int: ...
257-
def writelines(self, list: Iterable[bytes]) -> int: ... # type: ignore # it's supposed to return None
254+
def write(self, data: bytes) -> None: ... # type: ignore[override]
255+
def writelines(self, list: Iterable[bytes]) -> None: ...
258256
def reset(self) -> None: ...
259257
def __getattr__(self, name: str) -> Any: ...
260258
def __enter__(self: Self) -> Self: ...
261259
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
260+
def seek(self, offset: int, whence: int = ...) -> None: ... # type: ignore[override]
262261
# These methods don't actually exist directly, but they are needed to satisfy the BinaryIO
263262
# interface. At runtime, they are delegated through __getattr__.
264-
def seek(self, offset: int, whence: int = ...) -> int: ...
265263
def close(self) -> None: ...
266264
def fileno(self) -> int: ...
267265
def flush(self) -> None: ...

0 commit comments

Comments
 (0)
0