move OpenTextMode and friends to _typeshed (#4213)

This commit is contained in:
Jelle Zijlstra
2020-06-10 06:36:21 -07:00
committed by GitHub
parent 85281b636e
commit ea577cec1f
7 changed files with 50 additions and 92 deletions

View File

@@ -7,11 +7,6 @@ import sys
from mmap import mmap
from types import TracebackType
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
_bytearray_like = Union[bytearray, mmap]
DEFAULT_BUFFER_SIZE: int
@@ -22,30 +17,6 @@ SEEK_END: int
_T = TypeVar('_T', bound=IOBase)
_OpenTextMode = Literal[
'r', 'r+', '+r', 'rt', 'tr', 'rt+', 'r+t', '+rt', 'tr+', 't+r', '+tr',
'w', 'w+', '+w', 'wt', 'tw', 'wt+', 'w+t', '+wt', 'tw+', 't+w', '+tw',
'a', 'a+', '+a', 'at', 'ta', 'at+', 'a+t', '+at', 'ta+', 't+a', '+ta',
'x', 'x+', '+x', 'xt', 'tx', 'xt+', 'x+t', '+xt', 'tx+', 't+x', '+tx',
'U', 'rU', 'Ur', 'rtU', 'rUt', 'Urt', 'trU', 'tUr', 'Utr',
]
_OpenBinaryModeUpdating = Literal[
'rb+', 'r+b', '+rb', 'br+', 'b+r', '+br',
'wb+', 'w+b', '+wb', 'bw+', 'b+w', '+bw',
'ab+', 'a+b', '+ab', 'ba+', 'b+a', '+ba',
'xb+', 'x+b', '+xb', 'bx+', 'b+x', '+bx',
]
_OpenBinaryModeWriting = Literal[
'wb', 'bw',
'ab', 'ba',
'xb', 'bx',
]
_OpenBinaryModeReading = Literal[
'rb', 'br',
'rbU', 'rUb', 'Urb', 'brU', 'bUr', 'Ubr',
]
_OpenBinaryMode = Union[_OpenBinaryModeUpdating, _OpenBinaryModeReading, _OpenBinaryModeWriting]
open = builtins.open
if sys.version_info >= (3, 8):