mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import io
|
||||
from _typeshed import StrPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, Callable, Dict, Iterable, List, Optional, Pattern, Protocol, Sequence, Text, Tuple, Type, Union
|
||||
from typing import IO, Any, Callable, Dict, Iterable, List, Pattern, Protocol, Sequence, Text, Tuple, Type, Union
|
||||
|
||||
_SZI = Union[Text, ZipInfo]
|
||||
_DT = Tuple[int, int, int, int, int, int]
|
||||
@@ -18,7 +18,7 @@ class ZipExtFile(io.BufferedIOBase):
|
||||
|
||||
PATTERN: Pattern[str] = ...
|
||||
|
||||
newlines: Optional[List[bytes]]
|
||||
newlines: List[bytes] | None
|
||||
mode: str
|
||||
name: str
|
||||
def __init__(
|
||||
@@ -26,48 +26,44 @@ class ZipExtFile(io.BufferedIOBase):
|
||||
fileobj: IO[bytes],
|
||||
mode: str,
|
||||
zipinfo: ZipInfo,
|
||||
decrypter: Optional[Callable[[Sequence[int]], bytes]] = ...,
|
||||
decrypter: Callable[[Sequence[int]], bytes] | None = ...,
|
||||
close_fileobj: bool = ...,
|
||||
) -> None: ...
|
||||
def read(self, n: Optional[int] = ...) -> bytes: ...
|
||||
def read(self, n: int | None = ...) -> bytes: ...
|
||||
def readline(self, limit: int = ...) -> bytes: ... # type: ignore
|
||||
def __repr__(self) -> str: ...
|
||||
def peek(self, n: int = ...) -> bytes: ...
|
||||
def read1(self, n: Optional[int]) -> bytes: ... # type: ignore
|
||||
def read1(self, n: int | None) -> bytes: ... # type: ignore
|
||||
|
||||
class _Writer(Protocol):
|
||||
def write(self, __s: str) -> Any: ...
|
||||
|
||||
class ZipFile:
|
||||
filename: Optional[Text]
|
||||
filename: Text | None
|
||||
debug: int
|
||||
comment: bytes
|
||||
filelist: List[ZipInfo]
|
||||
fp: Optional[IO[bytes]]
|
||||
fp: IO[bytes] | None
|
||||
NameToInfo: Dict[Text, ZipInfo]
|
||||
start_dir: int # undocumented
|
||||
def __init__(
|
||||
self, file: Union[StrPath, IO[bytes]], mode: Text = ..., compression: int = ..., allowZip64: bool = ...
|
||||
) -> None: ...
|
||||
def __init__(self, file: StrPath | IO[bytes], mode: Text = ..., 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]
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def getinfo(self, name: Text) -> 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 extractall(
|
||||
self, path: Optional[StrPath] = ..., members: Optional[Iterable[Text]] = ..., pwd: Optional[bytes] = ...
|
||||
) -> None: ...
|
||||
def open(self, name: _SZI, mode: Text = ..., pwd: bytes | None = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
|
||||
def extract(self, member: _SZI, path: StrPath | None = ..., pwd: bytes | None = ...) -> str: ...
|
||||
def extractall(self, path: StrPath | None = ..., members: Iterable[Text] | None = ..., pwd: bytes | None = ...) -> None: ...
|
||||
def printdir(self) -> None: ...
|
||||
def setpassword(self, pwd: bytes) -> None: ...
|
||||
def read(self, name: _SZI, pwd: Optional[bytes] = ...) -> bytes: ...
|
||||
def testzip(self) -> Optional[str]: ...
|
||||
def write(self, filename: StrPath, arcname: Optional[StrPath] = ..., compress_type: Optional[int] = ...) -> None: ...
|
||||
def writestr(self, zinfo_or_arcname: _SZI, bytes: bytes, compress_type: Optional[int] = ...) -> None: ...
|
||||
def read(self, name: _SZI, pwd: bytes | None = ...) -> bytes: ...
|
||||
def testzip(self) -> str | None: ...
|
||||
def write(self, filename: StrPath, arcname: StrPath | None = ..., compress_type: int | None = ...) -> None: ...
|
||||
def writestr(self, zinfo_or_arcname: _SZI, bytes: bytes, compress_type: int | None = ...) -> None: ...
|
||||
|
||||
class PyZipFile(ZipFile):
|
||||
def writepy(self, pathname: Text, basename: Text = ...) -> None: ...
|
||||
@@ -90,13 +86,13 @@ class ZipInfo:
|
||||
CRC: int
|
||||
compress_size: int
|
||||
file_size: int
|
||||
def __init__(self, filename: Optional[Text] = ..., date_time: Optional[_DT] = ...) -> None: ...
|
||||
def FileHeader(self, zip64: Optional[bool] = ...) -> bytes: ...
|
||||
def __init__(self, filename: Text | None = ..., date_time: _DT | None = ...) -> None: ...
|
||||
def FileHeader(self, zip64: bool | None = ...) -> bytes: ...
|
||||
|
||||
class _PathOpenProtocol(Protocol):
|
||||
def __call__(self, mode: str = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
|
||||
def __call__(self, mode: str = ..., pwd: bytes | None = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
|
||||
|
||||
def is_zipfile(filename: Union[StrPath, IO[bytes]]) -> bool: ...
|
||||
def is_zipfile(filename: StrPath | IO[bytes]) -> bool: ...
|
||||
|
||||
ZIP_STORED: int
|
||||
ZIP_DEFLATED: int
|
||||
|
||||
Reference in New Issue
Block a user