Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions stdlib/@tests/stubtest_allowlists/py315.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,43 +138,18 @@ enum.__all__
enum.auto.__init__
enum.auto.value
functools.partialmethod.__new__
genericpath.ALL_BUT_LAST
genericpath.__all__
genericpath.commonprefix
genericpath.getatime
genericpath.getctime
genericpath.getmtime
genericpath.getsize
genericpath.samefile
genericpath.samestat
glob.glob0
glob.glob1
gzip.compress
hashlib.__all__
http.HTTPMethod.description
http.client.HTTPConnection.__init__
http.client.HTTPSConnection.__init__
http.server.CGIHTTPRequestHandler
http.server.SimpleHTTPRequestHandler.__init__
http.server.SimpleHTTPRequestHandler.default_content_type
http.server.__all__
importlib._abc.Loader.load_module
importlib._bootstrap_external.NamespacePath
importlib.abc.InspectLoader.source_to_code
importlib.abc.MetaPathFinder.discover
importlib.abc.PathEntryFinder.discover
importlib.metadata.DeprecatedNonAbstract
importlib.metadata.Distribution
importlib.metadata.MetadataNotFound
importlib.metadata.PathDistribution
importlib.metadata.__all__
importlib.resources._common.files
importlib.resources._common.package_to_anchor
importlib.resources.abc.Traversable.open
importlib.resources.abc.Traversable.read_text
inspect._ParameterKind.description
inspect.getdoc
inspect.getfullargspec
io.Reader.__class_getitem__
io.Reader.read
io.Writer.__class_getitem__
Expand Down Expand Up @@ -213,27 +188,9 @@ multiprocessing.managers._BaseSetProxy.clear
multiprocessing.managers._BaseSetProxy.copy
multiprocessing.managers._BaseSetProxy.pop
multiprocessing.process.BaseProcess.__init__
ntpath.ALL_BUT_LAST
ntpath.__all__
ntpath.realpath
os.path.ALL_BUT_LAST
os.path.__all__
pathlib.PurePath.__vfspath__
pathlib.PurePath.is_reserved
pdb.Pdb.print_stack_entry
pkgutil.resolve_name
platform.java_ver
posixpath.ALL_BUT_LAST
posixpath.__all__
posixpath.basename
posixpath.dirname
posixpath.isabs
posixpath.normcase
posixpath.realpath
posixpath.split
posixpath.splitdrive
posixpath.splitext
posixpath.splitroot
pprint.PrettyPrinter.__init__
pprint.pformat
pprint.pprint
Expand All @@ -256,8 +213,6 @@ profiling.sampling.sample
profiling.sampling.stack_collector
profiling.sampling.string_table
profiling.tracing
pydoc.Doc.STDLIB_DIR
pydoc.Doc.getdocloc
re.Pattern.prefixmatch
re.__all__
re.prefixmatch
Expand Down Expand Up @@ -366,4 +321,3 @@ wave.__all__
xml.etree.ElementTree.__all__
xml.is_valid_name
xml.utils
zipimport.zipimporter.load_module
66 changes: 49 additions & 17 deletions stdlib/genericpath.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sys
from _typeshed import BytesPath, FileDescriptorOrPath, StrOrBytesPath, StrPath, SupportsRichComparisonT
from collections.abc import Sequence
from typing import Literal, NewType, overload
from typing_extensions import LiteralString
from typing_extensions import LiteralString, deprecated

