mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-30 08:04:24 +08:00
add missing type hints in zipfile (#5795)
This commit is contained in:
@@ -6,6 +6,7 @@ from typing import IO, Callable, Dict, Iterable, Iterator, List, Optional, Proto
|
||||
from typing_extensions import Literal
|
||||
|
||||
_DateTuple = Tuple[int, int, int, int, int, int]
|
||||
_ZipFileMode = Literal["r", "w", "x", "a"]
|
||||
|
||||
class BadZipFile(Exception): ...
|
||||
|
||||
@@ -104,11 +105,15 @@ class ZipFile:
|
||||
fp: Optional[IO[bytes]]
|
||||
NameToInfo: Dict[str, ZipInfo]
|
||||
start_dir: int # undocumented
|
||||
compression: int # undocumented
|
||||
compresslevel: int | None # undocumented
|
||||
mode: _ZipFileMode # undocumented
|
||||
pwd: str | None # undocumented
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(
|
||||
self,
|
||||
file: Union[StrPath, IO[bytes]],
|
||||
mode: str = ...,
|
||||
mode: _ZipFileMode = ...,
|
||||
compression: int = ...,
|
||||
allowZip64: bool = ...,
|
||||
compresslevel: Optional[int] = ...,
|
||||
@@ -119,7 +124,7 @@ class ZipFile:
|
||||
def __init__(
|
||||
self,
|
||||
file: Union[StrPath, IO[bytes]],
|
||||
mode: str = ...,
|
||||
mode: _ZipFileMode = ...,
|
||||
compression: int = ...,
|
||||
allowZip64: bool = ...,
|
||||
compresslevel: Optional[int] = ...,
|
||||
@@ -137,7 +142,7 @@ class ZipFile:
|
||||
def infolist(self) -> List[ZipInfo]: ...
|
||||
def namelist(self) -> List[str]: ...
|
||||
def open(
|
||||
self, name: Union[str, ZipInfo], mode: str = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...
|
||||
self, name: Union[str, ZipInfo], mode: Literal["r", "w"] = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...
|
||||
) -> IO[bytes]: ...
|
||||
def extract(self, member: Union[str, ZipInfo], path: Optional[StrPath] = ..., pwd: Optional[bytes] = ...) -> str: ...
|
||||
def extractall(
|
||||
@@ -194,7 +199,8 @@ class ZipInfo:
|
||||
CRC: int
|
||||
compress_size: int
|
||||
file_size: int
|
||||
def __init__(self, filename: Optional[str] = ..., date_time: Optional[_DateTuple] = ...) -> None: ...
|
||||
orig_filename: str # undocumented
|
||||
def __init__(self, filename: str = ..., date_time: _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