diff --git a/stdlib/zipfile.pyi b/stdlib/zipfile.pyi index 276f8df82..130b09213 100644 --- a/stdlib/zipfile.pyi +++ b/stdlib/zipfile.pyi @@ -158,7 +158,32 @@ class ZipFile: compresslevel: int | None # undocumented mode: _ZipFileMode # undocumented pwd: str | None # undocumented - if sys.version_info >= (3, 8): + if sys.version_info >= (3, 11): + @overload + def __init__( + self, + file: StrPath | IO[bytes], + mode: Literal["r"] = ..., + compression: int = ..., + allowZip64: bool = ..., + compresslevel: int | None = ..., + *, + strict_timestamps: bool = ..., + metadata_encoding: str | None, + ) -> None: ... + @overload + def __init__( + self, + file: StrPath | IO[bytes], + mode: _ZipFileMode = ..., + compression: int = ..., + allowZip64: bool = ..., + compresslevel: int | None = ..., + *, + strict_timestamps: bool = ..., + metadata_encoding: None = ..., + ) -> None: ... + elif sys.version_info >= (3, 8): def __init__( self, file: StrPath | IO[bytes], @@ -223,7 +248,7 @@ class ZipFile: else: def writestr(self, zinfo_or_arcname: str | ZipInfo, data: bytes | str, compress_type: int | None = ...) -> None: ... if sys.version_info >= (3, 11): - def mkdir(self, zinfo_or_directory: str | ZipInfo, mode: int = ...) -> None: ... + def mkdir(self, zinfo_or_directory_name: str | ZipInfo, mode: int = ...) -> None: ... class PyZipFile(ZipFile): def __init__( @@ -275,6 +300,13 @@ if sys.version_info >= (3, 8): if sys.version_info >= (3, 10): @property def filename(self) -> PathLike[str]: ... # undocumented + if sys.version_info >= (3, 11): + @property + def suffix(self) -> str: ... + @property + def suffixes(self) -> list[str]: ... + @property + def stem(self) -> str: ... def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = ...) -> None: ... if sys.version_info >= (3, 9): diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index 8b170553e..9b94d00a9 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -107,11 +107,6 @@ urllib.request.FancyURLopener.http_error_308 urllib.request.HTTPRedirectHandler.http_error_308 weakref.WeakValueDictionary.update xmlrpc.server.SimpleXMLRPCRequestHandler.rpc_paths -zipfile.Path.stem -zipfile.Path.suffix -zipfile.Path.suffixes -zipfile.ZipFile.__init__ -zipfile.ZipFile.mkdir # stubtest complains that in 3.10 the default argument is inconsistent with the annotation, # but in 3.10+ calling the function without the default argument is in fact deprecated,