Skip to content

Commit 4770059

Browse files
srittauJelleZijlstra
authored andcommitted
Add missing ZipFile constructor arguments (#3414)
Closes: #3413
1 parent aae01b8 commit 4770059

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

stdlib/2and3/zipfile.pyi

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import sys
88

99

1010
if sys.version_info >= (3, 6):
11-
_Path = Union[os.PathLike[Text], Text]
11+
_Path = Union[os.PathLike[str], str]
1212
else:
1313
_Path = Text
1414
_SZI = Union[Text, ZipInfo]
@@ -51,8 +51,30 @@ class ZipFile:
5151
fp: IO[bytes]
5252
NameToInfo: Dict[Text, ZipInfo]
5353
start_dir: int # undocumented
54-
def __init__(self, file: Union[_Path, IO[bytes]], mode: Text = ..., compression: int = ...,
55-
allowZip64: bool = ...) -> None: ...
54+
if sys.version_info >= (3, 8):
55+
def __init__(
56+
self,
57+
file: Union[_Path, IO[bytes]],
58+
mode: Text = ...,
59+
compression: int = ...,
60+
allowZip64: bool = ...,
61+
compresslevel: Optional[int] = ...,
62+
*,
63+
strict_timestamps: bool = ...,
64+
) -> None: ...
65+
elif sys.version_info >= (3, 7):
66+
def __init__(
67+
self,
68+
file: Union[_Path, IO[bytes]],
69+
mode: Text = ...,
70+
compression: int = ...,
71+
allowZip64: bool = ...,
72+
compresslevel: Optional[int] = ...,
73+
) -> None: ...
74+
else:
75+
def __init__(
76+
self, file: Union[_Path, IO[bytes]], mode: Text = ..., compression: int = ..., allowZip64: bool = ...,
77+
) -> None: ...
5678
def __enter__(self) -> ZipFile: ...
5779
def __exit__(self, exc_type: Optional[Type[BaseException]],
5880
exc_val: Optional[BaseException],

0 commit comments

Comments
 (0)