From 47700598948eca4d9b37f8f395f346b0ccb5100a Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 30 Oct 2019 03:46:31 +0100 Subject: [PATCH] Add missing ZipFile constructor arguments (#3414) Closes: #3413 --- stdlib/2and3/zipfile.pyi | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/stdlib/2and3/zipfile.pyi b/stdlib/2and3/zipfile.pyi index a7737215d..1216371e9 100644 --- a/stdlib/2and3/zipfile.pyi +++ b/stdlib/2and3/zipfile.pyi @@ -8,7 +8,7 @@ import sys if sys.version_info >= (3, 6): - _Path = Union[os.PathLike[Text], Text] + _Path = Union[os.PathLike[str], str] else: _Path = Text _SZI = Union[Text, ZipInfo] @@ -51,8 +51,30 @@ class ZipFile: fp: IO[bytes] NameToInfo: Dict[Text, ZipInfo] start_dir: int # undocumented - def __init__(self, file: Union[_Path, IO[bytes]], mode: Text = ..., compression: int = ..., - allowZip64: bool = ...) -> None: ... + if sys.version_info >= (3, 8): + def __init__( + self, + file: Union[_Path, IO[bytes]], + mode: Text = ..., + compression: int = ..., + allowZip64: bool = ..., + compresslevel: Optional[int] = ..., + *, + strict_timestamps: bool = ..., + ) -> None: ... + elif sys.version_info >= (3, 7): + def __init__( + self, + file: Union[_Path, IO[bytes]], + mode: Text = ..., + compression: int = ..., + allowZip64: bool = ..., + compresslevel: Optional[int] = ..., + ) -> None: ... + else: + def __init__( + self, file: Union[_Path, 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],