mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 14:01:55 +08:00
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:
@@ -2,10 +2,9 @@ import io
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, Callable, Dict, Iterable, Iterator, List, Optional, Protocol, Sequence, Text, Tuple, Type, Union
|
||||
from typing import IO, Any, Callable, Dict, Iterable, Iterator, List, Optional, Protocol, Sequence, Tuple, Type, Union
|
||||
|
||||
_SZI = Union[Text, ZipInfo]
|
||||
_DT = Tuple[int, int, int, int, int, int]
|
||||
_DateTuple = Tuple[int, int, int, int, int, int]
|
||||
|
||||
class BadZipFile(Exception): ...
|
||||
|
||||
@@ -47,12 +46,12 @@ class _Writer(Protocol):
|
||||
def write(self, __s: str) -> Any: ...
|
||||
|
||||
class ZipFile:
|
||||
filename: Optional[Text]
|
||||
filename: Optional[str]
|
||||
debug: int
|
||||
comment: bytes
|
||||
filelist: List[ZipInfo]
|
||||
fp: Optional[IO[bytes]]
|
||||
NameToInfo: Dict[Text, ZipInfo]
|
||||
NameToInfo: Dict[str, ZipInfo]
|
||||
start_dir: int # undocumented
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(
|
||||
@@ -76,24 +75,26 @@ class ZipFile:
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, file: Union[StrPath, IO[bytes]], mode: Text = ..., compression: int = ..., allowZip64: bool = ...
|
||||
self, file: Union[StrPath, IO[bytes]], mode: str = ..., compression: int = ..., allowZip64: bool = ...
|
||||
) -> None: ...
|
||||
def __enter__(self) -> ZipFile: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def getinfo(self, name: Text) -> ZipInfo: ...
|
||||
def getinfo(self, name: str) -> ZipInfo: ...
|
||||
def infolist(self) -> List[ZipInfo]: ...
|
||||
def namelist(self) -> List[Text]: ...
|
||||
def open(self, name: _SZI, mode: Text = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
|
||||
def extract(self, member: _SZI, path: Optional[StrPath] = ..., pwd: Optional[bytes] = ...) -> str: ...
|
||||
def namelist(self) -> List[str]: ...
|
||||
def open(
|
||||
self, name: Union[str, ZipInfo], mode: str = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...
|
||||
) -> IO[bytes]: ...
|
||||
def extract(self, member: Union[str, ZipInfo], path: Optional[StrPath] = ..., pwd: Optional[bytes] = ...) -> str: ...
|
||||
def extractall(
|
||||
self, path: Optional[StrPath] = ..., members: Optional[Iterable[Text]] = ..., pwd: Optional[bytes] = ...
|
||||
self, path: Optional[StrPath] = ..., members: Optional[Iterable[str]] = ..., pwd: Optional[bytes] = ...
|
||||
) -> None: ...
|
||||
def printdir(self, file: Optional[_Writer] = ...) -> None: ...
|
||||
def setpassword(self, pwd: bytes) -> None: ...
|
||||
def read(self, name: _SZI, pwd: Optional[bytes] = ...) -> bytes: ...
|
||||
def read(self, name: Union[str, ZipInfo], pwd: Optional[bytes] = ...) -> bytes: ...
|
||||
def testzip(self) -> Optional[str]: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def write(
|
||||
@@ -108,13 +109,15 @@ class ZipFile:
|
||||
if sys.version_info >= (3, 7):
|
||||
def writestr(
|
||||
self,
|
||||
zinfo_or_arcname: _SZI,
|
||||
zinfo_or_arcname: Union[str, ZipInfo],
|
||||
data: Union[bytes, str],
|
||||
compress_type: Optional[int] = ...,
|
||||
compresslevel: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def writestr(self, zinfo_or_arcname: _SZI, data: Union[bytes, str], compress_type: Optional[int] = ...) -> None: ...
|
||||
def writestr(
|
||||
self, zinfo_or_arcname: Union[str, ZipInfo], data: Union[bytes, str], compress_type: Optional[int] = ...
|
||||
) -> None: ...
|
||||
|
||||
class PyZipFile(ZipFile):
|
||||
def __init__(
|
||||
@@ -123,8 +126,8 @@ class PyZipFile(ZipFile):
|
||||
def writepy(self, pathname: str, basename: str = ..., filterfunc: Optional[Callable[[str], bool]] = ...) -> None: ...
|
||||
|
||||
class ZipInfo:
|
||||
filename: Text
|
||||
date_time: _DT
|
||||
filename: str
|
||||
date_time: _DateTuple
|
||||
compress_type: int
|
||||
comment: bytes
|
||||
extra: bytes
|
||||
@@ -140,7 +143,7 @@ class ZipInfo:
|
||||
CRC: int
|
||||
compress_size: int
|
||||
file_size: int
|
||||
def __init__(self, filename: Optional[Text] = ..., date_time: Optional[_DT] = ...) -> None: ...
|
||||
def __init__(self, filename: Optional[str] = ..., date_time: Optional[_DateTuple] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@classmethod
|
||||
def from_file(cls, filename: StrPath, arcname: Optional[StrPath] = ..., *, strict_timestamps: bool = ...) -> ZipInfo: ...
|
||||
|
||||
Reference in New Issue
Block a user