Skip to content

Commit 74d043b

Browse files
authored
Use Literal type in io and _compression (#6917)
1 parent f9c650d commit 74d043b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

stdlib/_compression.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from _typeshed import WriteableBuffer
2-
from io import BufferedIOBase, RawIOBase
2+
from io import DEFAULT_BUFFER_SIZE, BufferedIOBase, RawIOBase
33
from typing import Any, Callable, Protocol
44

5-
BUFFER_SIZE: Any
5+
BUFFER_SIZE = DEFAULT_BUFFER_SIZE
66

77
class _Reader(Protocol):
88
def read(self, __n: int) -> bytes: ...

stdlib/io.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer
55
from os import _Opener
66
from types import TracebackType
77
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, TextIO
8+
from typing_extensions import Literal
89

9-
DEFAULT_BUFFER_SIZE: int
10+
DEFAULT_BUFFER_SIZE: Literal[8192]
1011

11-
SEEK_SET: int
12-
SEEK_CUR: int
13-
SEEK_END: int
12+
SEEK_SET: Literal[0]
13+
SEEK_CUR: Literal[1]
14+
SEEK_END: Literal[2]
1415

1516
open = builtins.open
1617

0 commit comments

Comments
 (0)