PY-91232 Update typeshed version to 0ff2bb230ad3c0ce33835f4b68c458744d1ac1ea

Closes PY-91232


(cherry picked from commit 72c90f5c7bf649702804c4e62c2f01d1fc9e0483)

IJ-MR-215463

GitOrigin-RevId: 17be881f2a03915ff2ba33a4fbbc216c7362a293
This commit is contained in:
PyCharm Automation Bot
2026-07-28 11:36:02 +00:00
committed by intellij-monorepo-bot
parent b75537c797
commit 992d0b404e
335 changed files with 6102 additions and 2031 deletions
+19
View File
@@ -320,6 +320,25 @@ documentation. Whenever you find them disagreeing, model the type
information after the actual implementation and file an issue on the
project's tracker to fix their documentation.
### Deprecations (using the `@deprecated` decorator)
Generally deprecactions using the `@deprecated` decorator are added more
liberally in typeshed than runtime deprecation warnings. Here are some
guidelines that can be deviated from in special cases.
Use `@deprecated` if and only if
- a feature is deprecated at runtime (either using `@deprecated` or with a
runtime warning); or
- a feature is documented to be deprecated (e.g. in API documention,
docstrings, or comments).
For standard library features that are not deprecated in all Python versions
currently supported by typeshed use `@deprecated` for
- all versions starting with the "Deprecated since" version, plus
- all versions for which an alternative is available.
### Docstrings
Typeshed stubs should not include duplicated docstrings from the source code.
@@ -73,13 +73,17 @@
"stubs/parsimonious/parsimonious/nodes.pyi",
"stubs/peewee",
"stubs/pexpect",
"stubs/pika",
"stubs/pika/pika/adapters/twisted_connection.pyi",
"stubs/pika/pika/adapters/utils/connection_workflow.pyi",
"stubs/pika/pika/callback.pyi",
"stubs/pika/pika/channel.pyi",
"stubs/pony",
"stubs/protobuf",
"stubs/psutil/psutil/__init__.pyi",
"stubs/psycopg2",
"stubs/punq",
"stubs/pyasn1",
"stubs/pycups",
"stubs/Pygments",
"stubs/PyMySQL",
"stubs/pyogrio",
@@ -15,7 +15,7 @@ assert_type(pow(1, 0, None), Literal[1])
# that passing 0 for the third argument will lead to an exception being raised
# (see discussion in #8566)
#
# assert_type(pow(2, 4, 0), NoReturn)
# assert_type(pow(2, 4, 0), Never)
assert_type(pow(2, 4), int)
# pyright infers a literal type here, but mypy does not.
@@ -31,4 +31,18 @@ class MyLenAndGetItem(Generic[_T]):
len_and_get_item: MyLenAndGetItem[int] = MyLenAndGetItem()
assert_type(list(reversed(len_and_get_item)), "list[int]")
assert_type(reversed(len_and_get_item), "reversed[int]")
class UnTrue:
def __reversed__(self) -> UnFalse:
return UnFalse()
class UnFalse:
def __reversed__(self) -> UnTrue:
return UnTrue()
assert_type(reversed(UnTrue()), "UnFalse")
assert_type(reversed(reversed(UnTrue())), "UnTrue")
+1 -1
View File
@@ -1 +1 @@
def __getattr__(name: str): ... # incomplete module
def __getattr__(name: str, /): ... # incomplete module
+5 -5
View File
@@ -249,7 +249,7 @@ class _UnionType(_CTypeBaseType):
# At runtime, various attributes are created on a Union subclass based
# on its _fields_. This method doesn't exist, but represents those
# dynamically created attributes.
def __getattr__(self, name: str) -> _CField[Any, Any, Any]: ...
def __getattr__(self, name: str, /) -> _CField[Any, Any, Any]: ...
if sys.version_info < (3, 13):
# Inherited from CType_Type starting on 3.13
def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
@@ -263,8 +263,8 @@ class Union(_CData, metaclass=_UnionType):
_align_: ClassVar[int]
def __init__(self, *args: Any, **kw: Any) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...
def __getattr__(self, name: str, /) -> Any: ...
def __setattr__(self, name: str, value: Any, /) -> None: ...
# This class is not exposed. It calls itself _ctypes.PyCStructType.
@type_check_only
@@ -277,7 +277,7 @@ class _PyCStructType(_CTypeBaseType):
# At runtime, various attributes are created on a Structure subclass based
# on its _fields_. This method doesn't exist, but represents those
# dynamically created attributes.
def __getattr__(self, name: str) -> _CField[Any, Any, Any]: ...
def __getattr__(self, name: str, /) -> _CField[Any, Any, Any]: ...
if sys.version_info < (3, 13):
# Inherited from CType_Type starting on 3.13
def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
@@ -295,7 +295,7 @@ class Structure(_CData, metaclass=_PyCStructType):
_layout_: ClassVar[Literal["ms", "gcc-sysv"]]
def __init__(self, *args: Any, **kw: Any) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __getattr__(self, name: str, /) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...
# This class is not exposed. It calls itself _ctypes.PyCArrayType.
@@ -1,12 +1,13 @@
import sys
from collections.abc import Iterable
from typing import ClassVar, Literal, NoReturn
from typing import ClassVar, Literal
from typing_extensions import Never
class Quitter:
name: str
eof: str
def __init__(self, name: str, eof: str) -> None: ...
def __call__(self, code: sys._ExitCode = None) -> NoReturn: ...
def __call__(self, code: sys._ExitCode = None) -> Never: ...
class _Printer:
MAXLINES: ClassVar[Literal[23]]
+4 -4
View File
@@ -4,8 +4,8 @@ from _typeshed import structseq
from collections.abc import Callable
from threading import Thread
from types import TracebackType
from typing import Any, Final, NoReturn, final, overload
from typing_extensions import TypeVarTuple, Unpack, deprecated, disjoint_base
from typing import Any, Final, final, overload
from typing_extensions import Never, TypeVarTuple, Unpack, deprecated, disjoint_base
_Ts = TypeVarTuple("_Ts")
@@ -82,9 +82,9 @@ def start_new(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]
def start_new(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any], /) -> int: ... # undocumented
def interrupt_main(signum: signal.Signals = signal.SIGINT, /) -> None: ...
def exit() -> NoReturn: ...
def exit() -> Never: ...
@deprecated("Obsolete synonym. Use `exit()` instead.")
def exit_thread() -> NoReturn: ... # undocumented
def exit_thread() -> Never: ... # undocumented
def allocate_lock() -> LockType: ...
@deprecated("Obsolete synonym. Use `allocate_lock()` instead.")
def allocate() -> LockType: ... # undocumented
@@ -58,6 +58,14 @@ Unused: TypeAlias = object # stable
# for more information.
MaybeNone: TypeAlias = Any # stable
# typeshed-internal type aliases to facilitate transition from
# `float` to either `float | int` or `float` (and similar for `complex`).
# When you encounter one of these type aliases, you are encouraged to
# replace them with the correct type. Please don't use them outside typeshed.
# See https://github.com/python/typeshed/issues/16059 for details.
FloatInt: TypeAlias = float | int
ComplexInt: TypeAlias = complex | float | int
# Used to mark arguments that default to a sentinel value. This prevents
# stubtest from complaining about the default value not matching.
#
+6 -2
View File
@@ -1,7 +1,8 @@
import sys
from _typeshed import ReadableBuffer
from collections.abc import Sequence
from typing import Any, Final, Literal, NoReturn, final, overload
from typing import Any, Final, Literal, final, overload
from typing_extensions import Never
if sys.platform == "win32":
ABOVE_NORMAL_PRIORITY_CLASS: Final = 0x8000
@@ -238,7 +239,7 @@ if sys.platform == "win32":
options: int = 0,
/,
) -> int: ...
def ExitProcess(ExitCode: int, /) -> NoReturn: ...
def ExitProcess(ExitCode: int, /) -> Never: ...
def GetACP() -> int: ...
if sys.version_info >= (3, 15):
def DeregisterEventSource(handle: int, /) -> None: ...
@@ -312,3 +313,6 @@ if sys.platform == "win32":
if sys.version_info >= (3, 12):
def CopyFile2(existing_file_name: str, new_file_name: str, flags: int, progress_routine: int | None = None) -> int: ...
def NeedCurrentDirectoryForExePath(exe_name: str, /) -> bool: ...
if sys.version_info >= (3, 15):
def GetTickCount64() -> int: ...
+8 -8
View File
@@ -2,8 +2,8 @@ import sys
from _typeshed import SupportsWrite, sentinel
from collections.abc import Callable, Generator, Iterable, Sequence
from re import Pattern
from typing import IO, Any, ClassVar, Final, Generic, NoReturn, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import Self, deprecated
from typing import IO, Any, ClassVar, Final, Generic, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import Never, Self, deprecated
__all__ = [
"ArgumentParser",
@@ -103,7 +103,7 @@ class _ActionsContainer:
conflict_handler: str = ...,
) -> _ArgumentGroup: ...
@overload
@deprecated("The `prefix_chars` parameter deprecated since Python 3.14.")
@deprecated("The `prefix_chars` parameter is deprecated.")
def add_argument_group(
self,
title: str | None = None,
@@ -123,7 +123,7 @@ class _ActionsContainer:
def _pop_action_class(self, kwargs: Any, default: type[Action] | None = None) -> type[Action]: ...
def _get_handler(self) -> Callable[[Action, Iterable[tuple[str, Action]]], Any]: ...
def _check_conflict(self, action: Action) -> None: ...
def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> NoReturn: ...
def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> Never: ...
def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> None: ...
@type_check_only
@@ -264,8 +264,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def parse_known_args(self, *, namespace: _N) -> tuple[_N, list[str]]: ...
def convert_arg_line_to_args(self, arg_line: str) -> list[str]: ...
def exit(self, status: int = 0, message: str | None = None) -> NoReturn: ...
def error(self, message: str) -> NoReturn: ...
def exit(self, status: int = 0, message: str | None = None) -> Never: ...
def error(self, message: str) -> Never: ...
@overload
def parse_intermixed_args(self, args: Iterable[str] | None = None, namespace: None = None) -> Namespace: ...
@@ -530,7 +530,7 @@ class Namespace(_AttributeHolder):
def __eq__(self, other: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
@deprecated("Deprecated since Python 3.14. Open files after parsing arguments instead.")
@deprecated("Deprecated; may leave files open. Open files after parsing arguments instead.")
class FileType:
# undocumented
_mode: str
@@ -556,7 +556,7 @@ class _ArgumentGroup(_ActionsContainer):
conflict_handler: str = ...,
) -> None: ...
@overload
@deprecated("Undocumented `prefix_chars` parameter is deprecated since Python 3.14.")
@deprecated("Undocumented `prefix_chars` parameter is deprecated.")
def __init__(
self,
container: _ActionsContainer,
@@ -21,16 +21,16 @@ def iscoroutine(obj: object) -> TypeIs[Coroutine[Any, Any, Any]]: ...
if sys.version_info >= (3, 11):
@overload
@deprecated("Deprecated since Python 3.14. Use `inspect.iscoroutinefunction()` instead.")
@deprecated("Deprecated; will be removed in Python 3.16. Use `inspect.iscoroutinefunction()` instead.")
def iscoroutinefunction(func: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ...
@overload
@deprecated("Deprecated since Python 3.14. Use `inspect.iscoroutinefunction()` instead.")
@deprecated("Deprecated; will be removed in Python 3.16. Use `inspect.iscoroutinefunction()` instead.")
def iscoroutinefunction(func: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, _T]]]: ...
@overload
@deprecated("Deprecated since Python 3.14. Use `inspect.iscoroutinefunction()` instead.")
@deprecated("Deprecated; will be removed in Python 3.16. Use `inspect.iscoroutinefunction()` instead.")
def iscoroutinefunction(func: Callable[_P, object]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, Any]]]: ...
@overload
@deprecated("Deprecated since Python 3.14. Use `inspect.iscoroutinefunction()` instead.")
@deprecated("Deprecated; will be removed in Python 3.16. Use `inspect.iscoroutinefunction()` instead.")
def iscoroutinefunction(func: object) -> TypeGuard[Callable[..., Coroutine[Any, Any, Any]]]: ...
else:
# Sometimes needed in Python < 3.11 due to the fact that it supports @coroutine
@@ -633,10 +633,10 @@ else:
def new_event_loop(self) -> AbstractEventLoop: ...
# Child processes handling (Unix only).
@abstractmethod
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
@deprecated("Deprecated; removed in Python 3.14.")
def get_child_watcher(self) -> AbstractChildWatcher: ...
@abstractmethod
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
@deprecated("Deprecated; removed in Python 3.14.")
def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ...
AbstractEventLoopPolicy = _AbstractEventLoopPolicy
@@ -657,15 +657,15 @@ if sys.version_info >= (3, 14):
def _get_event_loop_policy() -> _AbstractEventLoopPolicy: ...
def _set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ...
@deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.")
@deprecated("Deprecated; will be removed in Python 3.16.")
def get_event_loop_policy() -> _AbstractEventLoopPolicy: ...
@deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.")
@deprecated("Deprecated; will be removed in Python 3.16.")
def set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ...
def set_event_loop(loop: AbstractEventLoop | None) -> None: ...
def new_event_loop() -> AbstractEventLoop: ...
if sys.version_info < (3, 14):
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
@deprecated("Deprecated; removed in Python 3.14.")
def get_child_watcher() -> AbstractChildWatcher: ...
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
@deprecated("Deprecated; removed in Python 3.14.")
def set_child_watcher(watcher: AbstractChildWatcher) -> None: ...
@@ -4,8 +4,8 @@ from _typeshed import ReadableBuffer
from builtins import type as Type # alias to avoid name clashes with property named "type"
from collections.abc import Iterable
from types import TracebackType
from typing import Any, BinaryIO, NoReturn, TypeAlias, overload
from typing_extensions import deprecated
from typing import Any, BinaryIO, TypeAlias, overload
from typing_extensions import Never, deprecated
# These are based in socket, maybe move them out into _typeshed.pyi or such
_Address: TypeAlias = socket._Address
@@ -22,7 +22,7 @@ class TransportSocket:
def type(self) -> int: ...
@property
def proto(self) -> int: ...
def __getstate__(self) -> NoReturn: ...
def __getstate__(self) -> Never: ...
def fileno(self) -> int: ...
def dup(self) -> socket.socket: ...
def get_inheritable(self) -> bool: ...
@@ -40,7 +40,7 @@ class TransportSocket:
def getpeername(self) -> _RetAddress: ...
def getsockname(self) -> _RetAddress: ...
def getsockbyname(self) -> NoReturn: ... # This method doesn't exist on socket, yet is passed through?
def getsockbyname(self) -> Never: ... # This method doesn't exist on socket, yet is passed through?
def settimeout(self, value: float | None) -> None: ...
def gettimeout(self) -> float | None: ...
def setblocking(self, flag: bool) -> None: ...
@@ -60,7 +60,7 @@ class TransportSocket:
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> None: ...
else:
@deprecated("Removed in Python 3.11")
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> NoReturn: ...
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> Never: ...
@deprecated("Removed in Python 3.11")
def listen(self, backlog: int = ..., /) -> None: ...
@@ -82,7 +82,7 @@ class TransportSocket:
@deprecated("Removed in Python 3.11.")
def sendmsg_afalg(
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = 0
) -> NoReturn: ...
) -> Never: ...
@deprecated("Removed in Python 3.11.")
def sendmsg(
@@ -113,7 +113,7 @@ class TransportSocket:
def share(self, process_id: int) -> bytes: ...
else:
@deprecated("Removed in Python 3.11.")
def share(self, process_id: int) -> NoReturn: ...
def share(self, process_id: int) -> Never: ...
@deprecated("Removed in Python 3.11.")
def recv_into(self, buffer: _WriteBuffer, nbytes: int = 0, flags: int = 0) -> int: ...
@@ -2,7 +2,8 @@ import socket
import sys
from _typeshed import Incomplete, ReadableBuffer, WriteableBuffer
from collections.abc import Callable
from typing import IO, Any, ClassVar, Final, NoReturn
from typing import IO, Any, ClassVar, Final
from typing_extensions import Never
from . import events, futures, proactor_events, selector_events, streams, windows_utils
@@ -105,13 +106,13 @@ if sys.platform == "win32":
else:
class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
_loop_factory: ClassVar[type[SelectorEventLoop]]
def get_child_watcher(self) -> NoReturn: ...
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
def get_child_watcher(self) -> Never: ...
def set_child_watcher(self, watcher: Any) -> Never: ...
class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
_loop_factory: ClassVar[type[ProactorEventLoop]]
def get_child_watcher(self) -> NoReturn: ...
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
def get_child_watcher(self) -> Never: ...
def set_child_watcher(self, watcher: Any) -> Never: ...
if sys.version_info >= (3, 14):
_DefaultEventLoopPolicy = _WindowsProactorEventLoopPolicy
+19 -7
View File
@@ -30,7 +30,7 @@ from _typeshed import (
SupportsRichComparisonT,
SupportsWrite,
)
from collections.abc import Awaitable, Callable, Iterable, Iterator, MutableSet, Reversible, Set as AbstractSet, Sized
from collections.abc import Awaitable, Callable, Iterable, Iterator, MutableSet, Set as AbstractSet, Sized
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
from os import PathLike
from types import CellType, CodeType, EllipsisType, GenericAlias, NotImplementedType, TracebackType, UnionType
@@ -281,6 +281,7 @@ class int:
*,
signed: bool = False,
) -> Self: ...
else:
def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = False) -> bytes: ...
@classmethod
@@ -344,6 +345,7 @@ class int:
def __floor__(self) -> int: ...
if sys.version_info >= (3, 14):
def __round__(self, ndigits: SupportsIndex | None = None, /) -> int: ...
else:
def __round__(self, ndigits: SupportsIndex = ..., /) -> int: ...
@@ -770,6 +772,7 @@ class bytes(Sequence[int]):
def partition(self, sep: ReadableBuffer, /) -> tuple[bytes, bytes, bytes]: ...
if sys.version_info >= (3, 15):
def replace(self, old: ReadableBuffer, new: ReadableBuffer, /, count: SupportsIndex = -1) -> bytes: ...
else:
def replace(self, old: ReadableBuffer, new: ReadableBuffer, count: SupportsIndex = -1, /) -> bytes: ...
@@ -890,6 +893,7 @@ class bytearray(MutableSequence[int]):
def removesuffix(self, suffix: ReadableBuffer, /) -> bytearray: ...
if sys.version_info >= (3, 15):
def replace(self, old: ReadableBuffer, new: ReadableBuffer, /, count: SupportsIndex = -1) -> bytearray: ...
else:
def replace(self, old: ReadableBuffer, new: ReadableBuffer, count: SupportsIndex = -1, /) -> bytearray: ...
@@ -1042,6 +1046,7 @@ class memoryview(Sequence[_I]):
if sys.version_info >= (3, 14):
def index(self, value: object, start: SupportsIndex = 0, stop: SupportsIndex = sys.maxsize, /) -> int: ...
def count(self, value: object, /) -> int: ...
else:
# These are inherited from the Sequence ABC, but don't actually exist on memoryview.
# See https://github.com/python/cpython/issues/125420
@@ -1128,6 +1133,7 @@ class slice(Generic[_StartT_co, _StopT_co, _StepT_co]):
def __eq__(self, value: object, /) -> bool: ...
if sys.version_info >= (3, 12):
def __hash__(self) -> int: ...
else:
__hash__: ClassVar[None] # type: ignore[assignment]
@@ -1202,6 +1208,7 @@ class function:
closure: tuple[CellType, ...] | None = None,
kwdefaults: dict[str, object] | None = None,
) -> Self: ...
else:
def __new__(
cls,
@@ -1359,6 +1366,7 @@ class dict(MutableMapping[_KT, _VT]):
def __ror__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ...
@overload
def __ror__(self, value: frozendict[_T1, _T2], /) -> frozendict[_KT | _T1, _VT | _T2]: ...
else:
def __or__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ...
def __ror__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ...
@@ -2104,7 +2112,7 @@ _SupportsSomeKindOfPow = ( # noqa: Y026 # TODO: Use TypeAlias once mypy bugs a
)
# TODO: `pow(int, int, Literal[0])` fails at runtime,
# but adding a `NoReturn` overload isn't a good solution for expressing that (see #8566).
# but adding a `Never` overload isn't a good solution for expressing that (see #8566).
@overload
def pow(base: int, exp: int, mod: int) -> int: ...
@overload
@@ -2145,15 +2153,19 @@ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex
quit: _sitebuiltins.Quitter
@type_check_only
class _SupportsReversed(Protocol[_T_co]):
def __reversed__(self) -> _T_co: ...
@disjoint_base
class reversed(Generic[_T]):
class reversed(Generic[_T_co]):
@overload
def __new__(cls, sequence: Reversible[_T], /) -> Iterator[_T]: ... # type: ignore[misc]
def __new__(cls, sequence: _SupportsReversed[_T], /) -> _T: ... # type: ignore[misc]
@overload
def __new__(cls, sequence: SupportsLenAndGetItem[_T], /) -> Iterator[_T]: ... # type: ignore[misc]
def __new__(cls, sequence: SupportsLenAndGetItem[_T_co], /) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> _T: ...
def __next__(self) -> _T_co: ...
def __length_hint__(self) -> int: ...
def repr(obj: object, /) -> str: ...
@@ -2306,7 +2318,7 @@ class BaseException:
__suppress_context__: bool
__traceback__: TracebackType | None
def __init__(self, *args: object) -> None: ...
def __new__(cls, *args: Any, **kwds: Any) -> Self: ...
def __new__(cls, /, *args: Any, **kwds: Any) -> Self: ...
def __setstate__(self, state: dict[str, Any] | None, /) -> None: ...
def with_traceback(self, tb: TracebackType | None, /) -> Self: ...
# Necessary for security-focused static analyzers (e.g, pysa)
+1 -1
View File
@@ -193,7 +193,7 @@ def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ...
def getreader(encoding: str) -> _StreamReader: ...
def getwriter(encoding: str) -> _StreamWriter: ...
@deprecated("Deprecated since Python 3.14. Use `open()` instead.")
@deprecated("Deprecated. Use `open()` instead.")
def open(
filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = -1
) -> StreamReaderWriter: ...
@@ -14,8 +14,8 @@ from collections.abc import (
ValuesView,
)
from types import GenericAlias
from typing import Any, ClassVar, Generic, NoReturn, SupportsIndex, TypeVar, final, overload, type_check_only
from typing_extensions import Self, disjoint_base
from typing import Any, ClassVar, Generic, SupportsIndex, TypeVar, final, overload, type_check_only
from typing_extensions import Never, Self, disjoint_base
if sys.version_info >= (3, 15):
from builtins import frozendict
@@ -277,6 +277,7 @@ class deque(MutableSequence[_T]):
def __iadd__(self, value: Iterable[_T], /) -> Self: ...
def __add__(self, value: Self, /) -> Self: ...
def __mul__(self, value: int, /) -> Self: ...
def __rmul__(self, value: int, /) -> Self: ...
def __imul__(self, value: int, /) -> Self: ...
def __lt__(self, value: deque[_T], /) -> bool: ...
def __le__(self, value: deque[_T], /) -> bool: ...
@@ -299,7 +300,7 @@ class Counter(dict[_T, int], Generic[_T]):
def elements(self) -> Iterator[_T]: ...
def most_common(self, n: int | None = None) -> list[tuple[_T, int]]: ...
@classmethod
def fromkeys(cls, iterable: Any, v: int | None = None) -> NoReturn: ... # type: ignore[override]
def fromkeys(cls, iterable: Any, v: int | None = None) -> Never: ... # type: ignore[override]
@overload
def subtract(self, iterable: None = None, /) -> None: ...
@@ -146,7 +146,12 @@ class _ExecutorManagerThread(Thread):
def wait_result_broken_or_wakeup(self) -> tuple[Any, bool, str]: ...
def process_result_item(self, result_item: int | _ResultItem) -> None: ...
def is_shutting_down(self) -> bool: ...
def terminate_broken(self, cause: str) -> None: ...
if sys.version_info >= (3, 15):
def terminate_broken(self, cause: str, bpe_message: str | None = None) -> None: ...
else:
def terminate_broken(self, cause: str) -> None: ...
def flag_executor_shutting_down(self) -> None: ...
def shutdown_workers(self) -> None: ...
def join_executor_internals(self) -> None: ...
@@ -168,10 +168,10 @@ c_buffer = create_string_buffer
def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_wchar]: ...
if sys.version_info < (3, 15):
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
@deprecated("Deprecated; will be removed in Python 3.15.")
def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ...
@deprecated("Soft deprecated since Python 3.13. Use multiplication instead.")
@deprecated("Soft deprecated. Use multiplication instead.")
def ARRAY(typ: _CT, len: int) -> Array[_CT]: ...
if sys.platform == "win32":
+3 -3
View File
@@ -1,8 +1,8 @@
import sys
from abc import abstractmethod
from time import struct_time
from typing import ClassVar, Final, NoReturn, SupportsIndex, TypeAlias, final, overload, type_check_only
from typing_extensions import CapsuleType, Self, deprecated, disjoint_base
from typing import ClassVar, Final, SupportsIndex, TypeAlias, final, overload, type_check_only
from typing_extensions import CapsuleType, Never, Self, deprecated, disjoint_base
if sys.version_info >= (3, 11):
__all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR", "UTC")
@@ -114,7 +114,7 @@ class date:
def __radd__(self, value: timedelta, /) -> Self: ...
@overload
def __sub__(self, value: datetime, /) -> NoReturn: ...
def __sub__(self, value: datetime, /) -> Never: ...
@overload
def __sub__(self, value: Self, /) -> timedelta: ...
@overload
+1 -1
View File
@@ -184,7 +184,7 @@ class Context:
# even settable attributes like `prec` and `rounding`,
# but that's inexpressible in the stub.
# Type checkers either ignore it or misinterpret it
# if you add a `def __delattr__(self, name: str, /) -> NoReturn` method to the stub
# if you add a `def __delattr__(self, name: str, /) -> Never` method to the stub
prec: int
rounding: str
Emin: int
@@ -128,7 +128,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def executable(path: StrPath) -> bool: ... # undocumented
if sys.version_info < (3, 15):
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
@deprecated("Deprecated and unsafe; will be removed in Python 3.15.")
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
cgi_directories: list[str]
have_fork: bool # undocumented
+17 -3
View File
@@ -84,11 +84,20 @@ class IMAP4:
if sys.version_info >= (3, 14):
def idle(self, duration: float | None = None) -> Idler: ...
def list(self, directory: str = '""', pattern: str = "*") -> tuple[str, _AnyResponseData]: ...
if sys.version_info >= (3, 15):
def list(self, directory: str = "", pattern: str = "*") -> tuple[str, _AnyResponseData]: ...
else:
def list(self, directory: str = '""', pattern: str = "*") -> tuple[str, _AnyResponseData]: ...
def login(self, user: str, password: str) -> tuple[Literal["OK"], _list[bytes]]: ...
def login_cram_md5(self, user: str, password: str) -> _CommandResults: ...
def logout(self) -> tuple[str, _AnyResponseData]: ...
def lsub(self, directory: str = '""', pattern: str = "*") -> _CommandResults: ...
if sys.version_info >= (3, 15):
def lsub(self, directory: str = "", pattern: str = "*") -> _CommandResults: ...
else:
def lsub(self, directory: str = '""', pattern: str = "*") -> _CommandResults: ...
def myrights(self, mailbox: str) -> _CommandResults: ...
def namespace(self) -> _CommandResults: ...
def noop(self) -> tuple[str, _list[bytes]]: ...
@@ -98,7 +107,12 @@ class IMAP4:
def search(self, charset: str | None, *criteria: str) -> _CommandResults: ...
def select(self, mailbox: str = "INBOX", readonly: bool = False) -> tuple[str, _list[bytes | None]]: ...
def setacl(self, mailbox: str, who: str, what: str) -> _CommandResults: ...
def setannotation(self, *args: str) -> _CommandResults: ...
if sys.version_info >= (3, 15):
def setannotation(self, mailbox: str | bytes, *args: str) -> _CommandResults: ...
else:
def setannotation(self, *args: str) -> _CommandResults: ...
def setquota(self, root: str, limits: str) -> _CommandResults: ...
def sort(self, sort_criteria: str, charset: str, *search_criteria: str) -> _CommandResults: ...
def starttls(self, ssl_context: Any | None = None) -> tuple[Literal["OK"], _list[None]]: ...
@@ -9,7 +9,7 @@ from _typeshed import StrPath
from collections.abc import Iterable, Iterator
from importlib._bootstrap_external import FileLoader
from io import BufferedReader
from typing import Literal, NoReturn, TypeVar
from typing import Literal, TypeVar
from typing_extensions import Never
from zipimport import zipimporter
@@ -43,8 +43,8 @@ class ZipReader(abc.TraversableResources):
class MultiplexedPath(abc.Traversable):
def __init__(self, *paths: abc.Traversable) -> None: ...
def iterdir(self) -> Iterator[abc.Traversable]: ...
def read_bytes(self) -> NoReturn: ...
def read_text(self, *args: Never, **kwargs: Never) -> NoReturn: ... # type: ignore[override]
def read_bytes(self) -> Never: ...
def read_text(self, *args: Never, **kwargs: Never) -> Never: ... # type: ignore[override]
def is_dir(self) -> Literal[True]: ...
def is_file(self) -> Literal[False]: ...
@@ -58,7 +58,7 @@ class MultiplexedPath(abc.Traversable):
if sys.version_info < (3, 12):
__truediv__ = joinpath
def open(self, *args: Never, **kwargs: Never) -> NoReturn: ... # type: ignore[override]
def open(self, *args: Never, **kwargs: Never) -> Never: ... # type: ignore[override]
@property
def name(self) -> str: ...
@@ -62,7 +62,7 @@ else:
def read_text(package: Package, resource: Resource, encoding: str = "utf-8", errors: str = "strict") -> str: ...
def path(package: Package, resource: Resource) -> AbstractContextManager[Path, Literal[False]]: ...
def is_resource(package: Package, name: str) -> bool: ...
@deprecated("Deprecated since Python 3.11. Use `files(anchor).iterdir()`.")
@deprecated("Deprecated; limited resource support. Use `files(anchor).iterdir()`.")
def contents(package: Package) -> Iterator[str]: ...
if sys.version_info >= (3, 11):
@@ -7,7 +7,7 @@ from typing import IO, Any, Literal, Protocol, overload, runtime_checkable
from typing_extensions import deprecated
if sys.version_info >= (3, 11):
@deprecated("Deprecated since Python 3.12. Use `importlib.resources.abc.TraversableResources` instead.")
@deprecated("Deprecated. Use `importlib.resources.abc.TraversableResources` instead.")
class ResourceReader(metaclass=ABCMeta):
@abstractmethod
def open_resource(self, resource: str) -> IO[bytes]: ...
@@ -3,7 +3,7 @@ import sys
from _typeshed import StrPath
from collections.abc import Iterator
from io import TextIOWrapper
from typing import IO, Any, BinaryIO, Literal, NoReturn, overload
from typing import IO, Any, BinaryIO, Literal, overload
from typing_extensions import Never
if sys.version_info >= (3, 11):
@@ -43,7 +43,7 @@ if sys.version_info >= (3, 11):
@overload
def open(self, mode: str) -> IO[Any]: ...
def joinpath(self, name: Never) -> NoReturn: ... # type: ignore[override]
def joinpath(self, name: Never) -> Never: ... # type: ignore[override]
class ResourceContainer(Traversable, metaclass=abc.ABCMeta):
reader: SimpleReader
@@ -51,7 +51,7 @@ if sys.version_info >= (3, 11):
def is_dir(self) -> Literal[True]: ...
def is_file(self) -> Literal[False]: ...
def iterdir(self) -> Iterator[ResourceHandle | ResourceContainer]: ...
def open(self, *args: Never, **kwargs: Never) -> NoReturn: ... # type: ignore[override]
def open(self, *args: Never, **kwargs: Never) -> Never: ... # type: ignore[override]
if sys.version_info < (3, 12):
def joinpath(self, *descendants: StrPath) -> Traversable: ...
@@ -1,6 +1,7 @@
from _typeshed import Incomplete, StrPath
from collections.abc import Iterable, Iterator
from typing import IO, ClassVar, NoReturn, overload
from typing import IO, ClassVar, overload
from typing_extensions import Never
from . import grammar
from .tokenize import _TokenInfo
@@ -31,9 +32,9 @@ class ParserGenerator:
def gettoken(self) -> None: ...
@overload
def raise_error(self, msg: object) -> NoReturn: ...
def raise_error(self, msg: object) -> Never: ...
@overload
def raise_error(self, msg: str, *args: object) -> NoReturn: ...
def raise_error(self, msg: str, *args: object) -> Never: ...
class NFAState:
arcs: list[tuple[str | None, NFAState]]
@@ -3,7 +3,8 @@ from collections.abc import Container, Generator, Iterable, Mapping
from logging import Logger, _ExcInfoType
from multiprocessing import JoinableQueue
from multiprocessing.synchronize import Lock
from typing import Any, ClassVar, Final, NoReturn, overload
from typing import Any, ClassVar, Final, overload
from typing_extensions import Never
from .btm_matcher import BottomMatcher
from .fixer_base import BaseFix
@@ -39,7 +40,7 @@ class RefactoringTool:
self, fixer_names: Iterable[str], options: Mapping[str, object] | None = None, explicit: Container[str] | None = None
) -> None: ...
def get_fixers(self) -> tuple[list[BaseFix], list[BaseFix]]: ...
def log_error(self, msg: str, *args: Iterable[str], **kwargs: _ExcInfoType) -> NoReturn: ...
def log_error(self, msg: str, *args: Iterable[str], **kwargs: _ExcInfoType) -> Never: ...
@overload
def log_message(self, msg: object) -> None: ...
+1 -1
View File
@@ -138,7 +138,7 @@ def getpreferredencoding(do_setlocale: bool = True) -> _str: ...
def normalize(localename: _str) -> _str: ...
if sys.version_info < (3, 13):
@deprecated("Deprecated since Python 3.11; removed in Python 3.13. Use `locale.setlocale(locale.LC_ALL, '')` instead.")
@deprecated("Deprecated; removed in Python 3.13. Use `locale.setlocale(locale.LC_ALL, '')` instead.")
def resetlocale(category: int = ...) -> None: ...
if sys.version_info < (3, 12):
+3 -3
View File
@@ -2,8 +2,8 @@ import os
import sys
from _typeshed import ReadableBuffer, Unused
from collections.abc import Iterator
from typing import Final, Literal, NoReturn, SupportsIndex, overload
from typing_extensions import Self, disjoint_base
from typing import Final, Literal, SupportsIndex, overload
from typing_extensions import Never, Self, disjoint_base
ACCESS_DEFAULT: Final = 0
ACCESS_READ: Final = 1
@@ -113,7 +113,7 @@ class mmap:
@overload
def __getitem__(self, key: slice[SupportsIndex | None], /) -> bytes: ...
def __delitem__(self, key: SupportsIndex | slice[SupportsIndex | None], /) -> NoReturn: ...
def __delitem__(self, key: SupportsIndex | slice[SupportsIndex | None], /) -> Never: ...
@overload
def __setitem__(self, key: SupportsIndex, value: int, /) -> None: ...
@@ -1,6 +1,6 @@
from typing_extensions import deprecated
@deprecated("The `nturl2path` module is deprecated since Python 3.14.")
@deprecated("Deprecated; use `urllib.request` file-URL helpers instead.")
def url2pathname(url: str) -> str: ...
@deprecated("The `nturl2path` module is deprecated since Python 3.14.")
@deprecated("Deprecated; use `urllib.request` file-URL helpers instead.")
def pathname2url(p: str) -> str: ...
+4 -4
View File
@@ -2,8 +2,8 @@ import builtins
from _typeshed import MaybeNone, SupportsWrite
from abc import abstractmethod
from collections.abc import Callable, Iterable, Mapping, Sequence
from typing import Any, ClassVar, Final, Literal, NoReturn, overload
from typing_extensions import Self
from typing import Any, ClassVar, Final, Literal, overload
from typing_extensions import Never, Self
__all__ = [
"Option",
@@ -291,8 +291,8 @@ class OptionParser(OptionContainer):
def check_values(self, values: Values, args: list[str]) -> tuple[Values, list[str]]: ...
def disable_interspersed_args(self) -> None: ...
def enable_interspersed_args(self) -> None: ...
def error(self, msg: str) -> NoReturn: ...
def exit(self, status: int = 0, msg: str | None = None) -> NoReturn: ...
def error(self, msg: str) -> Never: ...
def exit(self, status: int = 0, msg: str | None = None) -> Never: ...
def expand_prog_name(self, s: str) -> str: ...
def format_epilog(self, formatter: HelpFormatter) -> str: ...
def format_help(self, formatter: HelpFormatter | None = None) -> str: ...
+11 -14
View File
@@ -33,7 +33,6 @@ from typing import (
Final,
Generic,
Literal,
NoReturn,
Protocol,
TypeAlias,
TypeVar,
@@ -42,7 +41,7 @@ from typing import (
runtime_checkable,
type_check_only,
)
from typing_extensions import LiteralString, Self, Unpack, deprecated
from typing_extensions import LiteralString, Never, Self, Unpack, deprecated
from . import path as _path
@@ -1471,19 +1470,17 @@ if sys.platform != "win32":
follow_symlinks: bool = True,
) -> None: ...
def abort() -> NoReturn: ...
def abort() -> Never: ...
# These are defined as execl(file, *args) but the first *arg is mandatory.
def execl(file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]]]]) -> NoReturn: ...
def execlp(file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]]]]) -> NoReturn: ...
def execl(file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]]]]) -> Never: ...
def execlp(file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]]]]) -> Never: ...
# These are: execle(file, *args, env) but env is pulled from the last element of the args.
def execle(
file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]], _ExecEnv]]
) -> NoReturn: ...
def execle(file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]], _ExecEnv]]) -> Never: ...
def execlpe(
file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]], _ExecEnv]]
) -> NoReturn: ...
) -> Never: ...
# The docs say `args: tuple or list of strings`
# The implementation enforces tuple or list so we can't use Sequence.
@@ -1506,11 +1503,11 @@ _ExecVArgs: TypeAlias = (
# we limit to str | bytes.
_ExecEnv: TypeAlias = Mapping[bytes, bytes | str] | Mapping[str, bytes | str]
def execv(path: StrOrBytesPath, argv: _ExecVArgs, /) -> NoReturn: ...
def execve(path: FileDescriptorOrPath, argv: _ExecVArgs, env: _ExecEnv) -> NoReturn: ...
def execvp(file: StrOrBytesPath, args: _ExecVArgs) -> NoReturn: ...
def execvpe(file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> NoReturn: ...
def _exit(status: int) -> NoReturn: ...
def execv(path: StrOrBytesPath, argv: _ExecVArgs, /) -> Never: ...
def execve(path: FileDescriptorOrPath, argv: _ExecVArgs, env: _ExecEnv) -> Never: ...
def execvp(file: StrOrBytesPath, args: _ExecVArgs) -> Never: ...
def execvpe(file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> Never: ...
def _exit(status: int) -> Never: ...
def kill(pid: int, signal: int, /) -> None: ...
if sys.platform != "win32":
@@ -94,7 +94,7 @@ class PurePath(PathLike[str]):
def __rtruediv__(self, key: StrPath) -> Self: ...
def __bytes__(self) -> bytes: ...
def as_posix(self) -> str: ...
@deprecated("Deprecated since Python 3.14; will be removed in Python 3.19. Use `Path.as_uri()` instead.")
@deprecated("Deprecated; will be removed in Python 3.19. Use `Path.as_uri()` instead.")
def as_uri(self) -> str: ...
def is_absolute(self) -> bool: ...
if sys.version_info < (3, 15):
@@ -112,7 +112,7 @@ class PurePath(PathLike[str]):
@overload
def is_relative_to(self, other: StrPath, /) -> bool: ...
@overload
@deprecated("Passing additional arguments is deprecated since Python 3.12; removed in Python 3.14.")
@deprecated("Passing additional arguments is deprecated; removed in Python 3.14.")
def is_relative_to(self, other: StrPath, /, *_deprecated: StrPath) -> bool: ...
if sys.version_info >= (3, 12):
+2 -2
View File
@@ -39,9 +39,9 @@ if sys.version_info < (3, 12):
def __init__(self, fullname: str, file: IO[str], filename: StrOrBytesPath, etc: tuple[str, str, int]) -> None: ...
if sys.version_info < (3, 14):
@deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `importlib.util.find_spec()` instead.")
@deprecated("Deprecated; removed in Python 3.14. Use `importlib.util.find_spec()` instead.")
def find_loader(fullname: str) -> LoaderProtocol | None: ...
@deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `importlib.util.find_spec()` instead.")
@deprecated("Deprecated; removed in Python 3.14. Use `importlib.util.find_spec()` instead.")
def get_loader(module_or_name: str) -> LoaderProtocol | None: ...
def get_importer(path_item: StrOrBytesPath) -> PathEntryFinderProtocol | None: ...
+1 -1
View File
@@ -11,7 +11,7 @@ def mac_ver(
) -> tuple[str, tuple[str, str, str], str]: ...
if sys.version_info < (3, 15):
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
@deprecated("Deprecated; will be removed in Python 3.15.")
def java_ver(
release: str = "",
vendor: str = "",
+4 -4
View File
@@ -4,8 +4,8 @@ import sys
from _typeshed import StrOrBytesPath
from builtins import list as _list # conflicts with a method named "list"
from re import Pattern
from typing import Any, BinaryIO, Final, NoReturn, TypeAlias, overload
from typing_extensions import deprecated
from typing import Any, BinaryIO, Final, TypeAlias, overload
from typing_extensions import Never, deprecated
__all__ = ["POP3", "error_proto", "POP3_SSL"]
@@ -59,7 +59,7 @@ class POP3_SSL(POP3):
def __init__(
self, host: str, port: int = 995, *, timeout: float = ..., context: ssl.SSLContext | None = None
) -> None: ...
def stls(self, context: Any = None) -> NoReturn: ...
def stls(self, context: Any = None) -> Never: ...
else:
@overload
def __init__(
@@ -90,4 +90,4 @@ class POP3_SSL(POP3):
certfile: StrOrBytesPath | None
# "context" is actually the last argument,
# but that breaks LSP and it doesn't really matter because all the arguments are ignored
def stls(self, context: Any = None, keyfile: Any = None, certfile: Any = None) -> NoReturn: ...
def stls(self, context: Any = None, keyfile: Any = None, certfile: Any = None) -> Never: ...
+2 -2
View File
@@ -15,9 +15,9 @@ if sys.platform != "win32":
def openpty() -> tuple[int, int]: ...
if sys.version_info < (3, 14):
@deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `openpty()` instead.")
@deprecated("Deprecated; removed in Python 3.14. Use `openpty()` instead.")
def master_open() -> tuple[int, str]: ...
@deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `openpty()` instead.")
@deprecated("Deprecated; removed in Python 3.14. Use `openpty()` instead.")
def slave_open(tty_name: str) -> int: ...
def fork() -> tuple[int, int]: ...
+4 -4
View File
@@ -5,8 +5,8 @@ from builtins import list as _list # "list" conflicts with method name
from collections.abc import Callable, Container, Mapping, MutableMapping
from reprlib import Repr
from types import MethodType, ModuleType, TracebackType
from typing import IO, Any, AnyStr, Final, NoReturn, Protocol, TypeGuard, TypeVar, overload, type_check_only
from typing_extensions import deprecated
from typing import IO, Any, AnyStr, Final, Protocol, TypeGuard, TypeVar, overload, type_check_only
from typing_extensions import Never, deprecated
__all__ = ["help"]
@@ -32,7 +32,7 @@ def stripid(text: str) -> str: ...
def allmethods(cl: type) -> MutableMapping[str, MethodType]: ...
def visiblename(name: str, all: Container[str] | None = None, obj: object = None) -> bool: ...
def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]: ...
@deprecated("Deprecated since Python 3.13.")
@deprecated("Deprecated.")
def ispackage(path: StrPath) -> bool: ... # undocumented
def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ...
def synopsis(filename: str, cache: MutableMapping[str, tuple[int, str]] = {}) -> str | None: ...
@@ -60,7 +60,7 @@ class Doc:
STDLIB_DIR: str
def document(self, object: object, name: str | None = None, *args: Any) -> str: ...
def fail(self, object: object, name: str | None = None, *args: Any) -> NoReturn: ...
def fail(self, object: object, name: str | None = None, *args: Any) -> Never: ...
@abstractmethod
def docmodule(self, object: object, name: str | None = None, *args: Any) -> str: ...
@abstractmethod
+4 -4
View File
@@ -3,8 +3,8 @@ import sys
from _typeshed import SupportsLenAndGetItem
from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set as AbstractSet
from fractions import Fraction
from typing import Any, ClassVar, NoReturn, TypeVar, overload
from typing_extensions import deprecated
from typing import Any, ClassVar, TypeVar, overload
from typing_extensions import Never, deprecated
__all__ = [
"Random",
@@ -104,8 +104,8 @@ class Random(_random.Random):
# SystemRandom is not implemented for all OS's; good on Windows & Linux
class SystemRandom(Random):
def getrandbits(self, k: int) -> int: ... # k can be passed by keyword
def getstate(self, *args: Any, **kwds: Any) -> NoReturn: ...
def setstate(self, *args: Any, **kwds: Any) -> NoReturn: ...
def getstate(self, *args: Any, **kwds: Any) -> Never: ...
def setstate(self, *args: Any, **kwds: Any) -> Never: ...
_inst: Random
seed = _inst.seed
+3 -2
View File
@@ -169,7 +169,7 @@ class Pattern(Generic[AnyStr]):
@overload
def split(self, string: AnyStr, maxsplit: int = 0) -> list[AnyStr | MaybeNone]: ...
# return type depends on the number of groups in the pattern
# return type is either list[str/bytes] or list[tuple[str/bytes, ...]]
@overload
def findall(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> list[Any]: ...
@overload
@@ -302,6 +302,7 @@ def split(
pattern: bytes | Pattern[bytes], string: ReadableBuffer, maxsplit: int = 0, flags: _FlagsType = 0
) -> list[bytes | MaybeNone]: ...
# return type is either list[str/bytes] or list[tuple[str/bytes, ...]]
@overload
def findall(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -> list[Any]: ...
@overload
@@ -342,5 +343,5 @@ def escape(pattern: AnyStr) -> AnyStr: ...
def purge() -> None: ...
if sys.version_info < (3, 13):
@deprecated("Deprecated since Python 3.11; removed in Python 3.13. Use `re.compile()` instead.")
@deprecated("Deprecated; removed in Python 3.13. Use `re.compile()` instead.")
def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = 0) -> Pattern[AnyStr]: ... # undocumented
+3 -3
View File
@@ -3,8 +3,8 @@ import sys
from _typeshed import BytesPath, ExcInfo, FileDescriptorOrPath, MaybeNone, StrOrBytesPath, StrPath, SupportsRead, SupportsWrite
from collections.abc import Callable, Iterable, Sequence
from tarfile import _TarfileFilter
from typing import Any, AnyStr, NamedTuple, NoReturn, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import deprecated
from typing import Any, AnyStr, NamedTuple, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import Never, deprecated
__all__ = [
"copyfileobj",
@@ -191,7 +191,7 @@ else:
if sys.platform == "win32" and sys.version_info < (3, 12):
@overload
@deprecated("On Windows before Python 3.12, using a PathLike as `cmd` would always fail or return `None`.")
def which(cmd: os.PathLike[str], mode: int = 1, path: StrPath | None = None) -> NoReturn: ...
def which(cmd: os.PathLike[str], mode: int = 1, path: StrPath | None = None) -> Never: ...
@overload
def which(cmd: StrPath, mode: int = 1, path: StrPath | None = None) -> str | None: ...
+3 -3
View File
@@ -1,6 +1,6 @@
from _typeshed import Unused
from typing import IO, Any, Final, Literal, NamedTuple, NoReturn, TypeAlias, overload
from typing_extensions import Self
from typing import IO, Any, Final, Literal, NamedTuple, TypeAlias, overload
from typing_extensions import Never, Self
_File: TypeAlias = str | IO[bytes]
@@ -46,7 +46,7 @@ class Au_read:
def getcompname(self) -> str: ...
def getparams(self) -> _sunau_params: ...
def getmarkers(self) -> None: ...
def getmark(self, id: Any) -> NoReturn: ...
def getmark(self, id: Any) -> Never: ...
def setpos(self, pos: int) -> None: ...
def readframes(self, nframes: int) -> bytes | None: ...
+1 -1
View File
@@ -56,7 +56,7 @@ class Function(SymbolTable):
def get_nonlocals(self) -> tuple[str, ...]: ...
class Class(SymbolTable):
@deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.")
@deprecated("Deprecated; will be removed in Python 3.16.")
def get_methods(self) -> tuple[str, ...]: ...
class Symbol:
@@ -5,8 +5,8 @@ from builtins import object as _object
from collections.abc import AsyncGenerator, Callable, Sequence
from io import TextIOWrapper
from types import FrameType, ModuleType, SimpleNamespace, TracebackType
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeAlias, TypeVar, final, overload, type_check_only
from typing_extensions import LiteralString, deprecated
from typing import Any, Final, Literal, Protocol, TextIO, TypeAlias, TypeVar, final, overload, type_check_only
from typing_extensions import LiteralString, Never, deprecated
_T = TypeVar("_T")
_LazyImportMode: TypeAlias = Literal["normal", "all", "none"]
@@ -377,7 +377,7 @@ def exc_info() -> OptExcInfo: ...
if sys.version_info >= (3, 11):
def exception() -> BaseException | None: ...
def exit(status: _ExitCode = None, /) -> NoReturn: ...
def exit(status: _ExitCode = None, /) -> Never: ...
if sys.platform == "android": # noqa: Y008
def getandroidapilevel() -> int: ...
@@ -521,7 +521,7 @@ if sys.version_info >= (3, 12):
if sys.platform == "linux":
def activate_stack_trampoline(backend: str, /) -> None: ...
else:
def activate_stack_trampoline(backend: str, /) -> NoReturn: ...
def activate_stack_trampoline(backend: str, /) -> Never: ...
from . import _monitoring
+2 -2
View File
@@ -45,13 +45,13 @@ elif sys.version_info >= (3, 11):
@overload
def is_python_build() -> bool: ...
@overload
@deprecated("The `check_home` parameter is deprecated since Python 3.12; removed in Python 3.15.")
@deprecated("The `check_home` parameter is deprecated; removed in Python 3.15.")
def is_python_build(check_home: object = None) -> bool: ...
else:
@overload
def is_python_build() -> bool: ...
@overload
@deprecated("The `check_home` parameter is deprecated since Python 3.12; removed in Python 3.15.")
@deprecated("The `check_home` parameter is deprecated; removed in Python 3.15.")
def is_python_build(check_home: bool = False) -> bool: ...
def parse_config_h(fp: IO[Any], vars: dict[str, Any] | None = None) -> dict[str, Any]: ...
+2 -2
View File
@@ -812,10 +812,10 @@ class TarInfo:
def __init__(self, name: str = "") -> None: ...
@property
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.16.")
@deprecated("Deprecated; will be removed in Python 3.16.")
def tarfile(self) -> TarFile | None: ...
@tarfile.setter
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.16.")
@deprecated("Deprecated; will be removed in Python 3.16.")
def tarfile(self, tarfile: TarFile | None) -> None: ...
@classmethod
@@ -329,13 +329,13 @@ class Variable:
def trace_add(self, mode: Literal["array", "read", "write", "unset"], callback: Callable[[str, str, str], object]) -> str: ...
def trace_remove(self, mode: Literal["array", "read", "write", "unset"], cbname: str) -> None: ...
def trace_info(self) -> list[tuple[tuple[Literal["array", "read", "write", "unset"], ...], str]]: ...
@deprecated("Deprecated since Python 3.14. Use `trace_add()` instead.")
@deprecated("Deprecated; will be removed in Python 3.17. Use `trace_add()` instead.")
def trace(self, mode, callback) -> str: ...
@deprecated("Deprecated since Python 3.14. Use `trace_add()` instead.")
@deprecated("Deprecated; will be removed in Python 3.17. Use `trace_add()` instead.")
def trace_variable(self, mode, callback) -> str: ...
@deprecated("Deprecated since Python 3.14. Use `trace_remove()` instead.")
@deprecated("Deprecated; will be removed in Python 3.17. Use `trace_remove()` instead.")
def trace_vdelete(self, mode, cbname) -> None: ...
@deprecated("Deprecated since Python 3.14. Use `trace_info()` instead.")
@deprecated("Deprecated; will be removed in Python 3.17. Use `trace_info()` instead.")
def trace_vinfo(self) -> list[Incomplete]: ...
def __eq__(self, other: object) -> bool: ...
def __del__(self) -> None: ...
+1 -1
View File
@@ -423,7 +423,7 @@ def overload(func: _F) -> _F: ...
def no_type_check(arg: _F) -> _F: ...
if sys.version_info < (3, 15):
@deprecated("Deprecated since Python 3.13; removed in Python 3.15.")
@deprecated("Deprecated; removed in Python 3.15.")
def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ...
if sys.version_info >= (3, 15):
@@ -629,7 +629,7 @@ else:
def __module__(self) -> str | None: ... # type: ignore[override]
# Returns typing._GenericAlias, which isn't stubbed.
def __getitem__(self, parameters: Incomplete | tuple[Incomplete, ...]) -> AnnotationForm: ...
def __init_subclass__(cls, *args: Unused, **kwargs: Unused) -> NoReturn: ...
def __init_subclass__(cls, *args: Unused, **kwargs: Unused) -> Never: ...
def __or__(self, right: Any, /) -> _SpecialForm: ...
def __ror__(self, left: Any, /) -> _SpecialForm: ...
@@ -12,7 +12,6 @@ from typing import (
AnyStr,
Final,
Generic,
NoReturn,
ParamSpec,
Protocol,
SupportsAbs,
@@ -91,7 +90,7 @@ class TestCase:
def tearDownClass(cls) -> None: ...
def run(self, result: unittest.result.TestResult | None = None) -> unittest.result.TestResult | None: ...
def __call__(self, result: unittest.result.TestResult | None = ...) -> unittest.result.TestResult | None: ...
def skipTest(self, reason: Any) -> NoReturn: ...
def skipTest(self, reason: Any) -> Never: ...
def subTest(self, msg: Any = ..., **params: Any) -> AbstractContextManager[None]: ...
def debug(self) -> None: ...
if sys.version_info < (3, 11):
@@ -267,7 +266,7 @@ class TestCase:
# assertDictEqual accepts only true dict instances. We can't use that here, since that would make
# assertDictEqual incompatible with TypedDict.
def assertDictEqual(self, d1: Mapping[Any, object], d2: Mapping[Any, object], msg: Any = None) -> None: ...
def fail(self, msg: Any = None) -> NoReturn: ...
def fail(self, msg: Any = None) -> Never: ...
def countTestCases(self) -> int: ...
def defaultTestResult(self) -> unittest.result.TestResult: ...
def id(self) -> str: ...
@@ -35,21 +35,21 @@ class TestLoader:
defaultTestLoader: TestLoader
if sys.version_info < (3, 13):
@deprecated("Deprecated since Python 3.11; removed in Python 3.13.")
@deprecated("Deprecated; removed in Python 3.13.")
def getTestCaseNames(
testCaseClass: type[unittest.case.TestCase],
prefix: str,
sortUsing: _SortComparisonMethod = ...,
testNamePatterns: list[str] | None = None,
) -> Sequence[str]: ...
@deprecated("Deprecated since Python 3.11; removed in Python 3.13.")
@deprecated("Deprecated; removed in Python 3.13.")
def makeSuite(
testCaseClass: type[unittest.case.TestCase],
prefix: str = "test",
sortUsing: _SortComparisonMethod = ...,
suiteClass: _SuiteClass = ...,
) -> unittest.suite.TestSuite: ...
@deprecated("Deprecated since Python 3.11; removed in Python 3.13.")
@deprecated("Deprecated; removed in Python 3.13.")
def findTestCases(
module: ModuleType, prefix: str = "test", sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ...
) -> unittest.suite.TestSuite: ...
@@ -64,7 +64,7 @@ class TestProgram:
) -> None: ...
if sys.version_info < (3, 13):
@deprecated("Deprecated since Python 3.11; removed in Python 3.13.")
@deprecated("Deprecated; removed in Python 3.13.")
def usageExit(self, msg: Any = None) -> None: ...
def parseArgs(self, argv: list[str]) -> None: ...
@@ -6,8 +6,8 @@ from email.message import Message
from http.client import HTTPConnection, HTTPMessage, HTTPResponse
from http.cookiejar import CookieJar
from re import Pattern
from typing import IO, Any, ClassVar, Literal, NoReturn, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import deprecated
from typing import IO, Any, ClassVar, Literal, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import Never, deprecated
from urllib.error import HTTPError as HTTPError
from urllib.response import addclosehook, addinfourl
@@ -336,7 +336,7 @@ class CacheFTPHandler(FTPHandler):
def clear_cache(self) -> None: ... # undocumented
class UnknownHandler(BaseHandler):
def unknown_open(self, req: Request) -> NoReturn: ...
def unknown_open(self, req: Request) -> Never: ...
class HTTPErrorProcessor(BaseHandler):
def http_response(self, request: Request, response: HTTPResponse) -> _UrlopenRet: ...
+3 -3
View File
@@ -2,8 +2,8 @@ import builtins
import sys
from _typeshed import Unused
from enum import Enum
from typing import Final, NoReturn, TypeAlias
from typing_extensions import LiteralString
from typing import Final, TypeAlias
from typing_extensions import LiteralString, Never
_FieldsType: TypeAlias = tuple[int, int, int, int, int, int]
@@ -65,7 +65,7 @@ class UUID:
def __gt__(self, other: UUID) -> bool: ...
def __ge__(self, other: UUID) -> bool: ...
def __hash__(self) -> builtins.int: ...
def __setattr__(self, name: Unused, value: Unused) -> NoReturn: ...
def __setattr__(self, name: Unused, value: Unused) -> Never: ...
def getnode() -> int: ...
def uuid1(node: int | None = None, clock_seq: int | None = None) -> UUID: ...
+10 -10
View File
@@ -1,7 +1,7 @@
import sys
from _typeshed import ReadableBuffer, StrOrBytesPath, Unused
from typing import IO, Any, BinaryIO, Final, Literal, NamedTuple, NoReturn, TypeAlias, overload
from typing_extensions import Self, deprecated
from typing import IO, Any, BinaryIO, Final, Literal, NamedTuple, TypeAlias, overload
from typing_extensions import Never, Self, deprecated
__all__ = ["open", "Error", "Wave_read", "Wave_write"]
if sys.version_info >= (3, 15):
@@ -47,10 +47,10 @@ class Wave_read:
def getcompname(self) -> str: ...
def getparams(self) -> _wave_params: ...
if sys.version_info < (3, 15):
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
@deprecated("Deprecated; will be removed in Python 3.15.")
def getmarkers(self) -> None: ...
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
def getmark(self, id: Any) -> NoReturn: ...
@deprecated("Deprecated; will be removed in Python 3.15.")
def getmark(self, id: Any) -> Never: ...
def setpos(self, pos: int) -> None: ...
def readframes(self, nframes: int) -> bytes: ...
@@ -85,11 +85,11 @@ class Wave_write:
def getparams(self) -> _wave_params: ...
if sys.version_info < (3, 15):
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
def setmark(self, id: Any, pos: Any, name: Any) -> NoReturn: ...
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
def getmark(self, id: Any) -> NoReturn: ...
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
@deprecated("Deprecated; will be removed in Python 3.15.")
def setmark(self, id: Any, pos: Any, name: Any) -> Never: ...
@deprecated("Deprecated; will be removed in Python 3.15.")
def getmark(self, id: Any) -> Never: ...
@deprecated("Deprecated; will be removed in Python 3.15.")
def getmarkers(self) -> None: ...
def tell(self) -> int: ...
@@ -64,7 +64,7 @@ if sys.platform == "win32":
if sys.platform == "darwin":
if sys.version_info < (3, 13):
@deprecated("Deprecated since Python 3.11; removed in Python 3.13.")
@deprecated("Deprecated; removed in Python 3.13.")
class MacOSX(BaseBrowser):
def __init__(self, name: str) -> None: ...
def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ...
@@ -1,6 +1,7 @@
from _typeshed.wsgi import ErrorStream, InputStream, WSGIApplication
from collections.abc import Callable, Iterable, Iterator
from typing import Any, NoReturn, TypeAlias
from typing import Any, TypeAlias
from typing_extensions import Never
__all__ = ["validator"]
@@ -15,7 +16,7 @@ class InputWrapper:
def readline(self, size: int = ...) -> bytes: ...
def readlines(self, hint: int = ...) -> bytes: ...
def __iter__(self) -> Iterator[bytes]: ...
def close(self) -> NoReturn: ...
def close(self) -> Never: ...
class ErrorWrapper:
errors: ErrorStream
@@ -23,7 +24,7 @@ class ErrorWrapper:
def write(self, s: str) -> None: ...
def flush(self) -> None: ...
def writelines(self, seq: Iterable[str]) -> None: ...
def close(self) -> NoReturn: ...
def close(self) -> Never: ...
_WriterCallback: TypeAlias = Callable[[bytes], Any]
@@ -1,5 +1,6 @@
from _typeshed import ReadableBuffer, SupportsRead
from typing import Any, Final, NoReturn, TypeAlias
from typing import Any, Final, TypeAlias
from typing_extensions import Never
from xml.dom.minidom import Document, DocumentFragment, DOMImplementation, Element, Node, TypeInfo
from xml.dom.xmlbuilder import DOMBuilderFilter, Options
from xml.parsers.expat import XMLParserType
@@ -115,8 +116,8 @@ class InternalSubsetExtractor(ExpatBuilder):
def start_doctype_decl_handler( # type: ignore[override]
self, name: str, publicId: str | None, systemId: str | None, has_internal_subset: bool
) -> None: ...
def end_doctype_decl_handler(self) -> NoReturn: ...
def start_element_handler(self, name: str, attrs: list[str]) -> NoReturn: ...
def end_doctype_decl_handler(self) -> Never: ...
def start_element_handler(self, name: str, attrs: list[str]) -> Never: ...
def parse(file: str | SupportsRead[ReadableBuffer | str], namespaces: bool = True) -> Document: ...
def parseString(string: str | ReadableBuffer, namespaces: bool = True) -> Document: ...
@@ -3,8 +3,8 @@ from _collections_abc import dict_keys, dict_values
from _typeshed import Incomplete, ReadableBuffer, SupportsRead, SupportsWrite
from collections.abc import Iterable, Sequence
from types import TracebackType
from typing import Any, ClassVar, Generic, Literal, NoReturn, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import Self
from typing import Any, ClassVar, Generic, Literal, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import Never, Self
from xml.dom.minicompat import EmptyNodeList, NodeList
from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS
from xml.sax.xmlreader import XMLReader
@@ -367,14 +367,14 @@ class Childless:
def firstChild(self) -> None: ...
@property
def lastChild(self) -> None: ...
def appendChild(self, node: _NodesThatAreChildren | DocumentFragment) -> NoReturn: ...
def appendChild(self, node: _NodesThatAreChildren | DocumentFragment) -> Never: ...
def hasChildNodes(self) -> Literal[False]: ...
def insertBefore(
self, newChild: _NodesThatAreChildren | DocumentFragment, refChild: _NodesThatAreChildren | None
) -> NoReturn: ...
def removeChild(self, oldChild: _NodesThatAreChildren) -> NoReturn: ...
) -> Never: ...
def removeChild(self, oldChild: _NodesThatAreChildren) -> Never: ...
def normalize(self) -> None: ...
def replaceChild(self, newChild: _NodesThatAreChildren | DocumentFragment, oldChild: _NodesThatAreChildren) -> NoReturn: ...
def replaceChild(self, newChild: _NodesThatAreChildren | DocumentFragment, oldChild: _NodesThatAreChildren) -> Never: ...
class ProcessingInstruction(Childless, Node):
__slots__ = ("target", "data")
@@ -501,10 +501,10 @@ class ReadOnlySequentialNamedNodeMap(Generic[_N]):
def getNamedItemNS(self, namespaceURI: str | None, localName: str) -> _N | None: ...
def __getitem__(self, name_or_tuple: str | _NSName) -> _N | None: ...
def item(self, index: int) -> _N | None: ...
def removeNamedItem(self, name: str) -> NoReturn: ...
def removeNamedItemNS(self, namespaceURI: str | None, localName: str) -> NoReturn: ...
def setNamedItem(self, node: Node) -> NoReturn: ...
def setNamedItemNS(self, node: Node) -> NoReturn: ...
def removeNamedItem(self, name: str) -> Never: ...
def removeNamedItemNS(self, namespaceURI: str | None, localName: str) -> Never: ...
def setNamedItem(self, node: Node) -> Never: ...
def setNamedItemNS(self, node: Node) -> Never: ...
@property
def length(self) -> int: ...
@@ -568,10 +568,10 @@ class Entity(Identified, Node):
notationName: str | None
def __init__(self, name: str, publicId: str | None, systemId: str | None, notation: str | None) -> None: ...
def appendChild(self, newChild: _EntityChildren) -> NoReturn: ... # type: ignore[override]
def insertBefore(self, newChild: _EntityChildren, refChild: _EntityChildren | None) -> NoReturn: ... # type: ignore[override]
def removeChild(self, oldChild: _EntityChildren) -> NoReturn: ... # type: ignore[override]
def replaceChild(self, newChild: _EntityChildren, oldChild: _EntityChildren) -> NoReturn: ... # type: ignore[override]
def appendChild(self, newChild: _EntityChildren) -> Never: ... # type: ignore[override]
def insertBefore(self, newChild: _EntityChildren, refChild: _EntityChildren | None) -> Never: ... # type: ignore[override]
def removeChild(self, oldChild: _EntityChildren) -> Never: ... # type: ignore[override]
def replaceChild(self, newChild: _EntityChildren, oldChild: _EntityChildren) -> Never: ... # type: ignore[override]
class Notation(Identified, Childless, Node):
nodeType: ClassVar[Literal[12]]
@@ -1,8 +1,8 @@
import sys
from _typeshed import Incomplete, Unused
from collections.abc import MutableSequence, Sequence
from typing import Final, Literal, NoReturn, TypeAlias
from typing_extensions import Self
from typing import Final, Literal, TypeAlias
from typing_extensions import Never, Self
from xml.dom.minidom import Comment, Document, DOMImplementation, Element, ProcessingInstruction, Text
from xml.sax import _SupportsReadClose
from xml.sax.handler import ContentHandler
@@ -73,8 +73,8 @@ class PullDOM(ContentHandler):
class ErrorHandler:
def warning(self, exception: BaseException) -> None: ...
def error(self, exception: BaseException) -> NoReturn: ...
def fatalError(self, exception: BaseException) -> NoReturn: ...
def error(self, exception: BaseException) -> Never: ...
def fatalError(self, exception: BaseException) -> Never: ...
class DOMEventStream:
stream: _SupportsReadClose[bytes] | _SupportsReadClose[str]
@@ -1,5 +1,6 @@
from _typeshed import SupportsRead
from typing import Any, Final, Literal, NoReturn
from typing import Any, Final, Literal
from typing_extensions import Never
from xml.dom.minidom import Document, Node, _DOMErrorHandler
__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"]
@@ -41,7 +42,7 @@ class DOMBuilder:
def getFeature(self, name: str) -> Any: ...
def parseURI(self, uri: str) -> Document: ...
def parse(self, input: DOMInputSource) -> Document: ...
def parseWithContext(self, input: DOMInputSource, cnode: Node, action: Literal[1, 2, 3, 4]) -> NoReturn: ...
def parseWithContext(self, input: DOMInputSource, cnode: Node, action: Literal[1, 2, 3, 4]) -> Never: ...
class DOMEntityResolver:
__slots__ = ("_opener",)
@@ -68,14 +69,14 @@ class DOMBuilderFilter:
class DocumentLS:
async_: bool
def abort(self) -> NoReturn: ...
def load(self, uri: str) -> NoReturn: ...
def loadXML(self, source: str) -> NoReturn: ...
def abort(self) -> Never: ...
def load(self, uri: str) -> Never: ...
def loadXML(self, source: str) -> Never: ...
def saveXML(self, snode: Node | None) -> str: ...
class DOMImplementationLS:
MODE_SYNCHRONOUS: Final = 1
MODE_ASYNCHRONOUS: Final = 2
def createDOMBuilder(self, mode: Literal[1], schemaType: None) -> DOMBuilder: ...
def createDOMWriter(self) -> NoReturn: ...
def createDOMWriter(self) -> Never: ...
def createDOMInputSource(self) -> DOMInputSource: ...
@@ -1,11 +1,11 @@
from typing import NoReturn
from typing_extensions import Never
from xml.sax.xmlreader import Locator
class SAXException(Exception):
def __init__(self, msg: str, exception: Exception | None = None) -> None: ...
def getMessage(self) -> str: ...
def getException(self) -> Exception | None: ...
def __getitem__(self, ix: object) -> NoReturn: ...
def __getitem__(self, ix: object) -> Never: ...
class SAXParseException(SAXException):
def __init__(self, msg: str, exception: Exception | None, locator: Locator) -> None: ...
@@ -1,17 +1,18 @@
from typing import Final, NoReturn, Protocol, type_check_only
from typing import Final, Protocol, type_check_only
from typing_extensions import Never
from xml.sax import xmlreader
version: Final[str]
@type_check_only
class _ErrorHandlerProtocol(Protocol): # noqa: Y046 # Protocol is not used
def error(self, exception: BaseException) -> NoReturn: ...
def fatalError(self, exception: BaseException) -> NoReturn: ...
def error(self, exception: BaseException) -> Never: ...
def fatalError(self, exception: BaseException) -> Never: ...
def warning(self, exception: BaseException) -> None: ...
class ErrorHandler:
def error(self, exception: BaseException) -> NoReturn: ...
def fatalError(self, exception: BaseException) -> NoReturn: ...
def error(self, exception: BaseException) -> Never: ...
def fatalError(self, exception: BaseException) -> Never: ...
def warning(self, exception: BaseException) -> None: ...
@type_check_only
@@ -2,7 +2,8 @@ from _typeshed import SupportsWrite
from codecs import StreamReaderWriter, StreamWriter
from collections.abc import Mapping
from io import RawIOBase, TextIOBase
from typing import Literal, NoReturn
from typing import Literal
from typing_extensions import Never
from xml.sax import _Source, handler, xmlreader
def escape(data: str, entities: Mapping[str, str] = {}) -> str: ...
@@ -32,8 +33,8 @@ class XMLGenerator(handler.ContentHandler):
class XMLFilterBase(xmlreader.XMLReader):
def __init__(self, parent: xmlreader.XMLReader | None = None) -> None: ...
# ErrorHandler methods
def error(self, exception: BaseException) -> NoReturn: ...
def fatalError(self, exception: BaseException) -> NoReturn: ...
def error(self, exception: BaseException) -> Never: ...
def fatalError(self, exception: BaseException) -> Never: ...
def warning(self, exception: BaseException) -> None: ...
# ContentHandler methods
def setDocumentLocator(self, locator: xmlreader.Locator) -> None: ...
@@ -1,3 +1,3 @@
version = "1.6.11"
version = "1.7.2"
upstream-repository = "https://github.com/authlib/authlib"
dependencies = ["cryptography"]
@@ -0,0 +1 @@
def is_valid_language_tag(tag: object) -> bool: ...
@@ -1,5 +1,3 @@
class AuthlibDeprecationWarning(DeprecationWarning): ...
def deprecate(
message: str, version: str | None = None, link_uid: str | None = None, link_file: str | None = None, stacklevel: int = 3
) -> None: ...
def deprecate(message: str, version: str | None = None, stacklevel: int = 3) -> None: ...
@@ -1,3 +1,4 @@
from authlib.integrations.base_client.sync_openid import _LogoutData
from authlib.oidc.core.claims import UserInfo
__all__ = ["AsyncOpenIDMixin"]
@@ -6,3 +7,6 @@ class AsyncOpenIDMixin:
async def fetch_jwk_set(self, force: bool = False): ...
async def userinfo(self, **kwargs) -> UserInfo: ...
async def parse_id_token(self, token, nonce, claims_options=None, claims_cls=None, leeway: int = 120) -> UserInfo: ...
async def create_logout_url(
self, post_logout_redirect_uri=None, id_token_hint=None, state=None, *, client_id=None, logout_hint=None, ui_locales=None
) -> _LogoutData: ...
@@ -1,7 +1,17 @@
from _typeshed import Incomplete
from typing import TypedDict, type_check_only
from authlib.oidc.core.claims import UserInfo
@type_check_only
class _LogoutData(TypedDict):
url: str
state: Incomplete
class OpenIDMixin:
def fetch_jwk_set(self, force: bool = False): ...
def userinfo(self, **kwargs) -> UserInfo: ...
def parse_id_token(self, token, nonce, claims_options=None, claims_cls=None, leeway: int = 120) -> UserInfo | None: ...
def create_load_key(self): ...
def create_logout_url(
self, post_logout_redirect_uri=None, id_token_hint=None, state=None, *, client_id=None, logout_hint=None, ui_locales=None
) -> _LogoutData: ...
@@ -1,6 +1,11 @@
from _typeshed import Incomplete
from typing import TypeAlias
from ..base_client import BaseApp, OAuth1Mixin, OAuth2Mixin, OpenIDMixin
from ..requests_client import OAuth1Session, OAuth2Session
_HttpResponseRedirect: TypeAlias = Incomplete # actual type is django.http.response.HttpResponseRedirect
class DjangoAppMixin:
def save_authorize_data(self, request, **kwargs) -> None: ...
def authorize_redirect(self, request, redirect_uri=None, **kwargs): ...
@@ -11,4 +16,16 @@ class DjangoOAuth1App(DjangoAppMixin, OAuth1Mixin, BaseApp):
class DjangoOAuth2App(DjangoAppMixin, OAuth2Mixin, OpenIDMixin, BaseApp):
client_cls = OAuth2Session
def logout_redirect(
self,
request,
post_logout_redirect_uri=None,
id_token_hint=None,
*,
state=None,
client_id=None,
logout_hint=None,
ui_locales=None,
) -> _HttpResponseRedirect: ...
def validate_logout_response(self, request): ...
def authorize_access_token(self, request, **kwargs): ...
@@ -1,6 +1,11 @@
from _typeshed import Incomplete
from typing import TypeAlias
from ..base_client import BaseApp, OAuth1Mixin, OAuth2Mixin, OpenIDMixin
from ..requests_client import OAuth1Session, OAuth2Session
_Response: TypeAlias = Incomplete # actual type is werkzeug.wrappers.Response
class FlaskAppMixin:
@property
def token(self): ...
@@ -16,4 +21,8 @@ class FlaskOAuth1App(FlaskAppMixin, OAuth1Mixin, BaseApp):
class FlaskOAuth2App(FlaskAppMixin, OAuth2Mixin, OpenIDMixin, BaseApp):
client_cls = OAuth2Session
def logout_redirect(
self, post_logout_redirect_uri=None, id_token_hint=None, *, state=None, client_id=None, logout_hint=None, ui_locales=None
) -> _Response: ...
def validate_logout_response(self): ...
def authorize_access_token(self, **kwargs): ...
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from typing import NoReturn
from typing_extensions import Never
# Inherits from werkzeug.exceptions.HTTPException
class _HTTPException:
@@ -11,4 +11,4 @@ class _HTTPException:
def get_body(self, environ=None, scope=None): ...
def get_headers(self, environ=None, scope=None): ...
def raise_http_exception(status, body, headers) -> NoReturn: ...
def raise_http_exception(status, body, headers) -> Never: ...
@@ -1,12 +1,12 @@
from _typeshed import Incomplete
from collections.abc import Generator
from contextlib import contextmanager
from typing import NoReturn
from typing_extensions import Never
from authlib.oauth2 import ResourceProtector as _ResourceProtector
class ResourceProtector(_ResourceProtector):
def raise_error_response(self, error) -> NoReturn: ...
def raise_error_response(self, error) -> Never: ...
def acquire_token(self, scopes=None, **kwargs): ...
@contextmanager
def acquire(self, scopes=None) -> Generator[Incomplete]: ...
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from collections.abc import Generator
from typing import NoReturn, TypeAlias
from typing import TypeAlias
from typing_extensions import Never
from authlib.oauth1 import ClientAuth
from authlib.oauth1.client import OAuth1Client as _OAuth1Client
@@ -32,7 +33,7 @@ class AsyncOAuth1Client(_OAuth1Client):
) -> None: ...
async def fetch_access_token(self, url, verifier=None, **kwargs): ...
@staticmethod
def handle_error(error_type: str | None, error_description: str | None) -> NoReturn: ...
def handle_error(error_type: str | None, error_description: str | None) -> Never: ...
# Inherits from httpx.Client
class OAuth1Client(_OAuth1Client):
@@ -52,4 +53,4 @@ class OAuth1Client(_OAuth1Client):
**kwargs,
) -> None: ...
@staticmethod
def handle_error(error_type: str | None, error_description: str | None) -> NoReturn: ...
def handle_error(error_type: str | None, error_description: str | None) -> Never: ...
@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from collections.abc import Generator
from typing import NoReturn, TypeAlias
from typing import TypeAlias
from typing_extensions import Never
from authlib.oauth2.auth import ClientAuth, TokenAuth
from authlib.oauth2.client import OAuth2Client as _OAuth2Client
@@ -66,6 +67,6 @@ class OAuth2Client(_OAuth2Client):
**kwargs,
) -> None: ...
@staticmethod
def handle_error(error_type: str | None, error_description: str | None) -> NoReturn: ...
def handle_error(error_type: str | None, error_description: str | None) -> Never: ...
def request(self, method, url, withhold_token: bool = False, auth=..., **kwargs): ...
def stream(self, method, url, withhold_token: bool = False, auth=..., **kwargs): ...
@@ -1,4 +1,4 @@
from typing import NoReturn
from typing_extensions import Never
from authlib.oauth1 import ClientAuth
from authlib.oauth1.client import OAuth1Client
@@ -26,4 +26,4 @@ class OAuth1Session(OAuth1Client):
) -> None: ...
def rebuild_auth(self, prepared_request, response) -> None: ...
@staticmethod
def handle_error(error_type: str | None, error_description: str | None) -> NoReturn: ...
def handle_error(error_type: str | None, error_description: str | None) -> Never: ...
@@ -1,11 +1,16 @@
from _typeshed import Incomplete
from typing import TypeAlias
from ..base_client import BaseApp
from ..base_client.async_app import AsyncOAuth1Mixin, AsyncOAuth2Mixin
from ..base_client.async_openid import AsyncOpenIDMixin
from ..httpx_client import AsyncOAuth1Client, AsyncOAuth2Client
_RedirectResponse: TypeAlias = Incomplete # actual type is starlette.responses.RedirectResponse
class StarletteAppMixin:
async def save_authorize_data(self, request, **kwargs) -> None: ...
async def authorize_redirect(self, request, redirect_uri=None, **kwargs): ...
async def authorize_redirect(self, request, redirect_uri=None, **kwargs) -> _RedirectResponse: ...
class StarletteOAuth1App(StarletteAppMixin, AsyncOAuth1Mixin, BaseApp):
client_cls = AsyncOAuth1Client
@@ -13,4 +18,16 @@ class StarletteOAuth1App(StarletteAppMixin, AsyncOAuth1Mixin, BaseApp):
class StarletteOAuth2App(StarletteAppMixin, AsyncOAuth2Mixin, AsyncOpenIDMixin, BaseApp):
client_cls = AsyncOAuth2Client
async def logout_redirect(
self,
request,
post_logout_redirect_uri=None,
id_token_hint=None,
*,
state=None,
client_id=None,
logout_hint=None,
ui_locales=None,
) -> _RedirectResponse: ...
async def validate_logout_response(self, request): ...
async def authorize_access_token(self, request, **kwargs): ...
@@ -12,11 +12,11 @@ class BaseClaims(dict[str, Any]): # dict values are key-dependent
def get_registered_claims(self) -> dict[str, Incomplete]: ...
class JWTClaims(BaseClaims):
def validate(self, now=None, leeway: int = 0) -> None: ...
def validate(self, now: int | None = None, leeway: int = 0) -> None: ...
def validate_iss(self) -> None: ...
def validate_sub(self) -> None: ...
def validate_aud(self) -> None: ...
def validate_exp(self, now, leeway) -> None: ...
def validate_nbf(self, now, leeway) -> None: ...
def validate_iat(self, now, leeway) -> None: ...
def validate_exp(self, now: int, leeway: int) -> None: ...
def validate_nbf(self, now: int, leeway: int) -> None: ...
def validate_iat(self, now: int, leeway: int) -> None: ...
def validate_jti(self) -> None: ...
@@ -1,5 +1,6 @@
from _typeshed import Incomplete
from typing import Any, NoReturn
from typing import Any
from typing_extensions import Never
from authlib.oauth1 import ClientAuth
@@ -40,5 +41,5 @@ class OAuth1Client:
def parse_authorization_response(self, url: str) -> dict[str, str]: ...
def parse_response_token(self, status_code: int, text: str): ...
@staticmethod
def handle_error(error_type: str, error_description: str) -> NoReturn: ...
def handle_error(error_type: str, error_description: str) -> Never: ...
def __del__(self) -> None: ...
@@ -0,0 +1,31 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing import TypedDict
class ClaimsOption(TypedDict, total=False):
essential: bool
allow_blank: bool | None
value: str | int | bool
values: list[str | int | bool] | list[str] | list[int] | list[bool]
validate: Callable[[BaseClaims, Incomplete], bool]
class BaseClaims(dict[str, Incomplete]):
registry_cls: Incomplete
REGISTERED_CLAIMS: list[str]
header: dict[str, Incomplete]
options: dict[str, ClaimsOption]
params: dict[str, Incomplete]
def __init__(
self,
claims: dict[str, Incomplete],
header: dict[str, Incomplete],
options: dict[str, ClaimsOption] | None = None,
params: dict[str, Incomplete] | None = None,
) -> None: ...
def get_registered_claims(self) -> dict[str, Incomplete]: ...
def validate(self, now: int | Callable[[], int] | None = None, leeway: int = 0) -> None: ...
class JWTClaims(BaseClaims):
registry_cls: Incomplete
REGISTERED_CLAIMS: list[str]
def validate(self, now: int | Callable[[], int] | None = None, leeway: int = 0) -> None: ...
@@ -1,5 +1,6 @@
from .authenticate_client import ClientAuthentication as ClientAuthentication
from .authorization_server import AuthorizationServer as AuthorizationServer
from .endpoint import Endpoint, EndpointRequest
from .errors import (
AccessDeniedError as AccessDeniedError,
InsecureTransportError as InsecureTransportError,
@@ -69,6 +70,8 @@ __all__ = [
"AuthorizationServer",
"ResourceProtector",
"TokenValidator",
"Endpoint",
"EndpointRequest",
"TokenEndpoint",
"BaseGrant",
"AuthorizationEndpointMixin",
@@ -6,6 +6,7 @@ from authlib.oauth2 import JsonRequest, OAuth2Error, OAuth2Request
from authlib.oauth2.rfc6749 import BaseGrant, ClientMixin
from authlib.oauth2.rfc6750 import BearerTokenGenerator
from .endpoint import Endpoint, EndpointRequest
from .hooks import Hookable
_ServerResponse: TypeAlias = tuple[int, str, list[tuple[str, str]]]
@@ -37,10 +38,11 @@ class AuthorizationServer(Hookable):
def register_grant(
self, grant_cls: type[BaseGrant], extensions: Collection[Callable[[BaseGrant], None]] | None = None
) -> None: ...
def register_endpoint(self, endpoint) -> None: ...
def register_endpoint(self, endpoint: type[Endpoint] | Endpoint) -> None: ...
def get_authorization_grant(self, request: OAuth2Request) -> BaseGrant: ...
def get_consent_grant(self, request=None, end_user=None): ...
def get_token_grant(self, request: OAuth2Request) -> BaseGrant: ...
def validate_endpoint_request(self, name, request=None) -> EndpointRequest: ...
def create_endpoint_response(self, name, request=None): ...
@overload
@@ -0,0 +1,19 @@
from _typeshed import Incomplete
from dataclasses import dataclass
from .requests import OAuth2Request
@dataclass
class EndpointRequest:
request: OAuth2Request
client: Incomplete | None = None
class Endpoint:
ENDPOINT_NAME: str | None
server: Incomplete
def __init__(self, server=None) -> None: ...
def create_endpoint_request(self, request): ...
def validate_request(self, request: OAuth2Request) -> EndpointRequest: ...
def create_response(self, validated_request: EndpointRequest) -> tuple[int, Incomplete, list[Incomplete]] | None: ...
def create_endpoint_response(self, request: OAuth2Request) -> tuple[int, Incomplete, list[Incomplete]] | None: ...
def __call__(self, request: OAuth2Request) -> tuple[int, Incomplete, list[Incomplete]] | None: ...
@@ -70,9 +70,12 @@ class OAuth2Request(OAuth2Payload):
@property
@deprecated("'request.redirect_uri' is deprecated in favor of 'request.payload.redirect_uri'")
def redirect_uri(self) -> str: ...
@property
@deprecated("'request.scope' is deprecated in favor of 'request.payload.scope'")
def scope(self) -> str: ...
@scope.setter
def scope(self, value: str) -> None: ...
@property
@deprecated("'request.state' is deprecated in favor of 'request.payload.state'")
def state(self) -> str | None: ...
@@ -1,13 +1,11 @@
from _typeshed import Incomplete
class TokenEndpoint:
ENDPOINT_NAME: Incomplete
from .endpoint import Endpoint
class TokenEndpoint(Endpoint):
ENDPOINT_NAME: str | None
SUPPORTED_TOKEN_TYPES: Incomplete
CLIENT_AUTH_METHODS: Incomplete
server: Incomplete
def __init__(self, server) -> None: ...
def __call__(self, request): ...
def create_endpoint_request(self, request): ...
def authenticate_endpoint_client(self, request): ...
def authenticate_token(self, request, client): ...
def create_endpoint_response(self, request): ...
@@ -9,8 +9,16 @@ class InvalidTokenError(OAuth2Error):
description: str
status_code: int
realm: Incomplete
extra_attributes: Incomplete
def __init__(self, description=None, uri=None, status_code=None, state=None, realm=None, **extra_attributes) -> None: ...
extra_attributes: dict[str, Incomplete]
def __init__(
self,
description=None,
uri=None,
status_code=None,
state=None,
realm=None,
extra_attributes: dict[str, Incomplete] | None = None,
) -> None: ...
def get_headers(self) -> list[tuple[str, str]]: ...
class InsufficientScopeError(OAuth2Error):
@@ -1,5 +1,27 @@
def sign_jwt_bearer_assertion(
key, issuer, audience, subject=None, issued_at=None, expires_at=None, claims=None, header=None, **kwargs
) -> bytes: ...
def client_secret_jwt_sign(client_secret, client_id, token_endpoint, alg: str = "HS256", claims=None, **kwargs) -> bytes: ...
def private_key_jwt_sign(private_key, client_id, token_endpoint, alg: str = "RS256", claims=None, **kwargs) -> bytes: ...
key, issuer, audience, subject=None, issued_at=None, expires_at=None, claims=None, header=None, *, alg=None, expires_in=3600
) -> str: ...
def client_secret_jwt_sign(
client_secret,
client_id,
token_endpoint,
alg: str = "HS256",
claims=None,
*,
issued_at=None,
expires_at=None,
header=None,
expires_in=3600,
) -> str: ...
def private_key_jwt_sign(
private_key,
client_id,
token_endpoint,
alg: str = "RS256",
claims=None,
*,
issued_at=None,
expires_at=None,
header=None,
expires_in=3600,
) -> str: ...
@@ -7,10 +7,10 @@ class ClientSecretJWT:
claims: Incomplete
headers: Incomplete
def __init__(self, token_endpoint=None, claims=None, headers=None, alg=None) -> None: ...
def sign(self, auth, token_endpoint) -> bytes: ...
def sign(self, auth, token_endpoint) -> str: ...
def __call__(self, auth, method, uri, headers, body): ...
class PrivateKeyJWT(ClientSecretJWT):
name: str
alg: str
def sign(self, auth, token_endpoint) -> bytes: ...
def sign(self, auth, token_endpoint) -> str: ...
@@ -1,7 +1,7 @@
from _typeshed import Incomplete
from logging import Logger
from typing import Final
from authlib.jose.rfc7519.claims import JWTClaims
from typing import Final, overload
from typing_extensions import deprecated
ASSERTION_TYPE: Final[str]
log: Logger
@@ -9,13 +9,20 @@ log: Logger
class JWTBearerClientAssertion:
CLIENT_ASSERTION_TYPE: Final[str]
CLIENT_AUTH_METHOD: Final[str]
token_url: str
token_url: str | None
leeway: int
def __init__(self, token_url: str, validate_jti: bool = True, leeway: int = 60) -> None: ...
@overload
@deprecated("The `token_url` parameter is deprecated. Override `get_audiences` instead.")
def __init__(self, token_url: str = ..., validate_jti: bool = True, leeway: int = 60) -> None: ...
@overload
def __init__(self, token_url: None = None, validate_jti: bool = True, leeway: int = 60) -> None: ...
def __call__(self, query_client, request): ...
def create_claims_options(self): ...
def process_assertion_claims(self, assertion, resolve_key) -> JWTClaims: ...
def verify_claims(self, claims: dict[str, Incomplete]) -> None: ...
def get_audiences(self) -> list[str]: ...
def process_assertion_claims(self, assertion, resolve_key) -> dict[str, Incomplete]: ...
def authenticate_client(self, client): ...
def create_resolve_key_func(self, query_client, request): ...
def extract_assertion(self, assertion: str) -> tuple[dict[str, Incomplete], Incomplete]: ...
def validate_jti(self, claims, jti): ...
def resolve_client_public_key(self, client, headers): ...
def resolve_client_public_key(self, client): ...
@@ -1,7 +1,7 @@
from _typeshed import Incomplete
from logging import Logger
from typing import ClassVar, Final
from authlib.jose.rfc7519.claims import JWTClaims
from authlib.oauth2.rfc6749 import BaseGrant, TokenEndpointMixin
log: Logger
@@ -13,11 +13,13 @@ class JWTBearerGrant(BaseGrant, TokenEndpointMixin):
LEEWAY: ClassVar[int]
@staticmethod
def sign(key, issuer, audience, subject=None, issued_at=None, expires_at=None, claims=None, **kwargs): ...
def process_assertion_claims(self, assertion) -> JWTClaims: ...
def resolve_public_key(self, headers, payload): ...
def verify_claims(self, claims: dict[str, Incomplete]) -> None: ...
def process_assertion_claims(self, assertion) -> dict[str, Incomplete]: ...
def extract_assertion(self, assertion: str) -> tuple[dict[str, Incomplete], Incomplete]: ...
def validate_token_request(self) -> None: ...
def create_token_response(self): ...
def resolve_issuer_client(self, issuer): ...
def resolve_client_key(self, client, headers, payload): ...
def resolve_client_public_key(self, client): ...
def authenticate_user(self, subject): ...
def get_audiences(self) -> list[str]: ...
def has_granted_permission(self, client, user) -> bool: ...
@@ -1,17 +1,16 @@
from _typeshed import Incomplete
from authlib.jose import JWTClaims
from authlib.oauth2.rfc6749 import TokenMixin
from authlib.oauth2.rfc6750 import BearerTokenValidator
logger: Incomplete
class JWTBearerToken(TokenMixin, JWTClaims):
def check_client(self, client): ...
class JWTBearerToken(TokenMixin, dict[str, Incomplete]):
def check_client(self, client) -> bool: ...
def get_scope(self): ...
def get_expires_in(self): ...
def is_expired(self): ...
def is_revoked(self): ...
def is_expired(self) -> bool: ...
def is_revoked(self) -> bool: ...
class JWTBearerTokenValidator(BearerTokenValidator):
TOKEN_TYPE: str
@@ -19,4 +18,4 @@ class JWTBearerTokenValidator(BearerTokenValidator):
public_key: Incomplete
claims_options: Incomplete
def __init__(self, public_key, issuer=None, realm=None, **extra_attributes) -> None: ...
def authenticate_token(self, token_string): ...
def authenticate_token(self, token_string: str) -> JWTBearerToken | None: ...
@@ -1,11 +1,11 @@
from _typeshed import Incomplete
from collections.abc import Mapping
from collections.abc import Callable, Mapping
from typing import Any
from authlib.jose import BaseClaims
class ClientMetadataClaims(BaseClaims):
def validate(self) -> None: ...
def validate(self, now: int | Callable[[], int] | None = None, leeway: int = 0) -> None: ...
def validate_redirect_uris(self) -> None: ...
def validate_token_endpoint_auth_method(self) -> None: ...
def validate_grant_types(self) -> None: ...
@@ -1,20 +1,18 @@
from _typeshed import Incomplete
from typing import Final
from authlib.jose import JWTClaims
class ClientRegistrationEndpoint:
ENDPOINT_NAME: Final = "client_registration"
software_statement_alg_values_supported: Incomplete
server: Incomplete
claims_classes: list[type[Incomplete]]
def __init__(self, server=None, claims_classes: list[type[Incomplete]] | None = None) -> None: ...
def __call__(self, request) -> dict[Incomplete, Incomplete]: ...
def create_registration_response(self, request): ...
def extract_client_metadata(self, request): ...
def extract_software_statement(self, software_statement, request) -> JWTClaims: ...
def __call__(self, request) -> tuple[int, dict[Incomplete, Incomplete], list[tuple[str, str]]]: ...
def create_registration_response(self, request) -> tuple[int, dict[Incomplete, Incomplete], list[tuple[str, str]]]: ...
def extract_client_metadata(self, request) -> dict[Incomplete, Incomplete]: ...
def extract_software_statement(self, software_statement, request) -> dict[str, Incomplete]: ...
def generate_client_info(self, request) -> dict[str, Incomplete]: ...
def generate_client_registration_info(self, client, request) -> None: ...
def generate_client_registration_info(self, client, request) -> Incomplete | None: ...
def create_endpoint_request(self, request): ...
def generate_client_id(self, request) -> str: ...
def generate_client_secret(self, request) -> str: ...
@@ -1,7 +1,7 @@
from _typeshed import Incomplete
class AuthorizationServerMetadata(dict[str, object]):
REGISTRY_KEYS: Incomplete
REGISTRY_KEYS: list[str]
def validate_issuer(self) -> None: ...
def validate_authorization_endpoint(self) -> None: ...
def validate_token_endpoint(self) -> None: ...
@@ -34,7 +34,9 @@ class AuthorizationServerMetadata(dict[str, object]):
def revocation_endpoint_auth_methods_supported(self): ...
@property
def introspection_endpoint_auth_methods_supported(self): ...
def validate(self) -> None: ...
def validate(self, metadata_classes: list[type[Incomplete]] | None = None) -> None: ...
def __getattr__(self, key): ...
def validate_array_value(metadata, key) -> None: ...
def validate_language_tags_array(metadata, key) -> None: ...
def validate_boolean_value(metadata, key) -> None: ...
@@ -1,13 +1,12 @@
from collections.abc import Callable
from authlib.jose import JWTClaims
# Inherits from joserfc.jwt.JWTClaimsRegistry
class JWTAccessTokenClaimsValidator:
def validate_auth_time(self, auth_time) -> None: ...
def validate_amr(self, amr) -> None: ...
class JWTAccessTokenClaims(JWTClaims):
def validate(self, *, now=None, leeway: int = 0) -> None: ... # type: ignore[override]
def validate_typ(self) -> None: ...
def validate_client_id(self): ...
def validate_auth_time(self) -> None: ...
def validate_acr(self): ...
def validate_amr(self) -> None: ...
def validate_scope(self): ...
def validate_groups(self): ...
def validate_roles(self): ...
def validate_entitlements(self): ...
registry_cls = JWTAccessTokenClaimsValidator
def validate(self, *, now: int | Callable[[], int] | None = None, leeway: int = 0) -> None: ... # type: ignore[override]
@@ -1,13 +1,14 @@
from _typeshed import Incomplete
from authlib.oauth2.rfc7662 import IntrospectionEndpoint
from ..rfc7662 import IntrospectionEndpoint
from .claims import JWTAccessTokenClaims
class JWTIntrospectionEndpoint(IntrospectionEndpoint):
ENDPOINT_NAME: str
issuer: Incomplete
def __init__(self, issuer, server=None, *args, **kwargs) -> None: ...
def create_endpoint_response(self, request): ...
def authenticate_token(self, request, client): ...
def create_introspection_payload(self, token): ...
def authenticate_token(self, request, client) -> JWTAccessTokenClaims | None: ...
def create_introspection_payload(self, token: JWTAccessTokenClaims) -> dict[str, Incomplete]: ...
def get_jwks(self): ...
def get_username(self, user_id: str) -> str: ...
@@ -1,10 +1,10 @@
from _typeshed import Incomplete
from typing import NoReturn
from typing_extensions import Never
from authlib.oauth2.rfc7009 import RevocationEndpoint
class JWTRevocationEndpoint(RevocationEndpoint):
issuer: Incomplete
def __init__(self, issuer, server=None, *args, **kwargs) -> None: ...
def authenticate_token(self, request, client) -> NoReturn: ...
def authenticate_token(self, request, client) -> Never: ...
def get_jwks(self): ...

Some files were not shown because too many files have changed in this diff Show More