Remove compatibility aliases (#5464)

* Remove compatibility aliases

Remove a few instances of Text

Use aliases from _typeshed

* Remove unused imports
This commit is contained in:
Sebastian Rittau
2021-05-15 19:49:20 +02:00
committed by GitHub
parent 056981b957
commit 841a365284
26 changed files with 483 additions and 585 deletions

View File

@@ -1,20 +1,15 @@
import sys
from array import array
from mmap import mmap
from typing import Any, Iterator, Text, Tuple, Union
from _typeshed import ReadableBuffer, WriteableBuffer
from typing import Any, Iterator, Tuple, Union
class error(Exception): ...
_FmtType = Union[bytes, Text]
_BufferType = Union[array[int], bytes, bytearray, memoryview, mmap]
_WriteBufferType = Union[array[Any], bytearray, memoryview, mmap]
def pack(fmt: _FmtType, *v: Any) -> bytes: ...
def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...
def unpack(__format: _FmtType, __buffer: _BufferType) -> Tuple[Any, ...]: ...
def unpack_from(__format: _FmtType, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ...
def iter_unpack(__format: _FmtType, __buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...
def calcsize(__format: _FmtType) -> int: ...
def pack(fmt: Union[str, bytes], *v: Any) -> bytes: ...
def pack_into(fmt: Union[str, bytes], buffer: WriteableBuffer, offset: int, *v: Any) -> None: ...
def unpack(__format: Union[str, bytes], __buffer: ReadableBuffer) -> Tuple[Any, ...]: ...
def unpack_from(__format: Union[str, bytes], buffer: ReadableBuffer, offset: int = ...) -> Tuple[Any, ...]: ...
def iter_unpack(__format: Union[str, bytes], __buffer: ReadableBuffer) -> Iterator[Tuple[Any, ...]]: ...
def calcsize(__format: Union[str, bytes]) -> int: ...
class Struct:
if sys.version_info >= (3, 7):
@@ -22,9 +17,9 @@ class Struct:
else:
format: bytes
size: int
def __init__(self, format: _FmtType) -> None: ...
def __init__(self, format: Union[str, bytes]) -> None: ...
def pack(self, *v: Any) -> bytes: ...
def pack_into(self, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...
def unpack(self, __buffer: _BufferType) -> Tuple[Any, ...]: ...
def unpack_from(self, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ...
def iter_unpack(self, __buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...
def pack_into(self, buffer: WriteableBuffer, offset: int, *v: Any) -> None: ...
def unpack(self, __buffer: ReadableBuffer) -> Tuple[Any, ...]: ...
def unpack_from(self, buffer: ReadableBuffer, offset: int = ...) -> Tuple[Any, ...]: ...
def iter_unpack(self, __buffer: ReadableBuffer) -> Iterator[Tuple[Any, ...]]: ...