__all__ = [
"commonprefix",
Expand All @@ -23,22 +23,43 @@ if sys.version_info >= (3, 12):
__all__ += ["islink"]
if sys.version_info >= (3, 13):
__all__ += ["isjunction", "isdevdrive", "lexists"]
if sys.version_info >= (3, 15):
__all__ += ["ALL_BUT_LAST"]
ALL_BUT_LAST: object

# 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
# type. But because this only works when T is str, we need Sequence[T] instead.
@overload
def commonprefix(m: Sequence[LiteralString]) -> LiteralString: ...
@overload
def commonprefix(m: Sequence[StrPath]) -> str: ...
@overload
def commonprefix(m: Sequence[BytesPath]) -> bytes | Literal[""]: ...
@overload
def commonprefix(m: Sequence[list[SupportsRichComparisonT]]) -> Sequence[SupportsRichComparisonT]: ...
@overload
def commonprefix(m: Sequence[tuple[SupportsRichComparisonT, ...]]) -> Sequence[SupportsRichComparisonT]: ...
if sys.version_info >= (3, 15):
@overload
@deprecated("Deprecated since Python 3.15; use os.path.commonpath() for path prefixes.")
def commonprefix(m: Sequence[LiteralString], /) -> LiteralString: ...
@overload
@deprecated("Deprecated since Python 3.15; use os.path.commonpath() for path prefixes.")
def commonprefix(m: Sequence[StrPath], /) -> str: ...
@overload
@deprecated("Deprecated since Python 3.15; use os.path.commonpath() for path prefixes.")
def commonprefix(m: Sequence[BytesPath], /) -> bytes | Literal[""]: ...
@overload
@deprecated("Deprecated since Python 3.15; use os.path.commonpath() for path prefixes.")
def commonprefix(m: Sequence[list[SupportsRichComparisonT]], /) -> Sequence[SupportsRichComparisonT]: ...
@overload
@deprecated("Deprecated since Python 3.15; use os.path.commonpath() for path prefixes.")
def commonprefix(m: Sequence[tuple[SupportsRichComparisonT, ...]], /) -> Sequence[SupportsRichComparisonT]: ...

else:
@overload
def commonprefix(m: Sequence[LiteralString]) -> LiteralString: ...
@overload
def commonprefix(m: Sequence[StrPath]) -> str: ...
@overload
def commonprefix(m: Sequence[BytesPath]) -> bytes | Literal[""]: ...
@overload
def commonprefix(m: Sequence[list[SupportsRichComparisonT]]) -> Sequence[SupportsRichComparisonT]: ...
@overload
def commonprefix(m: Sequence[tuple[SupportsRichComparisonT, ...]]) -> Sequence[SupportsRichComparisonT]: ...

def exists(path: FileDescriptorOrPath) -> bool: ...
def getsize(filename: FileDescriptorOrPath) -> int: ...
def isfile(path: FileDescriptorOrPath) -> bool: ...
def isdir(s: FileDescriptorOrPath) -> bool: ...

Expand All @@ -47,12 +68,23 @@ if sys.version_info >= (3, 12):

# These return float if os.stat_float_times() == True,
# but int is a subclass of float.
def getatime(filename: FileDescriptorOrPath) -> float: ...
def getmtime(filename: FileDescriptorOrPath) -> float: ...
def getctime(filename: FileDescriptorOrPath) -> float: ...
def samefile(f1: FileDescriptorOrPath, f2: FileDescriptorOrPath) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...

if sys.version_info >= (3, 15):
def getsize(filename: FileDescriptorOrPath, /) -> int: ...
def getatime(filename: FileDescriptorOrPath, /) -> float: ...
def getmtime(filename: FileDescriptorOrPath, /) -> float: ...
def getctime(filename: FileDescriptorOrPath, /) -> float: ...
def samefile(f1: FileDescriptorOrPath, f2: FileDescriptorOrPath, /) -> bool: ...
def samestat(s1: os.stat_result, s2: os.stat_result, /) -> bool: ...

else:
def getsize(filename: FileDescriptorOrPath) -> int: ...
def getatime(filename: FileDescriptorOrPath) -> float: ...
def getmtime(filename: FileDescriptorOrPath) -> float: ...
def getctime(filename: FileDescriptorOrPath) -> float: ...
def samefile(f1: FileDescriptorOrPath, f2: FileDescriptorOrPath) -> bool: ...
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...

if sys.version_info >= (3, 13):
def isjunction(path: StrOrBytesPath) -> bool: ...
Expand Down
17 changes: 9 additions & 8 deletions stdlib/glob.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ __all__ = ["escape", "glob", "iglob"]
if sys.version_info >= (3, 13):
__all__ += ["translate"]

@deprecated(
"Deprecated since Python 3.10; will be removed in Python 3.15. Use `glob.glob()` with the *root_dir* argument instead."
)
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
@deprecated(
"Deprecated since Python 3.10; will be removed in Python 3.15. Use `glob.glob()` with the *root_dir* argument instead."
)
def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
if sys.version_info < (3, 15):
@deprecated(
"Deprecated since Python 3.10; will be removed in Python 3.15. Use `glob.glob()` with the *root_dir* argument instead."
)
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
@deprecated(
"Deprecated since Python 3.10; will be removed in Python 3.15. Use `glob.glob()` with the *root_dir* argument instead."
)
def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...

if sys.version_info >= (3, 11):
def glob(
Expand Down
43 changes: 34 additions & 9 deletions stdlib/http/client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,27 @@ class HTTPConnection:
host: str
port: int
sock: socket | MaybeNone # can be `None` if `.connect()` was not called
def __init__(
self,
host: str,
port: int | None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
blocksize: int = 8192,
) -> None: ...
if sys.version_info >= (3, 15):
def __init__(
self,
host: str,
port: int | None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
blocksize: int = 8192,
*,
max_response_headers: int | None = None,
) -> None: ...
else:
def __init__(
self,
host: str,
port: int | None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
blocksize: int = 8192,
) -> None: ...

def request(
self,
method: str,
Expand All @@ -211,7 +224,19 @@ class HTTPConnection:
class HTTPSConnection(HTTPConnection):
# Can be `None` if `.connect()` was not called:
sock: ssl.SSLSocket | MaybeNone
if sys.version_info >= (3, 12):
if sys.version_info >= (3, 15):
def __init__(
self,
host: str,
port: int | None = None,
*,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
context: ssl.SSLContext | None = None,
blocksize: int = 8192,
max_response_headers: int | None = None,
) -> None: ...
elif sys.version_info >= (3, 12):
def __init__(
self,
host: str,
Expand Down
53 changes: 33 additions & 20 deletions stdlib/http/server.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ from ssl import Purpose, SSLContext
from typing import Any, AnyStr, BinaryIO, ClassVar, Protocol, type_check_only
from typing_extensions import Self, deprecated

if sys.version_info >= (3, 14):
if sys.version_info >= (3, 15):
__all__ = [
"HTTPServer",
"ThreadingHTTPServer",
"HTTPSServer",
"ThreadingHTTPSServer",
"BaseHTTPRequestHandler",
"SimpleHTTPRequestHandler",
]
elif sys.version_info >= (3, 14):
__all__ = [
"HTTPServer",
"ThreadingHTTPServer",
Expand Down Expand Up @@ -77,6 +86,8 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
protocol_version: str
MessageClass: type
responses: Mapping[int, tuple[str, str]]
if sys.version_info >= (3, 15):
default_content_type: str
default_request_version: str # undocumented
weekdayname: ClassVar[Sequence[str]] # undocumented
monthname: ClassVar[Sequence[str | None]] # undocumented
Expand All @@ -102,14 +113,26 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
if sys.version_info >= (3, 12):
index_pages: ClassVar[tuple[str, ...]]
directory: str
def __init__(
self,
request: socketserver._RequestType,
client_address: _socket._RetAddress,
server: socketserver.BaseServer,
*,
directory: StrPath | None = None,
) -> None: ...
if sys.version_info >= (3, 15):
def __init__(
self,
request: socketserver._RequestType,
client_address: _socket._RetAddress,
server: socketserver.BaseServer,
*,
directory: StrPath | None = None,
extra_response_headers: Mapping[str, str] | None = None,
) -> None: ...
else:
def __init__(
self,
request: socketserver._RequestType,
client_address: _socket._RetAddress,
server: socketserver.BaseServer,
*,
directory: StrPath | None = None,
) -> None: ...

def do_GET(self) -> None: ...
def do_HEAD(self) -> None: ...
def send_head(self) -> io.BytesIO | BinaryIO | None: ... # undocumented
Expand All @@ -120,7 +143,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):

def executable(path: StrPath) -> bool: ... # undocumented

if sys.version_info >= (3, 13):
if sys.version_info < (3, 15):
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
cgi_directories: list[str]
Expand All @@ -130,13 +153,3 @@ if sys.version_info >= (3, 13):
def is_executable(self, path: StrPath) -> bool: ... # undocumented
def is_python(self, path: StrPath) -> bool: ... # undocumented
def run_cgi(self) -> None: ... # undocumented

else:
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
cgi_directories: list[str]
have_fork: bool # undocumented
def do_POST(self) -> None: ...
def is_cgi(self) -> bool: ... # undocumented
def is_executable(self, path: StrPath) -> bool: ... # undocumented
def is_python(self, path: StrPath) -> bool: ... # undocumented
def run_cgi(self) -> None: ... # undocumented
10 changes: 9 additions & 1 deletion stdlib/importlib/metadata/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ __all__ = [
"version",
]

if sys.version_info >= (3, 15):
__all__ += ["PackagePath", "MetadataNotFound", "SimplePath"]

_SimplePath: TypeAlias = SimplePath

def packages_distributions() -> Mapping[str, list[str]]: ...
Expand All @@ -39,6 +42,9 @@ class PackageNotFoundError(ModuleNotFoundError):
@property
def name(self) -> str: ... # type: ignore[override]

if sys.version_info >= (3, 15):
class MetadataNotFound(FileNotFoundError): ...

if sys.version_info >= (3, 13):
_EntryPointBase = object
elif sys.version_info >= (3, 11):
Expand Down Expand Up @@ -203,7 +209,9 @@ class FileHash:
value: str
def __init__(self, spec: str) -> None: ...

if sys.version_info >= (3, 12):
if sys.version_info >= (3, 15):
_distribution_parent = abc.ABC
elif sys.version_info >= (3, 12):
class DeprecatedNonAbstract: ...
_distribution_parent = DeprecatedNonAbstract
else:
Expand Down
8 changes: 6 additions & 2 deletions stdlib/importlib/resources/abc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ if sys.version_info >= (3, 11):
def __truediv__(self, child: StrPath, /) -> Traversable: ...
@abstractmethod
def read_bytes(self) -> bytes: ...
@abstractmethod
def read_text(self, encoding: str | None = None) -> str: ...
if sys.version_info >= (3, 15):
@abstractmethod
def read_text(self, encoding: str | None = None, errors: str | None = None) -> str: ...
else:
@abstractmethod
def read_text(self, encoding: str | None = None) -> str: ...

class TraversableResources(ResourceReader):
@abstractmethod
Expand Down
Loading