From 03e65e1f1af190990b0403371d1df68f0518a52a Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Mon, 28 Aug 2023 12:19:09 +0300 Subject: [PATCH] Update `genericpath` to 3.12 (#10623) --- stdlib/genericpath.pyi | 8 +++++++- tests/stubtest_allowlists/py312.txt | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/stdlib/genericpath.pyi b/stdlib/genericpath.pyi index 46426b63c..be08f7a3c 100644 --- a/stdlib/genericpath.pyi +++ b/stdlib/genericpath.pyi @@ -1,5 +1,6 @@ import os -from _typeshed import BytesPath, FileDescriptorOrPath, StrPath, SupportsRichComparisonT +import sys +from _typeshed import BytesPath, FileDescriptorOrPath, StrOrBytesPath, StrPath, SupportsRichComparisonT from collections.abc import Sequence from typing import overload from typing_extensions import Literal, LiteralString @@ -17,6 +18,8 @@ __all__ = [ "sameopenfile", "samestat", ] +if sys.version_info >= (3, 12): + __all__ += ["islink"] # All overloads can return empty string. Ideally, Literal[""] would be a valid # Iterable[T], so that list[T] | Literal[""] could be used as a return @@ -36,6 +39,9 @@ def getsize(filename: FileDescriptorOrPath) -> int: ... def isfile(path: FileDescriptorOrPath) -> bool: ... def isdir(s: FileDescriptorOrPath) -> bool: ... +if sys.version_info >= (3, 12): + def islink(path: StrOrBytesPath) -> bool: ... + # These return float if os.stat_float_times() == True, # but int is a subclass of float. def getatime(filename: FileDescriptorOrPath) -> float: ... diff --git a/tests/stubtest_allowlists/py312.txt b/tests/stubtest_allowlists/py312.txt index 9489cdc69..85ce2b301 100644 --- a/tests/stubtest_allowlists/py312.txt +++ b/tests/stubtest_allowlists/py312.txt @@ -12,8 +12,6 @@ enum.Enum.__signature__ enum.EnumMeta.__call__ enum.EnumType.__call__ enum.property.member -genericpath.__all__ -genericpath.islink gzip.GzipFile.filename http.client.HTTPConnection.get_proxy_response_headers imaplib.IMAP4_SSL.__init__