mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-02 14:10:23 +08:00
Use lowercase type everywhere (#6853)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from _typeshed import WriteableBuffer
|
||||
from io import BufferedIOBase, RawIOBase
|
||||
from typing import Any, Callable, Protocol, Type
|
||||
from typing import Any, Callable, Protocol
|
||||
|
||||
BUFFER_SIZE: Any
|
||||
|
||||
@@ -16,7 +16,7 @@ class DecompressReader(RawIOBase):
|
||||
self,
|
||||
fp: _Reader,
|
||||
decomp_factory: Callable[..., object],
|
||||
trailing_error: Type[Exception] | tuple[Type[Exception], ...] = ...,
|
||||
trailing_error: type[Exception] | tuple[type[Exception], ...] = ...,
|
||||
**decomp_args: Any,
|
||||
) -> None: ...
|
||||
def readable(self) -> bool: ...
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Iterable, Iterator, Protocol, Type, Union
|
||||
from typing import Any, Iterable, Iterator, Protocol, Union
|
||||
from typing_extensions import Literal
|
||||
|
||||
QUOTE_ALL: Literal[1]
|
||||
@@ -19,7 +19,7 @@ class Dialect:
|
||||
strict: int
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
_DialectLike = Union[str, Dialect, Type[Dialect]]
|
||||
_DialectLike = Union[str, Dialect, type[Dialect]]
|
||||
|
||||
class _reader(Iterator[list[str]]):
|
||||
dialect: Dialect
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from types import FrameType, TracebackType
|
||||
from typing import Any, Callable, Iterable, Mapping, Optional, Type, TypeVar
|
||||
from typing import Any, Callable, Iterable, Mapping, Optional, TypeVar
|
||||
|
||||
# TODO recursive type
|
||||
_TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
|
||||
@@ -67,7 +67,7 @@ class Lock:
|
||||
def __init__(self) -> None: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
@@ -77,7 +77,7 @@ class _RLock:
|
||||
def __init__(self) -> None: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
@@ -88,7 +88,7 @@ class Condition:
|
||||
def __init__(self, lock: Lock | _RLock | None = ...) -> None: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
@@ -101,7 +101,7 @@ class Condition:
|
||||
class Semaphore:
|
||||
def __init__(self, value: int = ...) -> None: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
def acquire(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ...
|
||||
def __enter__(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ...
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Type, TypeVar
|
||||
from typing import Any, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -6,5 +6,5 @@ _T = TypeVar("_T")
|
||||
def get_cache_token() -> object: ...
|
||||
|
||||
class ABCMeta(type):
|
||||
def __new__(__mcls, __name: str, __bases: tuple[Type[Any], ...], __namespace: dict[str, Any]) -> ABCMeta: ...
|
||||
def register(cls, subclass: Type[_T]) -> Type[_T]: ...
|
||||
def __new__(__mcls, __name: str, __bases: tuple[type[Any], ...], __namespace: dict[str, Any]) -> ABCMeta: ...
|
||||
def register(cls, subclass: type[_T]) -> type[_T]: ...
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@ import sys
|
||||
from _typeshed import structseq
|
||||
from threading import Thread
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, NoReturn, Optional, Type
|
||||
from typing import Any, Callable, NoReturn, Optional
|
||||
from typing_extensions import final
|
||||
|
||||
error = RuntimeError
|
||||
@@ -18,7 +18,7 @@ class LockType:
|
||||
def locked(self) -> bool: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
def start_new_thread(function: Callable[..., Any], args: tuple[Any, ...], kwargs: dict[str, Any] = ...) -> int: ...
|
||||
@@ -34,10 +34,10 @@ if sys.version_info >= (3, 8):
|
||||
def get_native_id() -> int: ... # only available on some platforms
|
||||
@final
|
||||
class _ExceptHookArgs(
|
||||
structseq[Any], tuple[Type[BaseException], Optional[BaseException], Optional[TracebackType], Optional[Thread]]
|
||||
structseq[Any], tuple[type[BaseException], Optional[BaseException], Optional[TracebackType], Optional[Thread]]
|
||||
):
|
||||
@property
|
||||
def exc_type(self) -> Type[BaseException]: ...
|
||||
def exc_type(self) -> type[BaseException]: ...
|
||||
@property
|
||||
def exc_value(self) -> BaseException | None: ...
|
||||
@property
|
||||
|
||||
@@ -7,7 +7,7 @@ import ctypes
|
||||
import mmap
|
||||
import sys
|
||||
from os import PathLike
|
||||
from typing import AbstractSet, Any, Awaitable, Container, Generic, Iterable, Protocol, Type, TypeVar, Union
|
||||
from typing import AbstractSet, Any, Awaitable, Container, Generic, Iterable, Protocol, TypeVar, Union
|
||||
from typing_extensions import Final, Literal, final
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
@@ -215,4 +215,4 @@ class structseq(Generic[_T_co]):
|
||||
# The second parameter will accept a dict of any kind without raising an exception,
|
||||
# but only has any meaning if you supply it a dict where the keys are strings.
|
||||
# https://github.com/python/typeshed/pull/6560#discussion_r767149830
|
||||
def __new__(cls: Type[_T], sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> _T: ...
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
from typing import Any, Type, overload
|
||||
from typing import Any, overload
|
||||
|
||||
_defaultaction: str
|
||||
_onceregistry: dict[Any, Any]
|
||||
filters: list[tuple[str, str | None, Type[Warning], str | None, int]]
|
||||
filters: list[tuple[str, str | None, type[Warning], str | None, int]]
|
||||
|
||||
@overload
|
||||
def warn(message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ...
|
||||
def warn(message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ...
|
||||
@overload
|
||||
def warn(message: Warning, category: Any = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ...
|
||||
@overload
|
||||
def warn_explicit(
|
||||
message: str,
|
||||
category: Type[Warning],
|
||||
category: type[Warning],
|
||||
filename: str,
|
||||
lineno: int,
|
||||
module: str | None = ...,
|
||||
registry: dict[str | tuple[str, Type[Warning], int], int] | None = ...,
|
||||
registry: dict[str | tuple[str, type[Warning], int], int] | None = ...,
|
||||
module_globals: dict[str, Any] | None = ...,
|
||||
source: Any | None = ...,
|
||||
) -> None: ...
|
||||
@@ -26,7 +26,7 @@ def warn_explicit(
|
||||
filename: str,
|
||||
lineno: int,
|
||||
module: str | None = ...,
|
||||
registry: dict[str | tuple[str, Type[Warning], int], int] | None = ...,
|
||||
registry: dict[str | tuple[str, type[Warning], int], int] | None = ...,
|
||||
module_globals: dict[str, Any] | None = ...,
|
||||
source: Any | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from _typeshed import SupportsWrite
|
||||
from typing import Any, Callable, Type, TypeVar
|
||||
from typing import Any, Callable, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
|
||||
@@ -12,7 +12,7 @@ class ABCMeta(type):
|
||||
def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ...
|
||||
def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ...
|
||||
def _dump_registry(cls: ABCMeta, file: SupportsWrite[str] | None = ...) -> None: ...
|
||||
def register(cls: ABCMeta, subclass: Type[_T]) -> Type[_T]: ...
|
||||
def register(cls: ABCMeta, subclass: type[_T]) -> type[_T]: ...
|
||||
|
||||
def abstractmethod(funcobj: _FuncT) -> _FuncT: ...
|
||||
|
||||
@@ -27,4 +27,4 @@ class ABC(metaclass=ABCMeta): ...
|
||||
def get_cache_token() -> object: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def update_abstractmethods(cls: Type[_T]) -> Type[_T]: ...
|
||||
def update_abstractmethods(cls: type[_T]) -> type[_T]: ...
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, NamedTuple, Type, Union, overload
|
||||
from typing import IO, Any, NamedTuple, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
class Error(Exception): ...
|
||||
@@ -21,7 +21,7 @@ class Aifc_read:
|
||||
def __init__(self, f: _File) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def initfp(self, file: IO[bytes]) -> None: ...
|
||||
def getfp(self) -> IO[bytes]: ...
|
||||
@@ -45,7 +45,7 @@ class Aifc_write:
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def initfp(self, file: IO[bytes]) -> None: ...
|
||||
def aiff(self) -> None: ...
|
||||
|
||||
+14
-14
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import IO, Any, Callable, Generator, Generic, Iterable, NoReturn, Pattern, Protocol, Sequence, Type, TypeVar, overload
|
||||
from typing import IO, Any, Callable, Generator, Generic, Iterable, NoReturn, Pattern, Protocol, Sequence, TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_ActionT = TypeVar("_ActionT", bound=Action)
|
||||
@@ -47,7 +47,7 @@ class _ActionsContainer:
|
||||
def add_argument(
|
||||
self,
|
||||
*name_or_flags: str,
|
||||
action: str | Type[Action] = ...,
|
||||
action: str | type[Action] = ...,
|
||||
nargs: int | str = ...,
|
||||
const: Any = ...,
|
||||
default: Any = ...,
|
||||
@@ -67,7 +67,7 @@ class _ActionsContainer:
|
||||
def _add_container_actions(self, container: _ActionsContainer) -> None: ...
|
||||
def _get_positional_kwargs(self, dest: str, **kwargs: Any) -> dict[str, Any]: ...
|
||||
def _get_optional_kwargs(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
|
||||
def _pop_action_class(self, kwargs: Any, default: Type[Action] | None = ...) -> Type[Action]: ...
|
||||
def _pop_action_class(self, kwargs: Any, default: type[Action] | 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: ...
|
||||
@@ -143,7 +143,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
title: str = ...,
|
||||
description: str | None = ...,
|
||||
prog: str = ...,
|
||||
action: Type[Action] = ...,
|
||||
action: type[Action] = ...,
|
||||
option_string: str = ...,
|
||||
dest: str | None = ...,
|
||||
required: bool = ...,
|
||||
@@ -157,8 +157,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
title: str = ...,
|
||||
description: str | None = ...,
|
||||
prog: str = ...,
|
||||
parser_class: Type[_ArgumentParserT] = ...,
|
||||
action: Type[Action] = ...,
|
||||
parser_class: type[_ArgumentParserT] = ...,
|
||||
action: type[Action] = ...,
|
||||
option_string: str = ...,
|
||||
dest: str | None = ...,
|
||||
required: bool = ...,
|
||||
@@ -173,7 +173,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
title: str = ...,
|
||||
description: str | None = ...,
|
||||
prog: str = ...,
|
||||
action: Type[Action] = ...,
|
||||
action: type[Action] = ...,
|
||||
option_string: str = ...,
|
||||
dest: str | None = ...,
|
||||
help: str | None = ...,
|
||||
@@ -186,8 +186,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
title: str = ...,
|
||||
description: str | None = ...,
|
||||
prog: str = ...,
|
||||
parser_class: Type[_ArgumentParserT] = ...,
|
||||
action: Type[Action] = ...,
|
||||
parser_class: type[_ArgumentParserT] = ...,
|
||||
action: type[Action] = ...,
|
||||
option_string: str = ...,
|
||||
dest: str | None = ...,
|
||||
help: str | None = ...,
|
||||
@@ -237,7 +237,7 @@ class HelpFormatter:
|
||||
_current_section: Any
|
||||
_whitespace_matcher: Pattern[str]
|
||||
_long_break_matcher: Pattern[str]
|
||||
_Section: Type[Any] # Nested class
|
||||
_Section: type[Any] # Nested class
|
||||
def __init__(self, prog: str, indent_increment: int = ..., max_help_position: int = ..., width: int | None = ...) -> None: ...
|
||||
def _indent(self) -> None: ...
|
||||
def _dedent(self) -> None: ...
|
||||
@@ -410,9 +410,9 @@ class _VersionAction(Action):
|
||||
|
||||
# undocumented
|
||||
class _SubParsersAction(Action, Generic[_ArgumentParserT]):
|
||||
_ChoicesPseudoAction: Type[Any] # nested class
|
||||
_ChoicesPseudoAction: type[Any] # nested class
|
||||
_prog_prefix: str
|
||||
_parser_class: Type[_ArgumentParserT]
|
||||
_parser_class: type[_ArgumentParserT]
|
||||
_name_parser_map: dict[str, _ArgumentParserT]
|
||||
choices: dict[str, _ArgumentParserT]
|
||||
_choices_actions: list[Action]
|
||||
@@ -421,7 +421,7 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
|
||||
self,
|
||||
option_strings: Sequence[str],
|
||||
prog: str,
|
||||
parser_class: Type[_ArgumentParserT],
|
||||
parser_class: type[_ArgumentParserT],
|
||||
dest: str = ...,
|
||||
required: bool = ...,
|
||||
help: str | None = ...,
|
||||
@@ -432,7 +432,7 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
|
||||
self,
|
||||
option_strings: Sequence[str],
|
||||
prog: str,
|
||||
parser_class: Type[_ArgumentParserT],
|
||||
parser_class: type[_ArgumentParserT],
|
||||
dest: str = ...,
|
||||
help: str | None = ...,
|
||||
metavar: str | tuple[str, ...] | None = ...,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import sys
|
||||
from typing import Type
|
||||
|
||||
from .base_events import BaseEventLoop as BaseEventLoop
|
||||
from .coroutines import iscoroutine as iscoroutine, iscoroutinefunction as iscoroutinefunction
|
||||
@@ -108,7 +107,7 @@ if sys.version_info >= (3, 7):
|
||||
current_task as current_task,
|
||||
)
|
||||
|
||||
DefaultEventLoopPolicy: Type[AbstractEventLoopPolicy]
|
||||
DefaultEventLoopPolicy: type[AbstractEventLoopPolicy]
|
||||
|
||||
if sys.platform == "win32":
|
||||
from .windows_events import *
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from collections import deque
|
||||
from types import TracebackType
|
||||
from typing import Any, Awaitable, Callable, Generator, Type, TypeVar
|
||||
from typing import Any, Awaitable, Callable, Generator, TypeVar
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
from .futures import Future
|
||||
@@ -13,7 +13,7 @@ if sys.version_info >= (3, 9):
|
||||
def __init__(self, lock: Lock | Semaphore) -> None: ...
|
||||
def __aenter__(self) -> Awaitable[None]: ...
|
||||
def __aexit__(
|
||||
self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
|
||||
) -> Awaitable[None]: ...
|
||||
|
||||
else:
|
||||
@@ -30,7 +30,7 @@ else:
|
||||
def __await__(self) -> Generator[Any, None, _ContextManager]: ...
|
||||
def __aenter__(self) -> Awaitable[None]: ...
|
||||
def __aexit__(
|
||||
self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
|
||||
) -> Awaitable[None]: ...
|
||||
|
||||
class Lock(_ContextManagerMixin):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from socket import socket
|
||||
from typing import Any, Mapping, Protocol, Type
|
||||
from typing import Any, Mapping, Protocol
|
||||
from typing_extensions import Literal
|
||||
|
||||
from . import base_events, constants, events, futures, streams, transports
|
||||
@@ -8,7 +8,7 @@ from . import base_events, constants, events, futures, streams, transports
|
||||
if sys.version_info >= (3, 8):
|
||||
class _WarnCallbackProtocol(Protocol):
|
||||
def __call__(
|
||||
self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
|
||||
self, message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
|
||||
) -> None: ...
|
||||
|
||||
class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport):
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import socket
|
||||
import sys
|
||||
from builtins import type as Type # alias to avoid name clashes with property named "type"
|
||||
from types import TracebackType
|
||||
from typing import Any, BinaryIO, Iterable, NoReturn, Type, Union, overload
|
||||
from typing import Any, BinaryIO, Iterable, NoReturn, Union, overload
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
# These are based in socket, maybe move them out into _typeshed.pyi or such
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
import types
|
||||
from _typeshed import Self
|
||||
from socket import socket
|
||||
from typing import Any, Callable, Type
|
||||
from typing import Any, Callable
|
||||
|
||||
from .base_events import Server
|
||||
from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy, _ProtocolFactory, _SSLContext
|
||||
@@ -17,7 +17,7 @@ class AbstractChildWatcher:
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def is_active(self) -> bool: ...
|
||||
|
||||
@@ -51,7 +51,7 @@ if sys.platform != "win32":
|
||||
from typing import Protocol
|
||||
class _Warn(Protocol):
|
||||
def __call__(
|
||||
self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
|
||||
self, message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
|
||||
) -> None: ...
|
||||
class MultiLoopChildWatcher(AbstractChildWatcher):
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import socket
|
||||
import sys
|
||||
from _typeshed import WriteableBuffer
|
||||
from typing import IO, Any, Callable, ClassVar, NoReturn, Type
|
||||
from typing import IO, Any, Callable, ClassVar, NoReturn
|
||||
from typing_extensions import Literal
|
||||
|
||||
from . import events, futures, proactor_events, selector_events, streams, windows_utils
|
||||
@@ -61,17 +61,17 @@ if sys.platform == "win32":
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
||||
_loop_factory: ClassVar[Type[SelectorEventLoop]]
|
||||
_loop_factory: ClassVar[type[SelectorEventLoop]]
|
||||
def get_child_watcher(self) -> NoReturn: ...
|
||||
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
|
||||
class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
||||
_loop_factory: ClassVar[Type[ProactorEventLoop]]
|
||||
_loop_factory: ClassVar[type[ProactorEventLoop]]
|
||||
def get_child_watcher(self) -> NoReturn: ...
|
||||
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
|
||||
DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy
|
||||
else:
|
||||
class _WindowsDefaultEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
||||
_loop_factory: ClassVar[Type[SelectorEventLoop]]
|
||||
_loop_factory: ClassVar[type[SelectorEventLoop]]
|
||||
def get_child_watcher(self) -> NoReturn: ...
|
||||
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
|
||||
DefaultEventLoopPolicy = _WindowsDefaultEventLoopPolicy
|
||||
|
||||
@@ -2,13 +2,13 @@ import subprocess
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Callable, Protocol, Type
|
||||
from typing import Callable, Protocol
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.platform == "win32":
|
||||
class _WarnFunction(Protocol):
|
||||
def __call__(
|
||||
self, message: str, category: Type[Warning] = ..., stacklevel: int = ..., source: PipeHandle = ...
|
||||
self, message: str, category: type[Warning] = ..., stacklevel: int = ..., source: PipeHandle = ...
|
||||
) -> None: ...
|
||||
BUFSIZE: Literal[8192]
|
||||
PIPE = subprocess.PIPE
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
from types import CodeType, FrameType, TracebackType
|
||||
from typing import IO, Any, Callable, Iterable, Mapping, SupportsInt, Type, TypeVar
|
||||
from typing import IO, Any, Callable, Iterable, Mapping, SupportsInt, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_TraceDispatch = Callable[[FrameType, str, Any], Any] # TODO: Recursive type
|
||||
_ExcInfo = tuple[Type[BaseException], BaseException, FrameType]
|
||||
_ExcInfo = tuple[type[BaseException], BaseException, FrameType]
|
||||
|
||||
GENERATOR_AND_COROUTINE_FLAGS: int
|
||||
|
||||
|
||||
+28
-29
@@ -49,7 +49,6 @@ from typing import (
|
||||
SupportsFloat,
|
||||
SupportsInt,
|
||||
SupportsRound,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
@@ -89,12 +88,12 @@ class object:
|
||||
__module__: str
|
||||
__annotations__: dict[str, Any]
|
||||
@property
|
||||
def __class__(self: _T) -> Type[_T]: ...
|
||||
def __class__(self: _T) -> type[_T]: ...
|
||||
# Ignore errors about type mismatch between property getter and setter
|
||||
@__class__.setter
|
||||
def __class__(self, __type: Type[object]) -> None: ... # type: ignore # noqa: F811
|
||||
def __class__(self, __type: type[object]) -> None: ... # type: ignore # noqa: F811
|
||||
def __init__(self) -> None: ...
|
||||
def __new__(cls: Type[_T]) -> _T: ...
|
||||
def __new__(cls: type[_T]) -> _T: ...
|
||||
def __setattr__(self, __name: str, __value: Any) -> None: ...
|
||||
def __eq__(self, __o: object) -> bool: ...
|
||||
def __ne__(self, __o: object) -> bool: ...
|
||||
@@ -119,8 +118,8 @@ class staticmethod(Generic[_R]): # Special, only valid as a decorator.
|
||||
__func__: Callable[..., _R]
|
||||
__isabstractmethod__: bool
|
||||
def __init__(self: staticmethod[_R], __f: Callable[..., _R]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, __obj: _T, __type: Type[_T] | None = ...) -> Callable[..., _R]: ...
|
||||
def __new__(cls: type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R]: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
__name__: str
|
||||
__qualname__: str
|
||||
@@ -131,8 +130,8 @@ class classmethod(Generic[_R]): # Special, only valid as a decorator.
|
||||
__func__: Callable[..., _R]
|
||||
__isabstractmethod__: bool
|
||||
def __init__(self: classmethod[_R], __f: Callable[..., _R]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, __obj: _T, __type: Type[_T] | None = ...) -> Callable[..., _R]: ...
|
||||
def __new__(cls: type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R]: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
__name__: str
|
||||
__qualname__: str
|
||||
@@ -159,7 +158,7 @@ class type:
|
||||
@overload
|
||||
def __new__(cls, __o: object) -> type: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_TT], __name: str, __bases: tuple[type, ...], __namespace: dict[str, Any], **kwds: Any) -> _TT: ...
|
||||
def __new__(cls: type[_TT], __name: str, __bases: tuple[type, ...], __namespace: dict[str, Any], **kwds: Any) -> _TT: ...
|
||||
def __call__(self, *args: Any, **kwds: Any) -> Any: ...
|
||||
def __subclasses__(self: _TT) -> list[_TT]: ...
|
||||
# Note: the documentation doesn't specify what the return type is, the standard
|
||||
@@ -186,9 +185,9 @@ _NegativeInteger = Literal[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -1
|
||||
|
||||
class int:
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __x: str | bytes | SupportsInt | SupportsIndex | SupportsTrunc = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], __x: str | bytes | SupportsInt | SupportsIndex | SupportsTrunc = ...) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __x: str | bytes | bytearray, base: SupportsIndex) -> _T: ...
|
||||
def __new__(cls: type[_T], __x: str | bytes | bytearray, base: SupportsIndex) -> _T: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def as_integer_ratio(self) -> tuple[int, Literal[1]]: ...
|
||||
@property
|
||||
@@ -206,7 +205,7 @@ class int:
|
||||
def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ...
|
||||
@classmethod
|
||||
def from_bytes(
|
||||
cls: Type[Self],
|
||||
cls: type[Self],
|
||||
bytes: Iterable[SupportsIndex] | SupportsBytes, # TODO buffer object argument
|
||||
byteorder: Literal["little", "big"],
|
||||
*,
|
||||
@@ -272,12 +271,12 @@ class int:
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
class float:
|
||||
def __new__(cls: Type[_T], x: SupportsFloat | SupportsIndex | str | bytes | bytearray = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], x: SupportsFloat | SupportsIndex | str | bytes | bytearray = ...) -> _T: ...
|
||||
def as_integer_ratio(self) -> tuple[int, int]: ...
|
||||
def hex(self) -> str: ...
|
||||
def is_integer(self) -> bool: ...
|
||||
@classmethod
|
||||
def fromhex(cls: Type[Self], __s: str) -> Self: ...
|
||||
def fromhex(cls: type[Self], __s: str) -> Self: ...
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@property
|
||||
@@ -330,9 +329,9 @@ class float:
|
||||
|
||||
class complex:
|
||||
@overload
|
||||
def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], real: float = ..., imag: float = ...) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], real: str | SupportsComplex | SupportsIndex | complex) -> _T: ...
|
||||
def __new__(cls: type[_T], real: str | SupportsComplex | SupportsIndex | complex) -> _T: ...
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@property
|
||||
@@ -364,9 +363,9 @@ class _FormatMapMapping(Protocol):
|
||||
|
||||
class str(Sequence[str]):
|
||||
@overload
|
||||
def __new__(cls: Type[_T], object: object = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], object: object = ...) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], o: bytes, encoding: str = ..., errors: str = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], o: bytes, encoding: str = ..., errors: str = ...) -> _T: ...
|
||||
def capitalize(self) -> str: ...
|
||||
def casefold(self) -> str: ...
|
||||
def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ...
|
||||
@@ -450,15 +449,15 @@ class str(Sequence[str]):
|
||||
|
||||
class bytes(ByteString):
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __ints: Iterable[SupportsIndex]) -> _T: ...
|
||||
def __new__(cls: type[_T], __ints: Iterable[SupportsIndex]) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __string: str, encoding: str, errors: str = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], __string: str, encoding: str, errors: str = ...) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __length: SupportsIndex) -> _T: ...
|
||||
def __new__(cls: type[_T], __length: SupportsIndex) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T]) -> _T: ...
|
||||
def __new__(cls: type[_T]) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __o: SupportsBytes) -> _T: ...
|
||||
def __new__(cls: type[_T], __o: SupportsBytes) -> _T: ...
|
||||
def capitalize(self) -> bytes: ...
|
||||
def center(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ...
|
||||
def count(
|
||||
@@ -522,7 +521,7 @@ class bytes(ByteString):
|
||||
def upper(self) -> bytes: ...
|
||||
def zfill(self, __width: SupportsIndex) -> bytes: ...
|
||||
@classmethod
|
||||
def fromhex(cls: Type[Self], __s: str) -> Self: ...
|
||||
def fromhex(cls: type[Self], __s: str) -> Self: ...
|
||||
@staticmethod
|
||||
def maketrans(__frm: bytes, __to: bytes) -> bytes: ...
|
||||
def __len__(self) -> int: ...
|
||||
@@ -626,7 +625,7 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def upper(self) -> bytearray: ...
|
||||
def zfill(self, __width: SupportsIndex) -> bytearray: ...
|
||||
@classmethod
|
||||
def fromhex(cls: Type[Self], __string: str) -> Self: ...
|
||||
def fromhex(cls: type[Self], __string: str) -> Self: ...
|
||||
@staticmethod
|
||||
def maketrans(__frm: bytes, __to: bytes) -> bytes: ...
|
||||
def __len__(self) -> int: ...
|
||||
@@ -676,7 +675,7 @@ class memoryview(Sized, Sequence[int]):
|
||||
def __init__(self, obj: ReadableBuffer) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, __exc_type: Type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None
|
||||
self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def cast(self, format: str, shape: list[int] | tuple[int, ...] = ...) -> memoryview: ...
|
||||
@overload
|
||||
@@ -705,7 +704,7 @@ class memoryview(Sized, Sequence[int]):
|
||||
|
||||
@final
|
||||
class bool(int):
|
||||
def __new__(cls: Type[_T], __o: object = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], __o: object = ...) -> _T: ...
|
||||
@overload
|
||||
def __and__(self, __x: bool) -> bool: ...
|
||||
@overload
|
||||
@@ -748,7 +747,7 @@ class slice:
|
||||
def indices(self, __len: SupportsIndex) -> tuple[int, int, int]: ...
|
||||
|
||||
class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
def __new__(cls: Type[_T], __iterable: Iterable[_T_co] = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], __iterable: Iterable[_T_co] = ...) -> _T: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, __x: object) -> bool: ...
|
||||
@overload
|
||||
@@ -848,7 +847,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
# Cannot be Iterable[Sequence[_T]] or otherwise dict(["foo", "bar", "baz"]) is not an error
|
||||
@overload
|
||||
def __init__(self: dict[str, str], __iterable: Iterable[list[str]]) -> None: ...
|
||||
def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ...
|
||||
def __new__(cls: type[_T1], *args: Any, **kwargs: Any) -> _T1: ...
|
||||
def copy(self) -> dict[_KT, _VT]: ...
|
||||
def keys(self) -> dict_keys[_KT, _VT]: ...
|
||||
def values(self) -> dict_values[_KT, _VT]: ...
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
from _typeshed import StrOrBytesPath
|
||||
from types import FrameType, TracebackType
|
||||
from typing import IO, Any, Callable, Optional, Type
|
||||
from typing import IO, Any, Callable, Optional
|
||||
|
||||
_ExcInfo = tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
_ExcInfo = tuple[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
|
||||
def reset() -> str: ... # undocumented
|
||||
def small(text: str) -> str: ... # undocumented
|
||||
@@ -24,7 +24,7 @@ class Hook: # undocumented
|
||||
file: IO[str] | None = ...,
|
||||
format: str = ...,
|
||||
) -> None: ...
|
||||
def __call__(self, etype: Type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ...
|
||||
def __call__(self, etype: type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ...
|
||||
def handle(self, info: _ExcInfo | None = ...) -> None: ...
|
||||
|
||||
def handler(info: _ExcInfo | None = ...) -> None: ...
|
||||
|
||||
+5
-5
@@ -2,7 +2,7 @@ import sys
|
||||
import types
|
||||
from _typeshed import Self
|
||||
from abc import abstractmethod
|
||||
from typing import IO, Any, BinaryIO, Callable, Generator, Iterable, Iterator, Protocol, TextIO, Type, TypeVar, overload
|
||||
from typing import IO, Any, BinaryIO, Callable, Generator, Iterable, Iterator, Protocol, TextIO, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
BOM32_BE: Literal[b"\xfe\xff"]
|
||||
@@ -186,7 +186,7 @@ class StreamWriter(Codec):
|
||||
def writelines(self, list: Iterable[str]) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
|
||||
|
||||
class StreamReader(Codec):
|
||||
@@ -197,7 +197,7 @@ class StreamReader(Codec):
|
||||
def readlines(self, sizehint: int | None = ..., keepends: bool = ...) -> list[str]: ...
|
||||
def reset(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
|
||||
|
||||
@@ -219,7 +219,7 @@ class StreamReaderWriter(TextIO):
|
||||
# Same as write()
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
# These methods don't actually exist directly, but they are needed to satisfy the TextIO
|
||||
# interface. At runtime, they are delegated through __getattr__.
|
||||
@@ -255,7 +255,7 @@ class StreamRecoder(BinaryIO):
|
||||
def reset(self) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, type: Type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
|
||||
# These methods don't actually exist directly, but they are needed to satisfy the BinaryIO
|
||||
# interface. At runtime, they are delegated through __getattr__.
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _collections_abc import dict_items, dict_keys, dict_values
|
||||
from _typeshed import Self, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
|
||||
from typing import Any, Generic, NoReturn, Type, TypeVar, overload
|
||||
from typing import Any, Generic, NoReturn, TypeVar, overload
|
||||
from typing_extensions import SupportsIndex, final
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -28,12 +28,12 @@ if sys.version_info >= (3, 7):
|
||||
rename: bool = ...,
|
||||
module: str | None = ...,
|
||||
defaults: Iterable[Any] | None = ...,
|
||||
) -> Type[tuple[Any, ...]]: ...
|
||||
) -> type[tuple[Any, ...]]: ...
|
||||
|
||||
else:
|
||||
def namedtuple(
|
||||
typename: str, field_names: str | Iterable[str], *, verbose: bool = ..., rename: bool = ..., module: str | None = ...
|
||||
) -> Type[tuple[Any, ...]]: ...
|
||||
) -> type[tuple[Any, ...]]: ...
|
||||
|
||||
class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
data: dict[_KT, _VT]
|
||||
@@ -206,7 +206,7 @@ class deque(MutableSequence[_T], Generic[_T]):
|
||||
def __setitem__(self, __i: SupportsIndex, __x: _T) -> None: ... # type: ignore[override]
|
||||
def __delitem__(self, __i: SupportsIndex) -> None: ... # type: ignore[override]
|
||||
def __contains__(self, __o: object) -> bool: ...
|
||||
def __reduce__(self: Self) -> tuple[Type[Self], tuple[()], None, Iterator[_T]]: ...
|
||||
def __reduce__(self: Self) -> tuple[type[Self], tuple[()], None, Iterator[_T]]: ...
|
||||
def __iadd__(self: _S, __iterable: Iterable[_T]) -> _S: ...
|
||||
def __add__(self: _S, __other: _S) -> _S: ...
|
||||
def __mul__(self: _S, __other: int) -> _S: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import StrOrBytesPath, StrPath, SupportsWrite
|
||||
from collections.abc import Callable, ItemsView, Iterable, Iterator, Mapping, MutableMapping, Sequence
|
||||
from typing import Any, ClassVar, Optional, Pattern, Type, TypeVar, overload
|
||||
from typing import Any, ClassVar, Optional, Pattern, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
# Internal type aliases
|
||||
@@ -47,7 +47,7 @@ class RawConfigParser(_parser):
|
||||
def __init__(
|
||||
self,
|
||||
defaults: Mapping[str, str | None] | None = ...,
|
||||
dict_type: Type[Mapping[str, str]] = ...,
|
||||
dict_type: type[Mapping[str, str]] = ...,
|
||||
allow_no_value: Literal[True] = ...,
|
||||
*,
|
||||
delimiters: Sequence[str] = ...,
|
||||
@@ -63,7 +63,7 @@ class RawConfigParser(_parser):
|
||||
def __init__(
|
||||
self,
|
||||
defaults: _section | None = ...,
|
||||
dict_type: Type[Mapping[str, str]] = ...,
|
||||
dict_type: type[Mapping[str, str]] = ...,
|
||||
allow_no_value: bool = ...,
|
||||
*,
|
||||
delimiters: Sequence[str] = ...,
|
||||
|
||||
@@ -14,7 +14,6 @@ from typing import (
|
||||
Iterator,
|
||||
Optional,
|
||||
Protocol,
|
||||
Type,
|
||||
TypeVar,
|
||||
overload,
|
||||
)
|
||||
@@ -32,7 +31,7 @@ _T_io = TypeVar("_T_io", bound=Optional[IO[str]])
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
_ExitFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool]
|
||||
_ExitFunc = Callable[[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool]
|
||||
_CM_EF = TypeVar("_CM_EF", AbstractContextManager[Any], _ExitFunc)
|
||||
|
||||
class ContextDecorator:
|
||||
@@ -90,9 +89,9 @@ if sys.version_info >= (3, 10):
|
||||
def __init__(self, thing: _SupportsAcloseT) -> None: ...
|
||||
|
||||
class suppress(AbstractContextManager[None]):
|
||||
def __init__(self, *exceptions: Type[BaseException]) -> None: ...
|
||||
def __init__(self, *exceptions: type[BaseException]) -> None: ...
|
||||
def __exit__(
|
||||
self, exctype: Type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None
|
||||
self, exctype: type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None
|
||||
) -> bool: ...
|
||||
|
||||
class redirect_stdout(AbstractContextManager[_T_io]):
|
||||
@@ -110,11 +109,11 @@ class ExitStack(AbstractContextManager[ExitStack]):
|
||||
def close(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, __exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None
|
||||
self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None
|
||||
) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
_ExitCoroFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], Awaitable[bool]]
|
||||
_ExitCoroFunc = Callable[[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]], Awaitable[bool]]
|
||||
_CallbackCoroFunc = Callable[..., Awaitable[Any]]
|
||||
_ACM_EF = TypeVar("_ACM_EF", AbstractAsyncContextManager[Any], _ExitCoroFunc)
|
||||
class AsyncExitStack(AbstractAsyncContextManager[AsyncExitStack]):
|
||||
@@ -129,7 +128,7 @@ if sys.version_info >= (3, 7):
|
||||
def aclose(self) -> Awaitable[None]: ...
|
||||
def __aenter__(self: Self) -> Awaitable[Self]: ...
|
||||
def __aexit__(
|
||||
self, __exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None
|
||||
self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None
|
||||
) -> Awaitable[bool]: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ from _csv import (
|
||||
writer as writer,
|
||||
)
|
||||
from collections.abc import Collection, Iterable, Iterator, Mapping, Sequence
|
||||
from typing import Any, Generic, Type, TypeVar, overload
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from builtins import dict as _DictReadMapping
|
||||
@@ -103,5 +103,5 @@ class DictWriter(Generic[_T]):
|
||||
class Sniffer:
|
||||
preferred: list[str]
|
||||
def __init__(self) -> None: ...
|
||||
def sniff(self, sample: str, delimiters: str | None = ...) -> Type[Dialect]: ...
|
||||
def sniff(self, sample: str, delimiters: str | None = ...) -> type[Dialect]: ...
|
||||
def has_header(self, sample: str) -> bool: ...
|
||||
|
||||
+25
-26
@@ -11,7 +11,6 @@ from typing import (
|
||||
Mapping,
|
||||
Optional,
|
||||
Sequence,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union as _UnionT,
|
||||
overload,
|
||||
@@ -33,7 +32,7 @@ class CDLL:
|
||||
_func_restype_: ClassVar[_CData]
|
||||
_name: str
|
||||
_handle: int
|
||||
_FuncPtr: Type[_FuncPointer]
|
||||
_FuncPtr: type[_FuncPointer]
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(
|
||||
self,
|
||||
@@ -58,7 +57,7 @@ if sys.platform == "win32":
|
||||
class PyDLL(CDLL): ...
|
||||
|
||||
class LibraryLoader(Generic[_DLLT]):
|
||||
def __init__(self, dlltype: Type[_DLLT]) -> None: ...
|
||||
def __init__(self, dlltype: type[_DLLT]) -> None: ...
|
||||
def __getattr__(self, name: str) -> _DLLT: ...
|
||||
def __getitem__(self, name: str) -> _DLLT: ...
|
||||
def LoadLibrary(self, name: str) -> _DLLT: ...
|
||||
@@ -76,33 +75,33 @@ class _CDataMeta(type):
|
||||
# By default mypy complains about the following two methods, because strictly speaking cls
|
||||
# might not be a Type[_CT]. However this can never actually happen, because the only class that
|
||||
# uses _CDataMeta as its metaclass is _CData. So it's safe to ignore the errors here.
|
||||
def __mul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore[misc]
|
||||
def __rmul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore[misc]
|
||||
def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc]
|
||||
def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc]
|
||||
|
||||
class _CData(metaclass=_CDataMeta):
|
||||
_b_base: int
|
||||
_b_needsfree_: bool
|
||||
_objects: Mapping[Any, int] | None
|
||||
@classmethod
|
||||
def from_buffer(cls: Type[_CT], source: WriteableBuffer, offset: int = ...) -> _CT: ...
|
||||
def from_buffer(cls: type[_CT], source: WriteableBuffer, offset: int = ...) -> _CT: ...
|
||||
@classmethod
|
||||
def from_buffer_copy(cls: Type[_CT], source: ReadableBuffer, offset: int = ...) -> _CT: ...
|
||||
def from_buffer_copy(cls: type[_CT], source: ReadableBuffer, offset: int = ...) -> _CT: ...
|
||||
@classmethod
|
||||
def from_address(cls: Type[_CT], address: int) -> _CT: ...
|
||||
def from_address(cls: type[_CT], address: int) -> _CT: ...
|
||||
@classmethod
|
||||
def from_param(cls: Type[_CT], obj: Any) -> _CT | _CArgObject: ...
|
||||
def from_param(cls: type[_CT], obj: Any) -> _CT | _CArgObject: ...
|
||||
@classmethod
|
||||
def in_dll(cls: Type[_CT], library: CDLL, name: str) -> _CT: ...
|
||||
def in_dll(cls: type[_CT], library: CDLL, name: str) -> _CT: ...
|
||||
|
||||
class _CanCastTo(_CData): ...
|
||||
class _PointerLike(_CanCastTo): ...
|
||||
|
||||
_ECT = Callable[[Optional[Type[_CData]], _FuncPointer, tuple[_CData, ...]], _CData]
|
||||
_ECT = Callable[[Optional[type[_CData]], _FuncPointer, tuple[_CData, ...]], _CData]
|
||||
_PF = _UnionT[tuple[int], tuple[int, str], tuple[int, str, Any]]
|
||||
|
||||
class _FuncPointer(_PointerLike, _CData):
|
||||
restype: Type[_CData] | Callable[[int], Any] | None
|
||||
argtypes: Sequence[Type[_CData]]
|
||||
restype: type[_CData] | Callable[[int], Any] | None
|
||||
argtypes: Sequence[type[_CData]]
|
||||
errcheck: _ECT
|
||||
@overload
|
||||
def __init__(self, address: int) -> None: ...
|
||||
@@ -120,15 +119,15 @@ class _NamedFuncPointer(_FuncPointer):
|
||||
class ArgumentError(Exception): ...
|
||||
|
||||
def CFUNCTYPE(
|
||||
restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ...
|
||||
) -> Type[_FuncPointer]: ...
|
||||
restype: type[_CData] | None, *argtypes: type[_CData], use_errno: bool = ..., use_last_error: bool = ...
|
||||
) -> type[_FuncPointer]: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def WINFUNCTYPE(
|
||||
restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ...
|
||||
) -> Type[_FuncPointer]: ...
|
||||
restype: type[_CData] | None, *argtypes: type[_CData], use_errno: bool = ..., use_last_error: bool = ...
|
||||
) -> type[_FuncPointer]: ...
|
||||
|
||||
def PYFUNCTYPE(restype: Type[_CData] | None, *argtypes: Type[_CData]) -> Type[_FuncPointer]: ...
|
||||
def PYFUNCTYPE(restype: type[_CData] | None, *argtypes: type[_CData]) -> type[_FuncPointer]: ...
|
||||
|
||||
class _CArgObject: ...
|
||||
|
||||
@@ -142,12 +141,12 @@ _CVoidPLike = _UnionT[_PointerLike, Array[Any], _CArgObject, int]
|
||||
_CVoidConstPLike = _UnionT[_CVoidPLike, bytes]
|
||||
|
||||
def addressof(obj: _CData) -> int: ...
|
||||
def alignment(obj_or_type: _CData | Type[_CData]) -> int: ...
|
||||
def alignment(obj_or_type: _CData | type[_CData]) -> int: ...
|
||||
def byref(obj: _CData, offset: int = ...) -> _CArgObject: ...
|
||||
|
||||
_CastT = TypeVar("_CastT", bound=_CanCastTo)
|
||||
|
||||
def cast(obj: _CData | _CArgObject | int, typ: Type[_CastT]) -> _CastT: ...
|
||||
def cast(obj: _CData | _CArgObject | int, typ: type[_CastT]) -> _CastT: ...
|
||||
def create_string_buffer(init: int | bytes, size: int | None = ...) -> Array[c_char]: ...
|
||||
|
||||
c_buffer = create_string_buffer
|
||||
@@ -167,13 +166,13 @@ if sys.platform == "win32":
|
||||
|
||||
def memmove(dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> None: ...
|
||||
def memset(dst: _CVoidPLike, c: int, count: int) -> None: ...
|
||||
def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ...
|
||||
def POINTER(type: type[_CT]) -> type[pointer[_CT]]: ...
|
||||
|
||||
# The real ctypes.pointer is a function, not a class. The stub version of pointer behaves like
|
||||
# ctypes._Pointer in that it is the base class for all pointer types. Unlike the real _Pointer,
|
||||
# it can be instantiated directly (to mimic the behavior of the real pointer function).
|
||||
class pointer(Generic[_CT], _PointerLike, _CData):
|
||||
_type_: Type[_CT]
|
||||
_type_: type[_CT]
|
||||
contents: _CT
|
||||
def __init__(self, arg: _CT = ...) -> None: ...
|
||||
@overload
|
||||
@@ -191,7 +190,7 @@ def set_errno(value: int) -> int: ...
|
||||
if sys.platform == "win32":
|
||||
def set_last_error(value: int) -> int: ...
|
||||
|
||||
def sizeof(obj_or_type: _CData | Type[_CData]) -> int: ...
|
||||
def sizeof(obj_or_type: _CData | type[_CData]) -> int: ...
|
||||
def string_at(address: _CVoidConstPLike, size: int = ...) -> bytes: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
@@ -252,7 +251,7 @@ class _CField:
|
||||
size: int
|
||||
|
||||
class _StructUnionMeta(_CDataMeta):
|
||||
_fields_: Sequence[tuple[str, Type[_CData]] | tuple[str, Type[_CData], int]]
|
||||
_fields_: Sequence[tuple[str, type[_CData]] | tuple[str, type[_CData], int]]
|
||||
_pack_: int
|
||||
_anonymous_: Sequence[str]
|
||||
def __getattr__(self, name: str) -> _CField: ...
|
||||
@@ -275,9 +274,9 @@ class Array(Generic[_CT], _CData):
|
||||
def _length_(self, value: int) -> None: ...
|
||||
@property
|
||||
@abstractmethod
|
||||
def _type_(self) -> Type[_CT]: ...
|
||||
def _type_(self) -> type[_CT]: ...
|
||||
@_type_.setter
|
||||
def _type_(self, value: Type[_CT]) -> None: ...
|
||||
def _type_(self, value: type[_CT]) -> None: ...
|
||||
raw: bytes # Note: only available if _CT == c_char
|
||||
value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise
|
||||
# TODO These methods cannot be annotated correctly at the moment.
|
||||
|
||||
+11
-10
@@ -1,6 +1,7 @@
|
||||
import sys
|
||||
import types
|
||||
from typing import Any, Callable, Generic, Iterable, Mapping, Protocol, Type, TypeVar, overload
|
||||
from builtins import type as Type # alias to avoid name clashes with fields named "type"
|
||||
from typing import Any, Callable, Generic, Iterable, Mapping, Protocol, TypeVar, overload
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
@@ -26,9 +27,9 @@ def astuple(obj: Any, *, tuple_factory: Callable[[list[Any]], _T]) -> _T: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def dataclass(__cls: Type[_T]) -> Type[_T]: ...
|
||||
def dataclass(__cls: type[_T]) -> type[_T]: ...
|
||||
@overload
|
||||
def dataclass(__cls: None) -> Callable[[Type[_T]], Type[_T]]: ...
|
||||
def dataclass(__cls: None) -> Callable[[type[_T]], type[_T]]: ...
|
||||
@overload
|
||||
def dataclass(
|
||||
*,
|
||||
@@ -41,28 +42,28 @@ if sys.version_info >= (3, 10):
|
||||
match_args: bool = ...,
|
||||
kw_only: bool = ...,
|
||||
slots: bool = ...,
|
||||
) -> Callable[[Type[_T]], Type[_T]]: ...
|
||||
) -> Callable[[type[_T]], type[_T]]: ...
|
||||
|
||||
elif sys.version_info >= (3, 8):
|
||||
# cls argument is now positional-only
|
||||
@overload
|
||||
def dataclass(__cls: Type[_T]) -> Type[_T]: ...
|
||||
def dataclass(__cls: type[_T]) -> type[_T]: ...
|
||||
@overload
|
||||
def dataclass(__cls: None) -> Callable[[Type[_T]], Type[_T]]: ...
|
||||
def dataclass(__cls: None) -> Callable[[type[_T]], type[_T]]: ...
|
||||
@overload
|
||||
def dataclass(
|
||||
*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ...
|
||||
) -> Callable[[Type[_T]], Type[_T]]: ...
|
||||
) -> Callable[[type[_T]], type[_T]]: ...
|
||||
|
||||
else:
|
||||
@overload
|
||||
def dataclass(_cls: Type[_T]) -> Type[_T]: ...
|
||||
def dataclass(_cls: type[_T]) -> type[_T]: ...
|
||||
@overload
|
||||
def dataclass(_cls: None) -> Callable[[Type[_T]], Type[_T]]: ...
|
||||
def dataclass(_cls: None) -> Callable[[type[_T]], type[_T]]: ...
|
||||
@overload
|
||||
def dataclass(
|
||||
*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ...
|
||||
) -> Callable[[Type[_T]], Type[_T]]: ...
|
||||
) -> Callable[[type[_T]], type[_T]]: ...
|
||||
|
||||
# See https://github.com/python/mypy/issues/10750
|
||||
class _DefaultFactory(Protocol[_T_co]):
|
||||
|
||||
+17
-17
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from time import struct_time
|
||||
from typing import ClassVar, NamedTuple, NoReturn, SupportsAbs, Type, TypeVar, overload
|
||||
from typing import ClassVar, NamedTuple, NoReturn, SupportsAbs, TypeVar, overload
|
||||
from typing_extensions import final
|
||||
|
||||
_S = TypeVar("_S")
|
||||
@@ -36,19 +36,19 @@ class date:
|
||||
min: ClassVar[date]
|
||||
max: ClassVar[date]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(cls: Type[_S], year: int, month: int, day: int) -> _S: ...
|
||||
def __new__(cls: type[_S], year: int, month: int, day: int) -> _S: ...
|
||||
@classmethod
|
||||
def fromtimestamp(cls: Type[_S], __timestamp: float) -> _S: ...
|
||||
def fromtimestamp(cls: type[_S], __timestamp: float) -> _S: ...
|
||||
@classmethod
|
||||
def today(cls: Type[_S]) -> _S: ...
|
||||
def today(cls: type[_S]) -> _S: ...
|
||||
@classmethod
|
||||
def fromordinal(cls: Type[_S], __n: int) -> _S: ...
|
||||
def fromordinal(cls: type[_S], __n: int) -> _S: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
@classmethod
|
||||
def fromisoformat(cls: Type[_S], __date_string: str) -> _S: ...
|
||||
def fromisoformat(cls: type[_S], __date_string: str) -> _S: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@classmethod
|
||||
def fromisocalendar(cls: Type[_S], year: int, week: int, day: int) -> _S: ...
|
||||
def fromisocalendar(cls: type[_S], year: int, week: int, day: int) -> _S: ...
|
||||
@property
|
||||
def year(self) -> int: ...
|
||||
@property
|
||||
@@ -98,7 +98,7 @@ class time:
|
||||
max: ClassVar[time]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(
|
||||
cls: Type[_S],
|
||||
cls: type[_S],
|
||||
hour: int = ...,
|
||||
minute: int = ...,
|
||||
second: int = ...,
|
||||
@@ -127,7 +127,7 @@ class time:
|
||||
def isoformat(self, timespec: str = ...) -> str: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
@classmethod
|
||||
def fromisoformat(cls: Type[_S], __time_string: str) -> _S: ...
|
||||
def fromisoformat(cls: type[_S], __time_string: str) -> _S: ...
|
||||
def strftime(self, __format: str) -> str: ...
|
||||
def __format__(self, __fmt: str) -> str: ...
|
||||
def utcoffset(self) -> timedelta | None: ...
|
||||
@@ -152,7 +152,7 @@ class timedelta(SupportsAbs[timedelta]):
|
||||
max: ClassVar[timedelta]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(
|
||||
cls: Type[_S],
|
||||
cls: type[_S],
|
||||
days: float = ...,
|
||||
seconds: float = ...,
|
||||
microseconds: float = ...,
|
||||
@@ -199,7 +199,7 @@ class datetime(date):
|
||||
max: ClassVar[datetime]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(
|
||||
cls: Type[_S],
|
||||
cls: type[_S],
|
||||
year: int,
|
||||
month: int,
|
||||
day: int,
|
||||
@@ -227,26 +227,26 @@ class datetime(date):
|
||||
# but it is named "timestamp" in the C implementation and "t" in the Python implementation,
|
||||
# so it is only truly *safe* to pass it as a positional argument.
|
||||
@classmethod
|
||||
def fromtimestamp(cls: Type[_S], __timestamp: float, tz: _tzinfo | None = ...) -> _S: ...
|
||||
def fromtimestamp(cls: type[_S], __timestamp: float, tz: _tzinfo | None = ...) -> _S: ...
|
||||
@classmethod
|
||||
def utcfromtimestamp(cls: Type[_S], __t: float) -> _S: ...
|
||||
def utcfromtimestamp(cls: type[_S], __t: float) -> _S: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@classmethod
|
||||
def now(cls: Type[_S], tz: _tzinfo | None = ...) -> _S: ...
|
||||
def now(cls: type[_S], tz: _tzinfo | None = ...) -> _S: ...
|
||||
else:
|
||||
@overload
|
||||
@classmethod
|
||||
def now(cls: Type[_S], tz: None = ...) -> _S: ...
|
||||
def now(cls: type[_S], tz: None = ...) -> _S: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def now(cls, tz: _tzinfo) -> datetime: ...
|
||||
@classmethod
|
||||
def utcnow(cls: Type[_S]) -> _S: ...
|
||||
def utcnow(cls: type[_S]) -> _S: ...
|
||||
@classmethod
|
||||
def combine(cls, date: _date, time: _time, tzinfo: _tzinfo | None = ...) -> datetime: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
@classmethod
|
||||
def fromisoformat(cls: Type[_S], __date_string: str) -> _S: ...
|
||||
def fromisoformat(cls: type[_S], __date_string: str) -> _S: ...
|
||||
def timestamp(self) -> float: ...
|
||||
def utctimetuple(self) -> struct_time: ...
|
||||
def date(self) -> _date: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Iterator, MutableMapping, Type, Union
|
||||
from typing import Iterator, MutableMapping, Union
|
||||
from typing_extensions import Literal
|
||||
|
||||
_KeyType = Union[str, bytes]
|
||||
@@ -82,12 +82,12 @@ class _Database(MutableMapping[_KeyType, bytes]):
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
class _error(Exception): ...
|
||||
|
||||
error: tuple[Type[_error], Type[OSError]]
|
||||
error: tuple[type[_error], type[OSError]]
|
||||
|
||||
def whichdb(filename: str) -> str: ...
|
||||
def open(file: str, flag: _TFlags = ..., mode: int = ...) -> _Database: ...
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Iterator, MutableMapping, Type, Union
|
||||
from typing import Iterator, MutableMapping, Union
|
||||
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
@@ -20,7 +20,7 @@ class _Database(MutableMapping[_KeyType, bytes]):
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
def open(file: str, flag: str = ..., mode: int = ...) -> _Database: ...
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Type, TypeVar, Union, overload
|
||||
from typing import TypeVar, Union, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_KeyType = Union[str, bytes]
|
||||
@@ -24,7 +24,7 @@ class _gdbm:
|
||||
def __len__(self) -> int: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
@overload
|
||||
def get(self, k: _KeyType) -> bytes | None: ...
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Type, TypeVar, Union, overload
|
||||
from typing import TypeVar, Union, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_KeyType = Union[str, bytes]
|
||||
@@ -20,7 +20,7 @@ class _dbm:
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
@overload
|
||||
def get(self, k: _KeyType) -> bytes | None: ...
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import numbers
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import Any, Container, NamedTuple, Sequence, Type, TypeVar, Union, overload
|
||||
from typing import Any, Container, NamedTuple, Sequence, TypeVar, Union, overload
|
||||
|
||||
_Decimal = Union[Decimal, int]
|
||||
_DecimalNew = Union[Decimal, float, str, tuple[int, Sequence[int], int]]
|
||||
@@ -50,7 +50,7 @@ def getcontext() -> Context: ...
|
||||
def localcontext(ctx: Context | None = ...) -> _ContextManager: ...
|
||||
|
||||
class Decimal:
|
||||
def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ...
|
||||
def __new__(cls: type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ...
|
||||
@classmethod
|
||||
def from_float(cls, __f: float) -> Decimal: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
@@ -146,7 +146,7 @@ class Decimal:
|
||||
def rotate(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def scaleb(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def shift(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def __reduce__(self) -> tuple[Type[Decimal], tuple[str]]: ...
|
||||
def __reduce__(self) -> tuple[type[Decimal], tuple[str]]: ...
|
||||
def __copy__(self) -> Decimal: ...
|
||||
def __deepcopy__(self, __memo: Any) -> Decimal: ...
|
||||
def __format__(self, __specifier: str, __context: Context | None = ...) -> str: ...
|
||||
@@ -156,9 +156,9 @@ class _ContextManager:
|
||||
saved_context: Context
|
||||
def __init__(self, new_context: Context) -> None: ...
|
||||
def __enter__(self) -> Context: ...
|
||||
def __exit__(self, t: Type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
|
||||
_TrapType = Type[DecimalException]
|
||||
_TrapType = type[DecimalException]
|
||||
|
||||
class Context:
|
||||
prec: int
|
||||
@@ -184,7 +184,7 @@ class Context:
|
||||
# __setattr__() only allows to set a specific set of attributes,
|
||||
# already defined above.
|
||||
def __delattr__(self, __name: str) -> None: ...
|
||||
def __reduce__(self) -> tuple[Type[Context], tuple[Any, ...]]: ...
|
||||
def __reduce__(self) -> tuple[type[Context], tuple[Any, ...]]: ...
|
||||
def clear_flags(self) -> None: ...
|
||||
def clear_traps(self) -> None: ...
|
||||
def copy(self) -> Context: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from distutils.cmd import Command as Command
|
||||
from distutils.dist import Distribution as Distribution
|
||||
from distutils.extension import Extension as Extension
|
||||
from typing import Any, Mapping, Type
|
||||
from typing import Any, Mapping
|
||||
|
||||
def setup(
|
||||
*,
|
||||
@@ -20,14 +20,14 @@ def setup(
|
||||
scripts: list[str] = ...,
|
||||
ext_modules: list[Extension] = ...,
|
||||
classifiers: list[str] = ...,
|
||||
distclass: Type[Distribution] = ...,
|
||||
distclass: type[Distribution] = ...,
|
||||
script_name: str = ...,
|
||||
script_args: list[str] = ...,
|
||||
options: Mapping[str, Any] = ...,
|
||||
license: str = ...,
|
||||
keywords: list[str] | str = ...,
|
||||
platforms: list[str] | str = ...,
|
||||
cmdclass: Mapping[str, Type[Command]] = ...,
|
||||
cmdclass: Mapping[str, type[Command]] = ...,
|
||||
data_files: list[tuple[str, list[str]]] = ...,
|
||||
package_dir: Mapping[str, str] = ...,
|
||||
obsoletes: list[str] = ...,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from _typeshed import StrOrBytesPath, SupportsWrite
|
||||
from distutils.cmd import Command
|
||||
from typing import IO, Any, Iterable, Mapping, Type
|
||||
from typing import IO, Any, Iterable, Mapping
|
||||
|
||||
class DistributionMetadata:
|
||||
def __init__(self, path: int | StrOrBytesPath | None = ...) -> None: ...
|
||||
@@ -50,7 +50,7 @@ class DistributionMetadata:
|
||||
def set_obsoletes(self, value: Iterable[str]) -> None: ...
|
||||
|
||||
class Distribution:
|
||||
cmdclass: dict[str, Type[Command]]
|
||||
cmdclass: dict[str, type[Command]]
|
||||
metadata: DistributionMetadata
|
||||
def __init__(self, attrs: Mapping[str, Any] | None = ...) -> None: ...
|
||||
def get_option_dict(self, command: str) -> dict[str, tuple[str, str]]: ...
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import types
|
||||
import unittest
|
||||
from typing import Any, Callable, NamedTuple, Type
|
||||
from typing import Any, Callable, NamedTuple
|
||||
|
||||
class TestResults(NamedTuple):
|
||||
failed: int
|
||||
@@ -86,7 +86,7 @@ class DocTestFinder:
|
||||
) -> list[DocTest]: ...
|
||||
|
||||
_Out = Callable[[str], Any]
|
||||
_ExcInfo = tuple[Type[BaseException], BaseException, types.TracebackType]
|
||||
_ExcInfo = tuple[type[BaseException], BaseException, types.TracebackType]
|
||||
|
||||
class DocTestRunner:
|
||||
DIVIDER: str
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from email.errors import HeaderParseError, MessageDefect
|
||||
from email.policy import Policy
|
||||
from typing import Any, Iterable, Iterator, Pattern, Type, TypeVar, Union
|
||||
from typing import Any, Iterable, Iterator, Pattern, TypeVar, Union
|
||||
from typing_extensions import Final
|
||||
|
||||
_T = TypeVar("_T")
|
||||
@@ -327,7 +327,7 @@ class Terminal(str):
|
||||
syntactic_break: bool
|
||||
token_type: str
|
||||
defects: list[MessageDefect]
|
||||
def __new__(cls: Type[_T], value: str, token_type: str) -> _T: ...
|
||||
def __new__(cls: type[_T], value: str, token_type: str) -> _T: ...
|
||||
def pprint(self) -> None: ...
|
||||
@property
|
||||
def all_defects(self) -> list[MessageDefect]: ...
|
||||
|
||||
@@ -13,7 +13,7 @@ from email._header_value_parser import (
|
||||
)
|
||||
from email.errors import MessageDefect
|
||||
from email.policy import Policy
|
||||
from typing import Any, ClassVar, Type
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
class BaseHeader(str):
|
||||
@@ -141,10 +141,10 @@ if sys.version_info >= (3, 8):
|
||||
|
||||
class HeaderRegistry:
|
||||
def __init__(
|
||||
self, base_class: Type[BaseHeader] = ..., default_class: Type[BaseHeader] = ..., use_default_map: bool = ...
|
||||
self, base_class: type[BaseHeader] = ..., default_class: type[BaseHeader] = ..., use_default_map: bool = ...
|
||||
) -> None: ...
|
||||
def map_to_type(self, name: str, cls: Type[BaseHeader]) -> None: ...
|
||||
def __getitem__(self, name: str) -> Type[BaseHeader]: ...
|
||||
def map_to_type(self, name: str, cls: type[BaseHeader]) -> None: ...
|
||||
def __getitem__(self, name: str) -> type[BaseHeader]: ...
|
||||
def __call__(self, name: str, value: Any) -> BaseHeader: ...
|
||||
|
||||
class Address:
|
||||
|
||||
+20
-20
@@ -3,10 +3,10 @@ import types
|
||||
from abc import ABCMeta
|
||||
from builtins import property as _builtins_property
|
||||
from collections.abc import Iterable, Iterator, Mapping
|
||||
from typing import Any, Type, TypeVar, Union, overload
|
||||
from typing import Any, TypeVar, Union, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_S = TypeVar("_S", bound=Type[Enum])
|
||||
_S = TypeVar("_S", bound=type[Enum])
|
||||
|
||||
# The following all work:
|
||||
# >>> from enum import Enum
|
||||
@@ -32,7 +32,7 @@ class _EnumDict(dict[str, Any]):
|
||||
class EnumMeta(ABCMeta):
|
||||
if sys.version_info >= (3, 11):
|
||||
def __new__(
|
||||
metacls: Type[_T],
|
||||
metacls: type[_T],
|
||||
cls: str,
|
||||
bases: tuple[type, ...],
|
||||
classdict: _EnumDict,
|
||||
@@ -42,20 +42,20 @@ class EnumMeta(ABCMeta):
|
||||
**kwds: Any,
|
||||
) -> _T: ...
|
||||
elif sys.version_info >= (3, 9):
|
||||
def __new__(metacls: Type[_T], cls: str, bases: tuple[type, ...], classdict: _EnumDict, **kwds: Any) -> _T: ... # type: ignore
|
||||
def __new__(metacls: type[_T], cls: str, bases: tuple[type, ...], classdict: _EnumDict, **kwds: Any) -> _T: ... # type: ignore
|
||||
else:
|
||||
def __new__(metacls: Type[_T], cls: str, bases: tuple[type, ...], classdict: _EnumDict) -> _T: ... # type: ignore
|
||||
def __iter__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __reversed__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __contains__(self: Type[Any], member: object) -> bool: ...
|
||||
def __getitem__(self: Type[_T], name: str) -> _T: ...
|
||||
def __new__(metacls: type[_T], cls: str, bases: tuple[type, ...], classdict: _EnumDict) -> _T: ... # type: ignore
|
||||
def __iter__(self: type[_T]) -> Iterator[_T]: ...
|
||||
def __reversed__(self: type[_T]) -> Iterator[_T]: ...
|
||||
def __contains__(self: type[Any], member: object) -> bool: ...
|
||||
def __getitem__(self: type[_T], name: str) -> _T: ...
|
||||
@_builtins_property
|
||||
def __members__(self: Type[_T]) -> types.MappingProxyType[str, _T]: ...
|
||||
def __members__(self: type[_T]) -> types.MappingProxyType[str, _T]: ...
|
||||
def __len__(self) -> int: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
# Simple value lookup
|
||||
@overload # type: ignore[override]
|
||||
def __call__(cls: Type[_T], value: Any, names: None = ...) -> _T: ...
|
||||
def __call__(cls: type[_T], value: Any, names: None = ...) -> _T: ...
|
||||
# Functional Enum API
|
||||
@overload
|
||||
def __call__(
|
||||
@@ -68,10 +68,10 @@ class EnumMeta(ABCMeta):
|
||||
type: type | None = ...,
|
||||
start: int = ...,
|
||||
boundary: FlagBoundary | None = ...,
|
||||
) -> Type[Enum]: ...
|
||||
) -> type[Enum]: ...
|
||||
else:
|
||||
@overload # type: ignore[override]
|
||||
def __call__(cls: Type[_T], value: Any, names: None = ...) -> _T: ...
|
||||
def __call__(cls: type[_T], value: Any, names: None = ...) -> _T: ...
|
||||
@overload
|
||||
def __call__(
|
||||
cls,
|
||||
@@ -82,7 +82,7 @@ class EnumMeta(ABCMeta):
|
||||
qualname: str | None = ...,
|
||||
type: type | None = ...,
|
||||
start: int = ...,
|
||||
) -> Type[Enum]: ...
|
||||
) -> type[Enum]: ...
|
||||
_member_names_: list[str] # undocumented
|
||||
_member_map_: dict[str, Enum] # undocumented
|
||||
_value2member_map_: dict[Any, Enum] # undocumented
|
||||
@@ -112,7 +112,7 @@ class Enum(metaclass=EnumMeta):
|
||||
def _missing_(cls, value: object) -> Any: ...
|
||||
@staticmethod
|
||||
def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> Any: ...
|
||||
def __new__(cls: Type[_T], value: object) -> _T: ...
|
||||
def __new__(cls: type[_T], value: object) -> _T: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __dir__(self) -> list[str]: ...
|
||||
@@ -128,7 +128,7 @@ class IntEnum(int, Enum):
|
||||
else:
|
||||
@types.DynamicClassAttribute
|
||||
def value(self) -> int: ...
|
||||
def __new__(cls: Type[_T], value: int | _T) -> _T: ...
|
||||
def __new__(cls: type[_T], value: int | _T) -> _T: ...
|
||||
|
||||
def unique(enumeration: _S) -> _S: ...
|
||||
|
||||
@@ -143,7 +143,7 @@ class auto(IntFlag):
|
||||
else:
|
||||
@types.DynamicClassAttribute
|
||||
def value(self) -> Any: ...
|
||||
def __new__(cls: Type[_T]) -> _T: ...
|
||||
def __new__(cls: type[_T]) -> _T: ...
|
||||
|
||||
class Flag(Enum):
|
||||
_name_: str | None # type: ignore[assignment]
|
||||
@@ -168,7 +168,7 @@ class Flag(Enum):
|
||||
def __invert__(self: _T) -> _T: ...
|
||||
|
||||
class IntFlag(int, Flag):
|
||||
def __new__(cls: Type[_T], value: int | _T) -> _T: ...
|
||||
def __new__(cls: type[_T], value: int | _T) -> _T: ...
|
||||
def __or__(self: _T, other: int | _T) -> _T: ...
|
||||
def __and__(self: _T, other: int | _T) -> _T: ...
|
||||
def __xor__(self: _T, other: int | _T) -> _T: ...
|
||||
@@ -178,7 +178,7 @@ class IntFlag(int, Flag):
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
class StrEnum(str, Enum):
|
||||
def __new__(cls: Type[_T], value: str | _T) -> _T: ...
|
||||
def __new__(cls: type[_T], value: str | _T) -> _T: ...
|
||||
_value_: str
|
||||
@property
|
||||
def value(self) -> str: ...
|
||||
@@ -192,7 +192,7 @@ if sys.version_info >= (3, 11):
|
||||
EJECT = FlagBoundary.EJECT
|
||||
KEEP = FlagBoundary.KEEP
|
||||
class property(types.DynamicClassAttribute):
|
||||
def __set_name__(self, ownerclass: Type[Enum], name: str) -> None: ...
|
||||
def __set_name__(self, ownerclass: type[Enum], name: str) -> None: ...
|
||||
name: str
|
||||
clsname: str
|
||||
def global_enum(cls: _S) -> _S: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from decimal import Decimal
|
||||
from numbers import Integral, Rational, Real
|
||||
from typing import Type, TypeVar, Union, overload
|
||||
from typing import TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_ComparableNum = Union[int, float, Decimal, Real]
|
||||
@@ -20,10 +20,10 @@ if sys.version_info < (3, 9):
|
||||
class Fraction(Rational):
|
||||
@overload
|
||||
def __new__(
|
||||
cls: Type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ...
|
||||
cls: type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ...
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __value: float | Decimal | str, *, _normalize: bool = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], __value: float | Decimal | str, *, _normalize: bool = ...) -> _T: ...
|
||||
@classmethod
|
||||
def from_float(cls, f: float) -> Fraction: ...
|
||||
@classmethod
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@ from _typeshed import Self, SupportsRead, SupportsReadline
|
||||
from socket import socket
|
||||
from ssl import SSLContext
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, Iterable, Iterator, TextIO, Type
|
||||
from typing import Any, Callable, Iterable, Iterator, TextIO
|
||||
from typing_extensions import Literal
|
||||
|
||||
MSG_OOB: int
|
||||
@@ -18,7 +18,7 @@ class error_temp(Error): ...
|
||||
class error_perm(Error): ...
|
||||
class error_proto(Error): ...
|
||||
|
||||
all_errors: tuple[Type[Exception], ...]
|
||||
all_errors: tuple[type[Exception], ...]
|
||||
|
||||
class FTP:
|
||||
debugging: int
|
||||
@@ -35,7 +35,7 @@ class FTP:
|
||||
encoding: str
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
source_address: tuple[str, int] | None
|
||||
if sys.version_info >= (3, 9):
|
||||
|
||||
+11
-11
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
import types
|
||||
from _typeshed import SupportsAllComparisons, SupportsItems
|
||||
from typing import Any, Callable, Generic, Hashable, Iterable, NamedTuple, Sequence, Sized, Type, TypeVar, overload
|
||||
from typing import Any, Callable, Generic, Hashable, Iterable, NamedTuple, Sequence, Sized, TypeVar, overload
|
||||
from typing_extensions import final
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -44,14 +44,14 @@ WRAPPER_UPDATES: Sequence[str]
|
||||
|
||||
def update_wrapper(wrapper: _T, wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> _T: ...
|
||||
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_T], _T]: ...
|
||||
def total_ordering(cls: Type[_T]) -> Type[_T]: ...
|
||||
def total_ordering(cls: type[_T]) -> type[_T]: ...
|
||||
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsAllComparisons]: ...
|
||||
|
||||
class partial(Generic[_T]):
|
||||
func: Callable[..., _T]
|
||||
args: tuple[Any, ...]
|
||||
keywords: dict[str, Any]
|
||||
def __new__(cls: Type[_S], __func: Callable[..., _T], *args: Any, **kwargs: Any) -> _S: ...
|
||||
def __new__(cls: type[_S], __func: Callable[..., _T], *args: Any, **kwargs: Any) -> _S: ...
|
||||
def __call__(__self, *args: Any, **kwargs: Any) -> _T: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
@@ -67,7 +67,7 @@ class partialmethod(Generic[_T]):
|
||||
def __init__(self, __func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ...
|
||||
@overload
|
||||
def __init__(self, __func: _Descriptor, *args: Any, **keywords: Any) -> None: ...
|
||||
def __get__(self, obj: Any, cls: Type[Any]) -> Callable[..., _T]: ...
|
||||
def __get__(self, obj: Any, cls: type[Any]) -> Callable[..., _T]: ...
|
||||
@property
|
||||
def __isabstractmethod__(self) -> bool: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -79,14 +79,14 @@ class _SingleDispatchCallable(Generic[_T]):
|
||||
# @fun.register(complex)
|
||||
# def _(arg, verbose=False): ...
|
||||
@overload
|
||||
def register(self, cls: Type[Any], func: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
|
||||
def register(self, cls: type[Any], func: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
|
||||
# @fun.register
|
||||
# def _(arg: int, verbose=False):
|
||||
@overload
|
||||
def register(self, cls: Callable[..., _T], func: None = ...) -> Callable[..., _T]: ...
|
||||
# fun.register(int, lambda x: x)
|
||||
@overload
|
||||
def register(self, cls: Type[Any], func: Callable[..., _T]) -> Callable[..., _T]: ...
|
||||
def register(self, cls: type[Any], func: Callable[..., _T]) -> Callable[..., _T]: ...
|
||||
def _clear_cache(self) -> None: ...
|
||||
def __call__(__self, *args: Any, **kwargs: Any) -> _T: ...
|
||||
|
||||
@@ -98,21 +98,21 @@ if sys.version_info >= (3, 8):
|
||||
func: Callable[..., _T]
|
||||
def __init__(self, func: Callable[..., _T]) -> None: ...
|
||||
@overload
|
||||
def register(self, cls: Type[Any], method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
|
||||
def register(self, cls: type[Any], method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
|
||||
@overload
|
||||
def register(self, cls: Callable[..., _T], method: None = ...) -> Callable[..., _T]: ...
|
||||
@overload
|
||||
def register(self, cls: Type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ...
|
||||
def register(self, cls: type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
|
||||
class cached_property(Generic[_T]):
|
||||
func: Callable[[Any], _T]
|
||||
attrname: str | None
|
||||
def __init__(self, func: Callable[[Any], _T]) -> None: ...
|
||||
@overload
|
||||
def __get__(self, instance: None, owner: Type[Any] | None = ...) -> cached_property[_T]: ...
|
||||
def __get__(self, instance: None, owner: type[Any] | None = ...) -> cached_property[_T]: ...
|
||||
@overload
|
||||
def __get__(self, instance: object, owner: Type[Any] | None = ...) -> _T: ...
|
||||
def __set_name__(self, owner: Type[Any], name: str) -> None: ...
|
||||
def __get__(self, instance: object, owner: type[Any] | None = ...) -> _T: ...
|
||||
def __set_name__(self, owner: type[Any], name: str) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
from typing import IO, Any, Container, Iterable, Sequence, Type, TypeVar, overload
|
||||
from typing import IO, Any, Container, Iterable, Sequence, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
class NullTranslations:
|
||||
@@ -45,7 +45,7 @@ if sys.version_info >= (3, 11):
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: Type[_T] = ...,
|
||||
class_: type[_T] = ...,
|
||||
fallback: Literal[False] = ...,
|
||||
) -> _T: ...
|
||||
@overload
|
||||
@@ -53,7 +53,7 @@ if sys.version_info >= (3, 11):
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: Type[Any] = ...,
|
||||
class_: type[Any] = ...,
|
||||
fallback: Literal[True] = ...,
|
||||
) -> Any: ...
|
||||
def install(domain: str, localedir: StrPath | None = ..., names: Container[str] | None = ...) -> None: ...
|
||||
@@ -73,7 +73,7 @@ else:
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: Type[_T] = ...,
|
||||
class_: type[_T] = ...,
|
||||
fallback: Literal[False] = ...,
|
||||
codeset: str | None = ...,
|
||||
) -> _T: ...
|
||||
@@ -82,7 +82,7 @@ else:
|
||||
domain: str,
|
||||
localedir: StrPath | None = ...,
|
||||
languages: Iterable[str] | None = ...,
|
||||
class_: Type[Any] = ...,
|
||||
class_: type[Any] = ...,
|
||||
fallback: Literal[True] = ...,
|
||||
codeset: str | None = ...,
|
||||
) -> Any: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ import sys
|
||||
import types
|
||||
from _typeshed import Self, WriteableBuffer
|
||||
from socket import socket
|
||||
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, Mapping, Protocol, Type, TypeVar, Union, overload
|
||||
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, Mapping, Protocol, TypeVar, Union, overload
|
||||
|
||||
_DataType = Union[bytes, IO[Any], Iterable[bytes], str]
|
||||
_T = TypeVar("_T")
|
||||
@@ -107,7 +107,7 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): # type: ignore # argument disp
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
|
||||
) -> bool | None: ...
|
||||
def info(self) -> email.message.Message: ...
|
||||
def geturl(self) -> str: ...
|
||||
@@ -135,7 +135,7 @@ class HTTPConnection:
|
||||
auto_open: int # undocumented
|
||||
debuglevel: int
|
||||
default_port: int # undocumented
|
||||
response_class: Type[HTTPResponse] # undocumented
|
||||
response_class: type[HTTPResponse] # undocumented
|
||||
timeout: float | None
|
||||
host: str
|
||||
port: int
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ from _typeshed import Self
|
||||
from socket import socket as _socket
|
||||
from ssl import SSLContext, SSLSocket
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, Callable, Pattern, Type, Union
|
||||
from typing import IO, Any, Callable, Pattern, Union
|
||||
from typing_extensions import Literal
|
||||
|
||||
# TODO: Commands should use their actual return types, not this type alias.
|
||||
@@ -17,9 +17,9 @@ _AnyResponseData = Union[list[None], list[Union[bytes, tuple[bytes, bytes]]]]
|
||||
_list = list # conflicts with a method named "list"
|
||||
|
||||
class IMAP4:
|
||||
error: Type[Exception]
|
||||
abort: Type[Exception]
|
||||
readonly: Type[Exception]
|
||||
error: type[Exception]
|
||||
abort: type[Exception]
|
||||
readonly: type[Exception]
|
||||
mustquote: Pattern[str]
|
||||
debug: int
|
||||
state: str
|
||||
@@ -63,7 +63,7 @@ class IMAP4:
|
||||
def deleteacl(self, mailbox: str, who: str) -> _CommandResults: ...
|
||||
def enable(self, capability: str) -> _CommandResults: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, t: Type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
def expunge(self) -> _CommandResults: ...
|
||||
def fetch(self, message_set: str, message_parts: str) -> tuple[str, _AnyResponseData]: ...
|
||||
def getacl(self, mailbox: str) -> _CommandResults: ...
|
||||
|
||||
+8
-8
@@ -23,7 +23,7 @@ from types import (
|
||||
if sys.version_info >= (3, 7):
|
||||
from types import ClassMethodDescriptorType, WrapperDescriptorType, MemberDescriptorType, MethodDescriptorType
|
||||
|
||||
from typing import Any, ClassVar, Coroutine, NamedTuple, Protocol, Type, TypeVar, Union
|
||||
from typing import Any, ClassVar, Coroutine, NamedTuple, Protocol, TypeVar, Union
|
||||
from typing_extensions import Literal, TypeGuard
|
||||
|
||||
#
|
||||
@@ -58,7 +58,7 @@ modulesbyfile: dict[str, Any]
|
||||
def getmembers(object: object, predicate: Callable[[Any], bool] | None = ...) -> list[tuple[str, Any]]: ...
|
||||
def getmodulename(path: str) -> str | None: ...
|
||||
def ismodule(object: object) -> TypeGuard[ModuleType]: ...
|
||||
def isclass(object: object) -> TypeGuard[Type[Any]]: ...
|
||||
def isclass(object: object) -> TypeGuard[type[Any]]: ...
|
||||
def ismethod(object: object) -> TypeGuard[MethodType]: ...
|
||||
def isfunction(object: object) -> TypeGuard[FunctionType]: ...
|
||||
|
||||
@@ -125,7 +125,7 @@ def isdatadescriptor(object: object) -> TypeGuard[_SupportsSet[Any, Any] | _Supp
|
||||
#
|
||||
# Retrieving source code
|
||||
#
|
||||
_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any]]
|
||||
_SourceObjectType = Union[ModuleType, type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any]]
|
||||
|
||||
def findsource(object: _SourceObjectType) -> tuple[list[str], int]: ...
|
||||
def getabsfile(object: _SourceObjectType, _filename: str | None = ...) -> str: ...
|
||||
@@ -172,7 +172,7 @@ class Signature:
|
||||
def bind(self, *args: Any, **kwargs: Any) -> BoundArguments: ...
|
||||
def bind_partial(self, *args: Any, **kwargs: Any) -> BoundArguments: ...
|
||||
def replace(
|
||||
self: Self, *, parameters: Sequence[Parameter] | Type[_void] | None = ..., return_annotation: Any = ...
|
||||
self: Self, *, parameters: Sequence[Parameter] | type[_void] | None = ..., return_annotation: Any = ...
|
||||
) -> Self: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@classmethod
|
||||
@@ -191,7 +191,7 @@ class Signature:
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def get_annotations(
|
||||
obj: Callable[..., Any] | Type[Any] | ModuleType,
|
||||
obj: Callable[..., Any] | type[Any] | ModuleType,
|
||||
*,
|
||||
globals: Mapping[str, Any] | None = ...,
|
||||
locals: Mapping[str, Any] | None = ...,
|
||||
@@ -230,8 +230,8 @@ class Parameter:
|
||||
def replace(
|
||||
self: Self,
|
||||
*,
|
||||
name: str | Type[_void] = ...,
|
||||
kind: _ParameterKind | Type[_void] = ...,
|
||||
name: str | type[_void] = ...,
|
||||
kind: _ParameterKind | type[_void] = ...,
|
||||
default: Any = ...,
|
||||
annotation: Any = ...,
|
||||
) -> Self: ...
|
||||
@@ -252,7 +252,7 @@ class BoundArguments:
|
||||
# seem to be supporting this at the moment:
|
||||
# _ClassTreeItem = list[_ClassTreeItem] | Tuple[type, Tuple[type, ...]]
|
||||
def getclasstree(classes: list[type], unique: bool = ...) -> list[Any]: ...
|
||||
def walktree(classes: list[type], children: dict[Type[Any], list[type]], parent: Type[Any] | None) -> list[Any]: ...
|
||||
def walktree(classes: list[type], children: dict[type[Any], list[type]], parent: type[Any] | None) -> list[Any]: ...
|
||||
|
||||
class Arguments(NamedTuple):
|
||||
args: list[str]
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import sys
|
||||
from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer
|
||||
from os import _Opener
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, TextIO, Type
|
||||
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, TextIO
|
||||
|
||||
DEFAULT_BUFFER_SIZE: int
|
||||
|
||||
@@ -26,7 +26,7 @@ class IOBase:
|
||||
def __next__(self) -> bytes: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
def close(self) -> None: ...
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
@@ -9,7 +9,6 @@ from typing import (
|
||||
SupportsComplex,
|
||||
SupportsFloat,
|
||||
SupportsInt,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
@@ -68,7 +67,7 @@ class chain(Iterator[_T], Generic[_T]):
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
@classmethod
|
||||
# We use Type and not Type[_S] to not lose the type inference from __iterable
|
||||
def from_iterable(cls: Type[Any], __iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ...
|
||||
def from_iterable(cls: type[Any], __iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import SupportsRead
|
||||
from typing import IO, Any, Callable, Type
|
||||
from typing import IO, Any, Callable
|
||||
|
||||
from .decoder import JSONDecodeError as JSONDecodeError, JSONDecoder as JSONDecoder
|
||||
from .encoder import JSONEncoder as JSONEncoder
|
||||
@@ -11,7 +11,7 @@ def dumps(
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
cls: Type[JSONEncoder] | None = ...,
|
||||
cls: type[JSONEncoder] | None = ...,
|
||||
indent: None | int | str = ...,
|
||||
separators: tuple[str, str] | None = ...,
|
||||
default: Callable[[Any], Any] | None = ...,
|
||||
@@ -26,7 +26,7 @@ def dump(
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
cls: Type[JSONEncoder] | None = ...,
|
||||
cls: type[JSONEncoder] | None = ...,
|
||||
indent: None | int | str = ...,
|
||||
separators: tuple[str, str] | None = ...,
|
||||
default: Callable[[Any], Any] | None = ...,
|
||||
@@ -36,7 +36,7 @@ def dump(
|
||||
def loads(
|
||||
s: str | bytes,
|
||||
*,
|
||||
cls: Type[JSONDecoder] | None = ...,
|
||||
cls: type[JSONDecoder] | None = ...,
|
||||
object_hook: Callable[[dict[Any, Any]], Any] | None = ...,
|
||||
parse_float: Callable[[str], Any] | None = ...,
|
||||
parse_int: Callable[[str], Any] | None = ...,
|
||||
@@ -47,7 +47,7 @@ def loads(
|
||||
def load(
|
||||
fp: SupportsRead[str | bytes],
|
||||
*,
|
||||
cls: Type[JSONDecoder] | None = ...,
|
||||
cls: type[JSONDecoder] | None = ...,
|
||||
object_hook: Callable[[dict[Any, Any]], Any] | None = ...,
|
||||
parse_float: Callable[[str], Any] | None = ...,
|
||||
parse_int: Callable[[str], Any] | None = ...,
|
||||
|
||||
@@ -6,10 +6,10 @@ from io import TextIOWrapper
|
||||
from string import Template
|
||||
from time import struct_time
|
||||
from types import FrameType, TracebackType
|
||||
from typing import Any, ClassVar, Generic, Optional, Pattern, TextIO, Type, TypeVar, Union, overload
|
||||
from typing import Any, ClassVar, Generic, Optional, Pattern, TextIO, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_SysExcInfoType = Union[tuple[Type[BaseException], BaseException, Optional[TracebackType]], tuple[None, None, None]]
|
||||
_SysExcInfoType = Union[tuple[type[BaseException], BaseException, Optional[TracebackType]], tuple[None, None, None]]
|
||||
_ExcInfoType = Union[None, bool, _SysExcInfoType, BaseException]
|
||||
_ArgsType = Union[tuple[object, ...], Mapping[str, object]]
|
||||
_FilterType = Union[Filter, Callable[[LogRecord], int]]
|
||||
@@ -39,11 +39,11 @@ class Manager: # undocumented
|
||||
disable: int
|
||||
emittedNoHandlerWarning: bool
|
||||
loggerDict: dict[str, Logger | PlaceHolder]
|
||||
loggerClass: Type[Logger] | None
|
||||
loggerClass: type[Logger] | None
|
||||
logRecordFactory: Callable[..., LogRecord] | None
|
||||
def __init__(self, rootnode: RootLogger) -> None: ...
|
||||
def getLogger(self, name: str) -> Logger: ...
|
||||
def setLoggerClass(self, klass: Type[Logger]) -> None: ...
|
||||
def setLoggerClass(self, klass: type[Logger]) -> None: ...
|
||||
def setLogRecordFactory(self, factory: Callable[..., LogRecord]) -> None: ...
|
||||
|
||||
class Logger(Filterer):
|
||||
@@ -546,7 +546,7 @@ class LoggerAdapter(Generic[_L]):
|
||||
def name(self) -> str: ... # undocumented
|
||||
|
||||
def getLogger(name: str | None = ...) -> Logger: ...
|
||||
def getLoggerClass() -> Type[Logger]: ...
|
||||
def getLoggerClass() -> type[Logger]: ...
|
||||
def getLogRecordFactory() -> Callable[..., LogRecord]: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
@@ -703,7 +703,7 @@ else:
|
||||
) -> None: ...
|
||||
|
||||
def shutdown(handlerList: Sequence[Any] = ...) -> None: ... # handlerList is undocumented
|
||||
def setLoggerClass(klass: Type[Logger]) -> None: ...
|
||||
def setLoggerClass(klass: type[Logger]) -> None: ...
|
||||
def captureWarnings(capture: bool) -> None: ...
|
||||
def setLogRecordFactory(factory: Callable[..., LogRecord]) -> None: ...
|
||||
|
||||
|
||||
+2
-17
@@ -2,22 +2,7 @@ import email.message
|
||||
import sys
|
||||
from _typeshed import Self, StrOrBytesPath
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
IO,
|
||||
Any,
|
||||
AnyStr,
|
||||
Callable,
|
||||
Generic,
|
||||
Iterable,
|
||||
Iterator,
|
||||
Mapping,
|
||||
Protocol,
|
||||
Sequence,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Mapping, Protocol, Sequence, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -184,7 +169,7 @@ class _ProxyFile(Generic[AnyStr]):
|
||||
def seek(self, offset: int, whence: int = ...) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
def __exit__(self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
def readable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
def seekable(self) -> bool: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from types import ModuleType
|
||||
from typing import Any, Container, Iterable, Sequence, Type
|
||||
from typing import Any, Container, Iterable, Sequence
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.platform == "win32":
|
||||
@@ -34,8 +34,8 @@ if sys.platform == "win32":
|
||||
def change_sequence(
|
||||
seq: Sequence[tuple[str, str | None, int]],
|
||||
action: str,
|
||||
seqno: int | Type[_Unspecified] = ...,
|
||||
cond: str | Type[_Unspecified] = ...,
|
||||
seqno: int | type[_Unspecified] = ...,
|
||||
cond: str | type[_Unspecified] = ...,
|
||||
) -> None: ...
|
||||
def add_data(db: _Database, table: str, values: Iterable[tuple[Any, ...]]) -> None: ...
|
||||
def add_stream(db: _Database, name: str, path: str) -> None: ...
|
||||
|
||||
@@ -2,7 +2,7 @@ import socket
|
||||
import sys
|
||||
import types
|
||||
from _typeshed import Self
|
||||
from typing import Any, Iterable, Type, Union
|
||||
from typing import Any, Iterable, Union
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import SupportsIndex
|
||||
@@ -31,7 +31,7 @@ class _ConnectionBase:
|
||||
def poll(self, timeout: float | None = ...) -> bool: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
class Connection(_ConnectionBase): ...
|
||||
@@ -51,7 +51,7 @@ class Listener:
|
||||
def last_accepted(self) -> _Address | None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
def deliver_challenge(connection: Connection, authkey: bytes) -> None: ...
|
||||
|
||||
@@ -8,7 +8,7 @@ from multiprocessing import queues, synchronize
|
||||
from multiprocessing.pool import Pool as _Pool
|
||||
from multiprocessing.process import BaseProcess
|
||||
from multiprocessing.sharedctypes import SynchronizedArray, SynchronizedBase
|
||||
from typing import Any, Type, TypeVar, Union, overload
|
||||
from typing import Any, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_LockLike = Union[synchronize.Lock, synchronize.RLock]
|
||||
@@ -20,11 +20,11 @@ class TimeoutError(ProcessError): ...
|
||||
class AuthenticationError(ProcessError): ...
|
||||
|
||||
class BaseContext:
|
||||
Process: Type[BaseProcess]
|
||||
ProcessError: Type[Exception]
|
||||
BufferTooShort: Type[Exception]
|
||||
TimeoutError: Type[Exception]
|
||||
AuthenticationError: Type[Exception]
|
||||
Process: type[BaseProcess]
|
||||
ProcessError: type[Exception]
|
||||
BufferTooShort: type[Exception]
|
||||
TimeoutError: type[Exception]
|
||||
AuthenticationError: type[Exception]
|
||||
|
||||
# N.B. The methods below are applied at runtime to generate
|
||||
# multiprocessing.*, so the signatures should be identical (modulo self).
|
||||
@@ -60,26 +60,26 @@ class BaseContext:
|
||||
maxtasksperchild: int | None = ...,
|
||||
) -> _Pool: ...
|
||||
@overload
|
||||
def RawValue(self, typecode_or_type: Type[_CT], *args: Any) -> _CT: ...
|
||||
def RawValue(self, typecode_or_type: type[_CT], *args: Any) -> _CT: ...
|
||||
@overload
|
||||
def RawValue(self, typecode_or_type: str, *args: Any) -> Any: ...
|
||||
@overload
|
||||
def RawArray(self, typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ...
|
||||
def RawArray(self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ...
|
||||
@overload
|
||||
def RawArray(self, typecode_or_type: str, size_or_initializer: int | Sequence[Any]) -> Any: ...
|
||||
@overload
|
||||
def Value(self, typecode_or_type: Type[_CT], *args: Any, lock: Literal[False]) -> _CT: ...
|
||||
def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[False]) -> _CT: ...
|
||||
@overload
|
||||
def Value(self, typecode_or_type: Type[_CT], *args: Any, lock: Literal[True] | _LockLike) -> SynchronizedBase[_CT]: ...
|
||||
def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike) -> SynchronizedBase[_CT]: ...
|
||||
@overload
|
||||
def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike) -> SynchronizedBase[Any]: ...
|
||||
@overload
|
||||
def Value(self, typecode_or_type: str | Type[_CData], *args: Any, lock: bool | _LockLike = ...) -> Any: ...
|
||||
def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = ...) -> Any: ...
|
||||
@overload
|
||||
def Array(self, typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False]) -> _CT: ...
|
||||
def Array(self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False]) -> _CT: ...
|
||||
@overload
|
||||
def Array(
|
||||
self, typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike
|
||||
self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike
|
||||
) -> SynchronizedArray[_CT]: ...
|
||||
@overload
|
||||
def Array(
|
||||
@@ -87,7 +87,7 @@ class BaseContext:
|
||||
) -> SynchronizedArray[Any]: ...
|
||||
@overload
|
||||
def Array(
|
||||
self, typecode_or_type: str | Type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = ...
|
||||
self, typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = ...
|
||||
) -> Any: ...
|
||||
def freeze_support(self) -> None: ...
|
||||
def get_logger(self) -> Logger: ...
|
||||
@@ -127,7 +127,7 @@ class Process(BaseProcess):
|
||||
def _Popen(process_obj: BaseProcess) -> DefaultContext: ...
|
||||
|
||||
class DefaultContext(BaseContext):
|
||||
Process: Type[multiprocessing.Process]
|
||||
Process: type[multiprocessing.Process]
|
||||
def __init__(self, context: BaseContext) -> None: ...
|
||||
def set_start_method(self, method: str | None, force: bool = ...) -> None: ...
|
||||
def get_start_method(self, allow_none: bool = ...) -> str: ...
|
||||
@@ -150,13 +150,13 @@ if sys.platform != "win32":
|
||||
def _Popen(process_obj: BaseProcess) -> Any: ...
|
||||
class ForkContext(BaseContext):
|
||||
_name: str
|
||||
Process: Type[ForkProcess]
|
||||
Process: type[ForkProcess]
|
||||
class SpawnContext(BaseContext):
|
||||
_name: str
|
||||
Process: Type[SpawnProcess]
|
||||
Process: type[SpawnProcess]
|
||||
class ForkServerContext(BaseContext):
|
||||
_name: str
|
||||
Process: Type[ForkServerProcess]
|
||||
Process: type[ForkServerProcess]
|
||||
|
||||
else:
|
||||
class SpawnProcess(BaseProcess):
|
||||
@@ -165,7 +165,7 @@ else:
|
||||
def _Popen(process_obj: BaseProcess) -> Any: ...
|
||||
class SpawnContext(BaseContext):
|
||||
_name: str
|
||||
Process: Type[SpawnProcess]
|
||||
Process: type[SpawnProcess]
|
||||
|
||||
def _force_start_method(method: str) -> None: ...
|
||||
def get_spawning_popen() -> Any | None: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from _typeshed import Self
|
||||
from queue import Queue
|
||||
from types import TracebackType
|
||||
from typing import Any, Type, Union
|
||||
from typing import Any, Union
|
||||
|
||||
families: list[None]
|
||||
|
||||
@@ -16,7 +16,7 @@ class Connection:
|
||||
send_bytes: Any
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def __init__(self, _in: Any, _out: Any) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
@@ -28,7 +28,7 @@ class Listener:
|
||||
def address(self) -> Queue[Any] | None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def __init__(self, address: _Address | None = ..., family: int | None = ..., backlog: int = ...) -> None: ...
|
||||
def accept(self) -> Connection: ...
|
||||
|
||||
@@ -3,25 +3,25 @@ from collections.abc import Callable, Iterable, Sequence
|
||||
from ctypes import _CData, _SimpleCData, c_char
|
||||
from multiprocessing.context import BaseContext
|
||||
from multiprocessing.synchronize import _LockLike
|
||||
from typing import Any, Generic, Protocol, Type, TypeVar, overload
|
||||
from typing import Any, Generic, Protocol, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_CT = TypeVar("_CT", bound=_CData)
|
||||
|
||||
@overload
|
||||
def RawValue(typecode_or_type: Type[_CT], *args: Any) -> _CT: ...
|
||||
def RawValue(typecode_or_type: type[_CT], *args: Any) -> _CT: ...
|
||||
@overload
|
||||
def RawValue(typecode_or_type: str, *args: Any) -> Any: ...
|
||||
@overload
|
||||
def RawArray(typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ...
|
||||
def RawArray(typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ...
|
||||
@overload
|
||||
def RawArray(typecode_or_type: str, size_or_initializer: int | Sequence[Any]) -> Any: ...
|
||||
@overload
|
||||
def Value(typecode_or_type: Type[_CT], *args: Any, lock: Literal[False], ctx: BaseContext | None = ...) -> _CT: ...
|
||||
def Value(typecode_or_type: type[_CT], *args: Any, lock: Literal[False], ctx: BaseContext | None = ...) -> _CT: ...
|
||||
@overload
|
||||
def Value(
|
||||
typecode_or_type: Type[_CT], *args: Any, lock: Literal[True] | _LockLike, ctx: BaseContext | None = ...
|
||||
typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike, ctx: BaseContext | None = ...
|
||||
) -> SynchronizedBase[_CT]: ...
|
||||
@overload
|
||||
def Value(
|
||||
@@ -29,15 +29,15 @@ def Value(
|
||||
) -> SynchronizedBase[Any]: ...
|
||||
@overload
|
||||
def Value(
|
||||
typecode_or_type: str | Type[_CData], *args: Any, lock: bool | _LockLike = ..., ctx: BaseContext | None = ...
|
||||
typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = ..., ctx: BaseContext | None = ...
|
||||
) -> Any: ...
|
||||
@overload
|
||||
def Array(
|
||||
typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False], ctx: BaseContext | None = ...
|
||||
typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False], ctx: BaseContext | None = ...
|
||||
) -> _CT: ...
|
||||
@overload
|
||||
def Array(
|
||||
typecode_or_type: Type[_CT],
|
||||
typecode_or_type: type[_CT],
|
||||
size_or_initializer: int | Sequence[Any],
|
||||
*,
|
||||
lock: Literal[True] | _LockLike,
|
||||
@@ -53,7 +53,7 @@ def Array(
|
||||
) -> SynchronizedArray[Any]: ...
|
||||
@overload
|
||||
def Array(
|
||||
typecode_or_type: str | Type[_CData],
|
||||
typecode_or_type: str | type[_CData],
|
||||
size_or_initializer: int | Sequence[Any],
|
||||
*,
|
||||
lock: bool | _LockLike = ...,
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
from typing import IO, Any, AnyStr, Callable, Iterable, Mapping, Sequence, Type, overload
|
||||
from typing import IO, Any, AnyStr, Callable, Iterable, Mapping, Sequence, overload
|
||||
|
||||
NO_DEFAULT: tuple[str, ...]
|
||||
SUPPRESS_HELP: str
|
||||
@@ -119,8 +119,8 @@ class OptionContainer:
|
||||
conflict_handler: str
|
||||
defaults: dict[str, Any]
|
||||
description: Any
|
||||
option_class: Type[Option]
|
||||
def __init__(self, option_class: Type[Option], conflict_handler: Any, description: Any) -> None: ...
|
||||
option_class: type[Option]
|
||||
def __init__(self, option_class: type[Option], conflict_handler: Any, description: Any) -> None: ...
|
||||
def _check_conflict(self, option: Any) -> None: ...
|
||||
def _create_option_mappings(self) -> None: ...
|
||||
def _share_option_mappings(self, parser: OptionParser) -> None: ...
|
||||
@@ -177,7 +177,7 @@ class OptionParser(OptionContainer):
|
||||
self,
|
||||
usage: str | None = ...,
|
||||
option_list: Iterable[Option] | None = ...,
|
||||
option_class: Type[Option] = ...,
|
||||
option_class: type[Option] = ...,
|
||||
version: str | None = ...,
|
||||
conflict_handler: str = ...,
|
||||
description: str | None = ...,
|
||||
|
||||
+6
-6
@@ -11,7 +11,7 @@ from _typeshed import (
|
||||
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
|
||||
from os import PathLike, stat_result
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, BinaryIO, Generator, Sequence, Type, TypeVar, overload
|
||||
from typing import IO, Any, BinaryIO, Generator, Sequence, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -28,7 +28,7 @@ class PurePath(PathLike[str]):
|
||||
suffix: str
|
||||
suffixes: list[str]
|
||||
stem: str
|
||||
def __new__(cls: Type[_P], *args: StrPath) -> _P: ...
|
||||
def __new__(cls: type[_P], *args: StrPath) -> _P: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __lt__(self, other: PurePath) -> bool: ...
|
||||
def __le__(self, other: PurePath) -> bool: ...
|
||||
@@ -61,13 +61,13 @@ class PurePosixPath(PurePath): ...
|
||||
class PureWindowsPath(PurePath): ...
|
||||
|
||||
class Path(PurePath):
|
||||
def __new__(cls: Type[_P], *args: StrPath, **kwargs: Any) -> _P: ...
|
||||
def __new__(cls: type[_P], *args: StrPath, **kwargs: Any) -> _P: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
@classmethod
|
||||
def cwd(cls: Type[_P]) -> _P: ...
|
||||
def cwd(cls: type[_P]) -> _P: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
def stat(self, *, follow_symlinks: bool = ...) -> stat_result: ...
|
||||
def chmod(self, mode: int, *, follow_symlinks: bool = ...) -> None: ...
|
||||
@@ -166,7 +166,7 @@ class Path(PurePath):
|
||||
else:
|
||||
def unlink(self) -> None: ...
|
||||
@classmethod
|
||||
def home(cls: Type[_P]) -> _P: ...
|
||||
def home(cls: type[_P]) -> _P: ...
|
||||
def absolute(self: _P) -> _P: ...
|
||||
def expanduser(self: _P) -> _P: ...
|
||||
def read_bytes(self) -> bytes: ...
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
import sys
|
||||
from typing import Any, Callable, ClassVar, Iterable, Iterator, Mapping, Optional, Protocol, Type, Union
|
||||
from typing import Any, Callable, ClassVar, Iterable, Iterator, Mapping, Optional, Protocol, Union
|
||||
from typing_extensions import final
|
||||
|
||||
HIGHEST_PROTOCOL: int
|
||||
DEFAULT_PROTOCOL: int
|
||||
|
||||
bytes_types: tuple[Type[Any], ...] # undocumented
|
||||
bytes_types: tuple[type[Any], ...] # undocumented
|
||||
|
||||
class _ReadableFileobj(Protocol):
|
||||
def read(self, __n: int) -> bytes: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import IO, Any, Callable, Iterator, MutableMapping, Type
|
||||
from typing import IO, Any, Callable, Iterator, MutableMapping
|
||||
|
||||
_Reader = Callable[[IO[bytes]], Any]
|
||||
bytes_types: tuple[Type[Any], ...]
|
||||
bytes_types: tuple[type[Any], ...]
|
||||
|
||||
UP_TO_NEWLINE: int
|
||||
TAKEN_FROM_ARGUMENT1: int
|
||||
@@ -108,9 +108,9 @@ long4: ArgumentDescriptor
|
||||
|
||||
class StackObject:
|
||||
name: str
|
||||
obtype: Type[Any] | tuple[Type[Any], ...]
|
||||
obtype: type[Any] | tuple[type[Any], ...]
|
||||
doc: str
|
||||
def __init__(self, name: str, obtype: Type[Any] | tuple[Type[Any], ...], doc: str) -> None: ...
|
||||
def __init__(self, name: str, obtype: type[Any] | tuple[type[Any], ...], doc: str) -> None: ...
|
||||
|
||||
pyint: StackObject
|
||||
pylong: StackObject
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import IO, Any, Mapping, MutableMapping, Type
|
||||
from typing import IO, Any, Mapping, MutableMapping
|
||||
|
||||
class PlistFormat(Enum):
|
||||
FMT_XML: int
|
||||
@@ -11,8 +11,8 @@ FMT_XML = PlistFormat.FMT_XML
|
||||
FMT_BINARY = PlistFormat.FMT_BINARY
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def load(fp: IO[bytes], *, fmt: PlistFormat | None = ..., dict_type: Type[MutableMapping[str, Any]] = ...) -> Any: ...
|
||||
def loads(value: bytes, *, fmt: PlistFormat | None = ..., dict_type: Type[MutableMapping[str, Any]] = ...) -> Any: ...
|
||||
def load(fp: IO[bytes], *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ...) -> Any: ...
|
||||
def loads(value: bytes, *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ...) -> Any: ...
|
||||
|
||||
else:
|
||||
def load(
|
||||
@@ -20,14 +20,14 @@ else:
|
||||
*,
|
||||
fmt: PlistFormat | None = ...,
|
||||
use_builtin_types: bool = ...,
|
||||
dict_type: Type[MutableMapping[str, Any]] = ...,
|
||||
dict_type: type[MutableMapping[str, Any]] = ...,
|
||||
) -> Any: ...
|
||||
def loads(
|
||||
value: bytes,
|
||||
*,
|
||||
fmt: PlistFormat | None = ...,
|
||||
use_builtin_types: bool = ...,
|
||||
dict_type: Type[MutableMapping[str, Any]] = ...,
|
||||
dict_type: type[MutableMapping[str, Any]] = ...,
|
||||
) -> Any: ...
|
||||
|
||||
def dump(
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import sys
|
||||
from typing import AnyStr, Type
|
||||
from typing import AnyStr
|
||||
|
||||
class PyCompileError(Exception):
|
||||
exc_type_name: str
|
||||
exc_value: BaseException
|
||||
file: str
|
||||
msg: str
|
||||
def __init__(self, exc_type: Type[BaseException], exc_value: BaseException, file: str, msg: str = ...) -> None: ...
|
||||
def __init__(self, exc_type: type[BaseException], exc_value: BaseException, file: str, msg: str = ...) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
import enum
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
from _typeshed import SupportsWrite
|
||||
from reprlib import Repr
|
||||
from types import MethodType, ModuleType, TracebackType
|
||||
from typing import IO, Any, AnyStr, Callable, Container, Mapping, MutableMapping, NoReturn, Optional, Type
|
||||
from typing import IO, Any, AnyStr, Callable, Container, Mapping, MutableMapping, NoReturn, Optional
|
||||
|
||||
# the return type of sys.exc_info(), used by ErrorDuringImport.__init__
|
||||
_Exc_Info = tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
_Exc_Info = tuple[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
|
||||
__author__: str
|
||||
__date__: str
|
||||
@@ -28,7 +28,7 @@ def synopsis(filename: str, cache: MutableMapping[str, tuple[int, str]] = ...) -
|
||||
|
||||
class ErrorDuringImport(Exception):
|
||||
filename: str
|
||||
exc: Type[BaseException] | None
|
||||
exc: type[BaseException] | None
|
||||
value: BaseException | None
|
||||
tb: TracebackType | None
|
||||
def __init__(self, filename: str, exc_info: _Exc_Info) -> None: ...
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import FileDescriptorLike, Self
|
||||
from types import TracebackType
|
||||
from typing import Any, Iterable, Type
|
||||
from typing import Any, Iterable
|
||||
|
||||
if sys.platform != "win32":
|
||||
PIPE_BUF: int
|
||||
@@ -105,7 +105,7 @@ if sys.platform == "linux":
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: Type[BaseException] | None = ...,
|
||||
exc_type: type[BaseException] | None = ...,
|
||||
exc_val: BaseException | None = ...,
|
||||
exc_tb: TracebackType | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
from _typeshed import Self
|
||||
from collections.abc import Iterator, MutableMapping
|
||||
from types import TracebackType
|
||||
from typing import Type, TypeVar, overload
|
||||
from typing import TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_VT = TypeVar("_VT")
|
||||
@@ -21,7 +21,7 @@ class Shelf(MutableMapping[str, _VT]):
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def sync(self) -> None: ...
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import asynchat
|
||||
import asyncore
|
||||
import socket
|
||||
from collections import defaultdict
|
||||
from typing import Any, Type
|
||||
from typing import Any
|
||||
|
||||
_Address = tuple[str, int] # (host, port)
|
||||
|
||||
@@ -56,7 +56,7 @@ class SMTPChannel(asynchat.async_chat):
|
||||
def smtp_EXPN(self, arg: str) -> None: ...
|
||||
|
||||
class SMTPServer(asyncore.dispatcher):
|
||||
channel_class: Type[SMTPChannel]
|
||||
channel_class: type[SMTPChannel]
|
||||
|
||||
data_size_limit: int
|
||||
enable_SMTPUTF8: bool
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ from email.message import Message as _Message
|
||||
from socket import socket
|
||||
from ssl import SSLContext
|
||||
from types import TracebackType
|
||||
from typing import Any, Pattern, Protocol, Sequence, Type, Union, overload
|
||||
from typing import Any, Pattern, Protocol, Sequence, Union, overload
|
||||
|
||||
_Reply = tuple[int, bytes]
|
||||
_SendErrs = dict[str, _Reply]
|
||||
@@ -79,7 +79,7 @@ class SMTP:
|
||||
) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def set_debuglevel(self, debuglevel: int) -> None: ...
|
||||
def connect(self, host: str = ..., port: int = ..., source_address: _SourceAddress | None = ...) -> _Reply: ...
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
import types
|
||||
from _typeshed import Self
|
||||
from socket import socket as _socket
|
||||
from typing import Any, BinaryIO, Callable, ClassVar, Type, Union
|
||||
from typing import Any, BinaryIO, Callable, ClassVar, Union
|
||||
|
||||
_RequestType = Union[_socket, tuple[bytes, _socket]]
|
||||
_AddressType = Union[tuple[str, int], str]
|
||||
@@ -32,7 +32,7 @@ class BaseServer:
|
||||
def verify_request(self, request: _RequestType, client_address: _AddressType) -> bool: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
|
||||
) -> None: ...
|
||||
def service_actions(self) -> None: ...
|
||||
def shutdown_request(self, request: _RequestType) -> None: ... # undocumented
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import Self, StrOrBytesPath
|
||||
from datetime import date, datetime, time
|
||||
from typing import Any, Callable, Generator, Iterable, Iterator, Protocol, Type, TypeVar
|
||||
from typing import Any, Callable, Generator, Iterable, Iterator, Protocol, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -94,7 +94,7 @@ if sys.version_info >= (3, 7):
|
||||
detect_types: int = ...,
|
||||
isolation_level: str | None = ...,
|
||||
check_same_thread: bool = ...,
|
||||
factory: Type[Connection] | None = ...,
|
||||
factory: type[Connection] | None = ...,
|
||||
cached_statements: int = ...,
|
||||
uri: bool = ...,
|
||||
) -> Connection: ...
|
||||
@@ -106,14 +106,14 @@ else:
|
||||
detect_types: int = ...,
|
||||
isolation_level: str | None = ...,
|
||||
check_same_thread: bool = ...,
|
||||
factory: Type[Connection] | None = ...,
|
||||
factory: type[Connection] | None = ...,
|
||||
cached_statements: int = ...,
|
||||
uri: bool = ...,
|
||||
) -> Connection: ...
|
||||
|
||||
def enable_callback_tracebacks(__enable: bool) -> None: ...
|
||||
def enable_shared_cache(enable: int) -> None: ...
|
||||
def register_adapter(__type: Type[_T], __caster: Callable[[_T], int | float | str | bytes]) -> None: ...
|
||||
def register_adapter(__type: type[_T], __caster: Callable[[_T], int | float | str | bytes]) -> None: ...
|
||||
def register_converter(__name: str, __converter: Callable[[bytes], Any]) -> None: ...
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
|
||||
+5
-5
@@ -2,7 +2,7 @@ import enum
|
||||
import socket
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer
|
||||
from typing import Any, Callable, ClassVar, Iterable, NamedTuple, Optional, Type, Union, overload
|
||||
from typing import Any, Callable, ClassVar, Iterable, NamedTuple, Optional, Union, overload
|
||||
from typing_extensions import Literal, TypedDict
|
||||
|
||||
_PCTRTT = tuple[tuple[str, str], ...]
|
||||
@@ -294,9 +294,9 @@ class _ASN1Object(NamedTuple):
|
||||
longname: str
|
||||
oid: str
|
||||
@classmethod
|
||||
def fromnid(cls: Type[Self], nid: int) -> Self: ...
|
||||
def fromnid(cls: type[Self], nid: int) -> Self: ...
|
||||
@classmethod
|
||||
def fromname(cls: Type[Self], name: str) -> Self: ...
|
||||
def fromname(cls: type[Self], name: str) -> Self: ...
|
||||
|
||||
class Purpose(_ASN1Object, enum.Enum):
|
||||
SERVER_AUTH: _ASN1Object
|
||||
@@ -391,8 +391,8 @@ class SSLContext:
|
||||
maximum_version: TLSVersion
|
||||
minimum_version: TLSVersion
|
||||
sni_callback: Callable[[SSLObject, str, SSLContext], None | int] | None
|
||||
sslobject_class: ClassVar[Type[SSLObject]]
|
||||
sslsocket_class: ClassVar[Type[SSLSocket]]
|
||||
sslobject_class: ClassVar[type[SSLObject]]
|
||||
sslsocket_class: ClassVar[type[SSLSocket]]
|
||||
if sys.version_info >= (3, 8):
|
||||
keylog_filename: str
|
||||
post_handshake_auth: bool
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
from _typeshed import SupportsRichComparisonT
|
||||
from decimal import Decimal
|
||||
from fractions import Fraction
|
||||
from typing import Any, Hashable, Iterable, NamedTuple, Sequence, SupportsFloat, Type, TypeVar, Union
|
||||
from typing import Any, Hashable, Iterable, NamedTuple, Sequence, SupportsFloat, TypeVar, Union
|
||||
|
||||
_T = TypeVar("_T")
|
||||
# Most functions in this module accept homogeneous collections of one of these types
|
||||
@@ -58,7 +58,7 @@ if sys.version_info >= (3, 8):
|
||||
@property
|
||||
def variance(self) -> float: ...
|
||||
@classmethod
|
||||
def from_samples(cls: Type[_T], data: Iterable[SupportsFloat]) -> _T: ...
|
||||
def from_samples(cls: type[_T], data: Iterable[SupportsFloat]) -> _T: ...
|
||||
def samples(self, n: int, *, seed: Any | None = ...) -> list[float]: ...
|
||||
def pdf(self, x: float) -> float: ...
|
||||
def cdf(self, x: float) -> float: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import Self, StrOrBytesPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Mapping, Sequence, Type, TypeVar, Union, overload
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Mapping, Sequence, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -1008,7 +1008,7 @@ class Popen(Generic[AnyStr]):
|
||||
def kill(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
+6
-6
@@ -5,13 +5,13 @@ from importlib.abc import PathEntryFinder
|
||||
from importlib.machinery import ModuleSpec
|
||||
from io import TextIOWrapper
|
||||
from types import FrameType, ModuleType, TracebackType
|
||||
from typing import Any, AsyncGenerator, Callable, NoReturn, Optional, Protocol, Sequence, TextIO, Type, TypeVar, Union, overload
|
||||
from typing import Any, AsyncGenerator, Callable, NoReturn, Optional, Protocol, Sequence, TextIO, TypeVar, Union, overload
|
||||
from typing_extensions import Literal, final
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
# The following type alias are stub-only and do not exist during runtime
|
||||
_ExcInfo = tuple[Type[BaseException], BaseException, TracebackType]
|
||||
_ExcInfo = tuple[type[BaseException], BaseException, TracebackType]
|
||||
_OptExcInfo = Union[_ExcInfo, tuple[None, None, None]]
|
||||
|
||||
# Intentionally omits one deprecated and one optional method of `importlib.abc.MetaPathFinder`
|
||||
@@ -31,12 +31,12 @@ if sys.platform == "win32":
|
||||
dllhandle: int
|
||||
dont_write_bytecode: bool
|
||||
displayhook: Callable[[object], Any]
|
||||
excepthook: Callable[[Type[BaseException], BaseException, TracebackType | None], Any]
|
||||
excepthook: Callable[[type[BaseException], BaseException, TracebackType | None], Any]
|
||||
exec_prefix: str
|
||||
executable: str
|
||||
float_repr_style: Literal["short", "legacy"]
|
||||
hexversion: int
|
||||
last_type: Type[BaseException] | None
|
||||
last_type: type[BaseException] | None
|
||||
last_value: BaseException | None
|
||||
last_traceback: TracebackType | None
|
||||
maxsize: int
|
||||
@@ -216,7 +216,7 @@ def _current_frames() -> dict[int, FrameType]: ...
|
||||
def _getframe(__depth: int = ...) -> FrameType: ...
|
||||
def _debugmallocstats() -> None: ...
|
||||
def __displayhook__(value: object) -> None: ...
|
||||
def __excepthook__(type_: Type[BaseException], value: BaseException, traceback: TracebackType | None) -> None: ...
|
||||
def __excepthook__(type_: type[BaseException], value: BaseException, traceback: TracebackType | None) -> None: ...
|
||||
def exc_info() -> _OptExcInfo: ...
|
||||
|
||||
# sys.exit() accepts an optional argument of anything printable
|
||||
@@ -294,7 +294,7 @@ if sys.version_info < (3, 9):
|
||||
if sys.version_info >= (3, 8):
|
||||
# Doesn't exist at runtime, but exported in the stubs so pytest etc. can annotate their code more easily.
|
||||
class UnraisableHookArgs:
|
||||
exc_type: Type[BaseException]
|
||||
exc_type: type[BaseException]
|
||||
exc_value: BaseException | None
|
||||
exc_traceback: TracebackType | None
|
||||
err_msg: str | None
|
||||
|
||||
+20
-20
@@ -5,7 +5,7 @@ from _typeshed import Self, StrOrBytesPath, StrPath
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping
|
||||
from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj
|
||||
from types import TracebackType
|
||||
from typing import IO, Protocol, Type, TypeVar, overload
|
||||
from typing import IO, Protocol, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_TF = TypeVar("_TF", bound=TarFile)
|
||||
@@ -78,7 +78,7 @@ def open(
|
||||
bufsize: int = ...,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
tarinfo: Type[TarInfo] | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
dereference: bool | None = ...,
|
||||
ignore_zeros: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
@@ -100,12 +100,12 @@ class TarFile:
|
||||
mode: Literal["r", "a", "w", "x"]
|
||||
fileobj: _Fileobj | None
|
||||
format: int | None
|
||||
tarinfo: Type[TarInfo]
|
||||
tarinfo: type[TarInfo]
|
||||
dereference: bool | None
|
||||
ignore_zeros: bool | None
|
||||
encoding: str | None
|
||||
errors: str
|
||||
fileobject: Type[ExFileObject]
|
||||
fileobject: type[ExFileObject]
|
||||
pax_headers: Mapping[str, str] | None
|
||||
debug: int | None
|
||||
errorlevel: int | None
|
||||
@@ -116,7 +116,7 @@ class TarFile:
|
||||
mode: Literal["r", "a", "w", "x"] = ...,
|
||||
fileobj: _Fileobj | None = ...,
|
||||
format: int | None = ...,
|
||||
tarinfo: Type[TarInfo] | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
dereference: bool | None = ...,
|
||||
ignore_zeros: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
@@ -128,19 +128,19 @@ class TarFile:
|
||||
) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[TarInfo]: ...
|
||||
@classmethod
|
||||
def open(
|
||||
cls: Type[_TF],
|
||||
cls: type[_TF],
|
||||
name: StrOrBytesPath | None = ...,
|
||||
mode: str = ...,
|
||||
fileobj: IO[bytes] | None = ..., # depends on mode
|
||||
bufsize: int = ...,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
tarinfo: Type[TarInfo] | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
dereference: bool | None = ...,
|
||||
ignore_zeros: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
@@ -151,14 +151,14 @@ class TarFile:
|
||||
) -> _TF: ...
|
||||
@classmethod
|
||||
def taropen(
|
||||
cls: Type[_TF],
|
||||
cls: type[_TF],
|
||||
name: StrOrBytesPath | None,
|
||||
mode: Literal["r", "a", "w", "x"] = ...,
|
||||
fileobj: _Fileobj | None = ...,
|
||||
*,
|
||||
compresslevel: int = ...,
|
||||
format: int | None = ...,
|
||||
tarinfo: Type[TarInfo] | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
dereference: bool | None = ...,
|
||||
ignore_zeros: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
@@ -169,14 +169,14 @@ class TarFile:
|
||||
@overload
|
||||
@classmethod
|
||||
def gzopen(
|
||||
cls: Type[_TF],
|
||||
cls: type[_TF],
|
||||
name: StrOrBytesPath | None,
|
||||
mode: Literal["r"] = ...,
|
||||
fileobj: _GzipReadableFileobj | None = ...,
|
||||
compresslevel: int = ...,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
tarinfo: Type[TarInfo] | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
dereference: bool | None = ...,
|
||||
ignore_zeros: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
@@ -187,14 +187,14 @@ class TarFile:
|
||||
@overload
|
||||
@classmethod
|
||||
def gzopen(
|
||||
cls: Type[_TF],
|
||||
cls: type[_TF],
|
||||
name: StrOrBytesPath | None,
|
||||
mode: Literal["w", "x"],
|
||||
fileobj: _GzipWritableFileobj | None = ...,
|
||||
compresslevel: int = ...,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
tarinfo: Type[TarInfo] | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
dereference: bool | None = ...,
|
||||
ignore_zeros: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
@@ -205,14 +205,14 @@ class TarFile:
|
||||
@overload
|
||||
@classmethod
|
||||
def bz2open(
|
||||
cls: Type[_TF],
|
||||
cls: type[_TF],
|
||||
name: StrOrBytesPath | None,
|
||||
mode: Literal["w", "x"],
|
||||
fileobj: _Bz2WritableFileobj | None = ...,
|
||||
compresslevel: int = ...,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
tarinfo: Type[TarInfo] | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
dereference: bool | None = ...,
|
||||
ignore_zeros: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
@@ -223,14 +223,14 @@ class TarFile:
|
||||
@overload
|
||||
@classmethod
|
||||
def bz2open(
|
||||
cls: Type[_TF],
|
||||
cls: type[_TF],
|
||||
name: StrOrBytesPath | None,
|
||||
mode: Literal["r"] = ...,
|
||||
fileobj: _Bz2ReadableFileobj | None = ...,
|
||||
compresslevel: int = ...,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
tarinfo: Type[TarInfo] | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
dereference: bool | None = ...,
|
||||
ignore_zeros: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
@@ -240,14 +240,14 @@ class TarFile:
|
||||
) -> _TF: ...
|
||||
@classmethod
|
||||
def xzopen(
|
||||
cls: Type[_TF],
|
||||
cls: type[_TF],
|
||||
name: StrOrBytesPath | None,
|
||||
mode: Literal["r", "w", "x"] = ...,
|
||||
fileobj: IO[bytes] | None = ...,
|
||||
preset: int | None = ...,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
tarinfo: Type[TarInfo] | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
dereference: bool | None = ...,
|
||||
ignore_zeros: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@ import os
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, Type, Union, overload
|
||||
from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -169,7 +169,7 @@ class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]):
|
||||
delete: bool
|
||||
def __init__(self, file: IO[AnyStr], name: str, delete: bool = ...) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, exc: Type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> bool | None: ...
|
||||
def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> bool | None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
def close(self) -> None: ...
|
||||
# These methods don't exist directly on this object, but
|
||||
@@ -293,7 +293,7 @@ class SpooledTemporaryFile(IO[AnyStr]):
|
||||
def rollover(self) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
# These methods are copied from the abstract methods of IO, because
|
||||
# SpooledTemporaryFile implements IO.
|
||||
@@ -346,7 +346,7 @@ class TemporaryDirectory(Generic[AnyStr]):
|
||||
def cleanup(self) -> None: ...
|
||||
def __enter__(self) -> AnyStr: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from types import FrameType, TracebackType
|
||||
from typing import Any, Callable, Iterable, Mapping, Optional, Type, TypeVar
|
||||
from typing import Any, Callable, Iterable, Mapping, Optional, TypeVar
|
||||
|
||||
# TODO recursive type
|
||||
_TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
|
||||
@@ -75,7 +75,7 @@ class Lock:
|
||||
def __init__(self) -> None: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
@@ -87,7 +87,7 @@ class _RLock:
|
||||
def release(self) -> None: ...
|
||||
__enter__ = acquire
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
|
||||
RLock = _RLock
|
||||
@@ -96,7 +96,7 @@ class Condition:
|
||||
def __init__(self, lock: Lock | _RLock | None = ...) -> None: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
@@ -109,7 +109,7 @@ class Condition:
|
||||
class Semaphore:
|
||||
def __init__(self, value: int = ...) -> None: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
def acquire(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ...
|
||||
def __enter__(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from enum import Enum
|
||||
from tkinter.constants import *
|
||||
from tkinter.font import _FontDescription
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, Generic, Mapping, Optional, Protocol, Sequence, Type, TypeVar, Union, overload
|
||||
from typing import Any, Callable, Generic, Mapping, Optional, Protocol, Sequence, TypeVar, Union, overload
|
||||
from typing_extensions import Literal, TypedDict
|
||||
|
||||
# Using anything from tkinter.font in this file means that 'import tkinter'
|
||||
@@ -571,7 +571,7 @@ class Wm:
|
||||
withdraw = wm_withdraw
|
||||
|
||||
class _ExceptionReportingCallback(Protocol):
|
||||
def __call__(self, __exc: Type[BaseException], __val: BaseException, __tb: TracebackType | None) -> Any: ...
|
||||
def __call__(self, __exc: type[BaseException], __val: BaseException, __tb: TracebackType | None) -> Any: ...
|
||||
|
||||
class Tk(Misc, Wm):
|
||||
master: None
|
||||
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import SupportsWrite
|
||||
from types import FrameType, TracebackType
|
||||
from typing import IO, Any, Generator, Iterable, Iterator, Mapping, Optional, Type, overload
|
||||
from typing import IO, Any, Generator, Iterable, Iterator, Mapping, Optional, overload
|
||||
|
||||
_PT = tuple[str, int, str, Optional[str]]
|
||||
|
||||
@@ -10,7 +10,7 @@ def print_tb(tb: TracebackType | None, limit: int | None = ..., file: IO[str] |
|
||||
if sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def print_exception(
|
||||
__exc: Type[BaseException] | None,
|
||||
__exc: type[BaseException] | None,
|
||||
value: BaseException | None = ...,
|
||||
tb: TracebackType | None = ...,
|
||||
limit: int | None = ...,
|
||||
@@ -23,7 +23,7 @@ if sys.version_info >= (3, 10):
|
||||
) -> None: ...
|
||||
@overload
|
||||
def format_exception(
|
||||
__exc: Type[BaseException] | None,
|
||||
__exc: type[BaseException] | None,
|
||||
value: BaseException | None = ...,
|
||||
tb: TracebackType | None = ...,
|
||||
limit: int | None = ...,
|
||||
@@ -34,7 +34,7 @@ if sys.version_info >= (3, 10):
|
||||
|
||||
else:
|
||||
def print_exception(
|
||||
etype: Type[BaseException] | None,
|
||||
etype: type[BaseException] | None,
|
||||
value: BaseException | None,
|
||||
tb: TracebackType | None,
|
||||
limit: int | None = ...,
|
||||
@@ -42,7 +42,7 @@ else:
|
||||
chain: bool = ...,
|
||||
) -> None: ...
|
||||
def format_exception(
|
||||
etype: Type[BaseException] | None,
|
||||
etype: type[BaseException] | None,
|
||||
value: BaseException | None,
|
||||
tb: TracebackType | None,
|
||||
limit: int | None = ...,
|
||||
@@ -60,10 +60,10 @@ def format_list(extracted_list: list[FrameSummary]) -> list[str]: ...
|
||||
def print_list(extracted_list: list[FrameSummary], file: SupportsWrite[str] | None = ...) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def format_exception_only(__exc: Type[BaseException] | None, value: BaseException | None = ...) -> list[str]: ...
|
||||
def format_exception_only(__exc: type[BaseException] | None, value: BaseException | None = ...) -> list[str]: ...
|
||||
|
||||
else:
|
||||
def format_exception_only(etype: Type[BaseException] | None, value: BaseException | None) -> list[str]: ...
|
||||
def format_exception_only(etype: type[BaseException] | None, value: BaseException | None) -> list[str]: ...
|
||||
|
||||
def format_exc(limit: int | None = ..., chain: bool = ...) -> str: ...
|
||||
def format_tb(tb: TracebackType | None, limit: int | None = ...) -> list[str]: ...
|
||||
@@ -77,7 +77,7 @@ class TracebackException:
|
||||
__context__: TracebackException
|
||||
__suppress_context__: bool
|
||||
stack: StackSummary
|
||||
exc_type: Type[BaseException]
|
||||
exc_type: type[BaseException]
|
||||
filename: str
|
||||
lineno: int
|
||||
text: str
|
||||
@@ -86,7 +86,7 @@ class TracebackException:
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(
|
||||
self,
|
||||
exc_type: Type[BaseException],
|
||||
exc_type: type[BaseException],
|
||||
exc_value: BaseException,
|
||||
exc_traceback: TracebackType | None,
|
||||
*,
|
||||
@@ -109,7 +109,7 @@ class TracebackException:
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
exc_type: Type[BaseException],
|
||||
exc_type: type[BaseException],
|
||||
exc_value: BaseException,
|
||||
exc_traceback: TracebackType | None,
|
||||
*,
|
||||
|
||||
+3
-4
@@ -16,7 +16,6 @@ from typing import (
|
||||
KeysView,
|
||||
Mapping,
|
||||
MutableSequence,
|
||||
Type,
|
||||
TypeVar,
|
||||
ValuesView,
|
||||
overload,
|
||||
@@ -220,7 +219,7 @@ class GeneratorType(Generator[_T_co, _T_contra, _V_co]):
|
||||
def send(self, __arg: _T_contra) -> _T_co: ...
|
||||
@overload
|
||||
def throw(
|
||||
self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
|
||||
self, __typ: type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
|
||||
) -> _T_co: ...
|
||||
@overload
|
||||
def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ...
|
||||
@@ -236,7 +235,7 @@ class AsyncGeneratorType(AsyncGenerator[_T_co, _T_contra]):
|
||||
def asend(self, __val: _T_contra) -> Awaitable[_T_co]: ...
|
||||
@overload
|
||||
def athrow(
|
||||
self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
|
||||
self, __typ: type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
|
||||
) -> Awaitable[_T_co]: ...
|
||||
@overload
|
||||
def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> Awaitable[_T_co]: ...
|
||||
@@ -257,7 +256,7 @@ class CoroutineType(Coroutine[_T_co, _T_contra, _V_co]):
|
||||
def send(self, __arg: _T_contra) -> _T_co: ...
|
||||
@overload
|
||||
def throw(
|
||||
self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
|
||||
self, __typ: type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
|
||||
) -> _T_co: ...
|
||||
@overload
|
||||
def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ...
|
||||
|
||||
@@ -31,7 +31,7 @@ from typing import (
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
_TC = TypeVar("_TC", bound=Type[object])
|
||||
_TC = TypeVar("_TC", bound=type[object])
|
||||
|
||||
class _SpecialForm:
|
||||
def __getitem__(self, typeargs: Any) -> Any: ...
|
||||
@@ -109,11 +109,11 @@ else:
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
class ParamSpec:
|
||||
__name__: str
|
||||
__bound__: Type[Any] | None
|
||||
__bound__: type[Any] | None
|
||||
__covariant__: bool
|
||||
__contravariant__: bool
|
||||
def __init__(
|
||||
self, name: str, *, bound: None | Type[Any] | str = ..., contravariant: bool = ..., covariant: bool = ...
|
||||
self, name: str, *, bound: None | type[Any] | str = ..., contravariant: bool = ..., covariant: bool = ...
|
||||
) -> None: ...
|
||||
@property
|
||||
def args(self) -> ParamSpecArgs: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import ClassVar, Generic, NamedTuple, Type, TypeVar
|
||||
from typing import ClassVar, Generic, NamedTuple, TypeVar
|
||||
from unittest.case import TestCase
|
||||
|
||||
_L = TypeVar("_L", None, _LoggingWatcher)
|
||||
@@ -23,5 +23,5 @@ class _AssertLogsContext(Generic[_L]):
|
||||
def __init__(self, test_case: TestCase, logger_name: str, level: int) -> None: ...
|
||||
def __enter__(self) -> _L: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
|
||||
+18
-19
@@ -19,7 +19,6 @@ from typing import (
|
||||
NoReturn,
|
||||
Pattern,
|
||||
Sequence,
|
||||
Type,
|
||||
TypeVar,
|
||||
overload,
|
||||
)
|
||||
@@ -55,7 +54,7 @@ else:
|
||||
def __init__(self, test_case: TestCase, logger_name: str, level: int) -> None: ...
|
||||
def __enter__(self) -> _LoggingWatcher: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
@@ -71,7 +70,7 @@ class SkipTest(Exception):
|
||||
def __init__(self, reason: str) -> None: ...
|
||||
|
||||
class TestCase:
|
||||
failureException: Type[BaseException]
|
||||
failureException: type[BaseException]
|
||||
longMessage: bool
|
||||
maxDiff: int | None
|
||||
# undocumented
|
||||
@@ -110,17 +109,17 @@ class TestCase:
|
||||
@overload
|
||||
def assertRaises( # type: ignore[misc]
|
||||
self,
|
||||
expected_exception: Type[BaseException] | tuple[Type[BaseException], ...],
|
||||
expected_exception: type[BaseException] | tuple[type[BaseException], ...],
|
||||
callable: Callable[..., Any],
|
||||
*args: Any,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def assertRaises(self, expected_exception: Type[_E] | tuple[Type[_E], ...], msg: Any = ...) -> _AssertRaisesContext[_E]: ...
|
||||
def assertRaises(self, expected_exception: type[_E] | tuple[type[_E], ...], msg: Any = ...) -> _AssertRaisesContext[_E]: ...
|
||||
@overload
|
||||
def assertRaisesRegex( # type: ignore[misc]
|
||||
self,
|
||||
expected_exception: Type[BaseException] | tuple[Type[BaseException], ...],
|
||||
expected_exception: type[BaseException] | tuple[type[BaseException], ...],
|
||||
expected_regex: str | bytes | Pattern[str] | Pattern[bytes],
|
||||
callable: Callable[..., Any],
|
||||
*args: Any,
|
||||
@@ -129,20 +128,20 @@ class TestCase:
|
||||
@overload
|
||||
def assertRaisesRegex(
|
||||
self,
|
||||
expected_exception: Type[_E] | tuple[Type[_E], ...],
|
||||
expected_exception: type[_E] | tuple[type[_E], ...],
|
||||
expected_regex: str | bytes | Pattern[str] | Pattern[bytes],
|
||||
msg: Any = ...,
|
||||
) -> _AssertRaisesContext[_E]: ...
|
||||
@overload
|
||||
def assertWarns( # type: ignore[misc]
|
||||
self, expected_warning: Type[Warning] | tuple[Type[Warning], ...], callable: Callable[..., Any], *args: Any, **kwargs: Any
|
||||
self, expected_warning: type[Warning] | tuple[type[Warning], ...], callable: Callable[..., Any], *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
@overload
|
||||
def assertWarns(self, expected_warning: Type[Warning] | tuple[Type[Warning], ...], msg: Any = ...) -> _AssertWarnsContext: ...
|
||||
def assertWarns(self, expected_warning: type[Warning] | tuple[type[Warning], ...], msg: Any = ...) -> _AssertWarnsContext: ...
|
||||
@overload
|
||||
def assertWarnsRegex( # type: ignore[misc]
|
||||
self,
|
||||
expected_warning: Type[Warning] | tuple[Type[Warning], ...],
|
||||
expected_warning: type[Warning] | tuple[type[Warning], ...],
|
||||
expected_regex: str | bytes | Pattern[str] | Pattern[bytes],
|
||||
callable: Callable[..., Any],
|
||||
*args: Any,
|
||||
@@ -151,7 +150,7 @@ class TestCase:
|
||||
@overload
|
||||
def assertWarnsRegex(
|
||||
self,
|
||||
expected_warning: Type[Warning] | tuple[Type[Warning], ...],
|
||||
expected_warning: type[Warning] | tuple[type[Warning], ...],
|
||||
expected_regex: str | bytes | Pattern[str] | Pattern[bytes],
|
||||
msg: Any = ...,
|
||||
) -> _AssertWarnsContext: ...
|
||||
@@ -193,10 +192,10 @@ class TestCase:
|
||||
def assertRegex(self, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ...
|
||||
def assertNotRegex(self, text: AnyStr, unexpected_regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ...
|
||||
def assertCountEqual(self, first: Iterable[Any], second: Iterable[Any], msg: Any = ...) -> None: ...
|
||||
def addTypeEqualityFunc(self, typeobj: Type[Any], function: Callable[..., None]) -> None: ...
|
||||
def addTypeEqualityFunc(self, typeobj: type[Any], function: Callable[..., None]) -> None: ...
|
||||
def assertMultiLineEqual(self, first: str, second: str, msg: Any = ...) -> None: ...
|
||||
def assertSequenceEqual(
|
||||
self, seq1: Sequence[Any], seq2: Sequence[Any], msg: Any = ..., seq_type: Type[Sequence[Any]] | None = ...
|
||||
self, seq1: Sequence[Any], seq2: Sequence[Any], msg: Any = ..., seq_type: type[Sequence[Any]] | None = ...
|
||||
) -> None: ...
|
||||
def assertListEqual(self, list1: list[Any], list2: list[Any], msg: Any = ...) -> None: ...
|
||||
def assertTupleEqual(self, tuple1: tuple[Any, ...], tuple2: tuple[Any, ...], msg: Any = ...) -> None: ...
|
||||
@@ -230,13 +229,13 @@ class TestCase:
|
||||
@overload
|
||||
def failUnlessRaises( # type: ignore[misc]
|
||||
self,
|
||||
exception: Type[BaseException] | tuple[Type[BaseException], ...],
|
||||
exception: type[BaseException] | tuple[type[BaseException], ...],
|
||||
callable: Callable[..., Any] = ...,
|
||||
*args: Any,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def failUnlessRaises(self, exception: Type[_E] | tuple[Type[_E], ...], msg: Any = ...) -> _AssertRaisesContext[_E]: ...
|
||||
def failUnlessRaises(self, exception: type[_E] | tuple[type[_E], ...], msg: Any = ...) -> _AssertRaisesContext[_E]: ...
|
||||
def failUnlessAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ...
|
||||
def assertAlmostEquals(
|
||||
self, first: float, second: float, places: int = ..., msg: Any = ..., delta: float = ...
|
||||
@@ -250,7 +249,7 @@ class TestCase:
|
||||
@overload
|
||||
def assertRaisesRegexp( # type: ignore[misc]
|
||||
self,
|
||||
exception: Type[BaseException] | tuple[Type[BaseException], ...],
|
||||
exception: type[BaseException] | tuple[type[BaseException], ...],
|
||||
expected_regex: str | bytes | Pattern[str] | Pattern[bytes],
|
||||
callable: Callable[..., Any],
|
||||
*args: Any,
|
||||
@@ -259,7 +258,7 @@ class TestCase:
|
||||
@overload
|
||||
def assertRaisesRegexp(
|
||||
self,
|
||||
exception: Type[_E] | tuple[Type[_E], ...],
|
||||
exception: type[_E] | tuple[type[_E], ...],
|
||||
expected_regex: str | bytes | Pattern[str] | Pattern[bytes],
|
||||
msg: Any = ...,
|
||||
) -> _AssertRaisesContext[_E]: ...
|
||||
@@ -281,7 +280,7 @@ class _AssertRaisesContext(Generic[_E]):
|
||||
exception: _E
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
@@ -293,5 +292,5 @@ class _AssertWarnsContext:
|
||||
warnings: list[WarningMessage]
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ import unittest.case
|
||||
import unittest.result
|
||||
import unittest.suite
|
||||
from types import ModuleType
|
||||
from typing import Any, Callable, Pattern, Sequence, Type
|
||||
from typing import Any, Callable, Pattern, Sequence
|
||||
|
||||
_SortComparisonMethod = Callable[[str, str], int]
|
||||
_SuiteClass = Callable[[list[unittest.case.TestCase]], unittest.suite.TestSuite]
|
||||
@@ -11,7 +11,7 @@ _SuiteClass = Callable[[list[unittest.case.TestCase]], unittest.suite.TestSuite]
|
||||
VALID_MODULE_NAME: Pattern[str]
|
||||
|
||||
class TestLoader:
|
||||
errors: list[Type[BaseException]]
|
||||
errors: list[type[BaseException]]
|
||||
testMethodPrefix: str
|
||||
sortTestMethodsUsing: _SortComparisonMethod
|
||||
|
||||
@@ -19,18 +19,18 @@ class TestLoader:
|
||||
testNamePatterns: list[str] | None
|
||||
|
||||
suiteClass: _SuiteClass
|
||||
def loadTestsFromTestCase(self, testCaseClass: Type[unittest.case.TestCase]) -> unittest.suite.TestSuite: ...
|
||||
def loadTestsFromTestCase(self, testCaseClass: type[unittest.case.TestCase]) -> unittest.suite.TestSuite: ...
|
||||
def loadTestsFromModule(self, module: ModuleType, *args: Any, pattern: Any = ...) -> unittest.suite.TestSuite: ...
|
||||
def loadTestsFromName(self, name: str, module: ModuleType | None = ...) -> unittest.suite.TestSuite: ...
|
||||
def loadTestsFromNames(self, names: Sequence[str], module: ModuleType | None = ...) -> unittest.suite.TestSuite: ...
|
||||
def getTestCaseNames(self, testCaseClass: Type[unittest.case.TestCase]) -> Sequence[str]: ...
|
||||
def getTestCaseNames(self, testCaseClass: type[unittest.case.TestCase]) -> Sequence[str]: ...
|
||||
def discover(self, start_dir: str, pattern: str = ..., top_level_dir: str | None = ...) -> unittest.suite.TestSuite: ...
|
||||
|
||||
defaultTestLoader: TestLoader
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def getTestCaseNames(
|
||||
testCaseClass: Type[unittest.case.TestCase],
|
||||
testCaseClass: type[unittest.case.TestCase],
|
||||
prefix: str,
|
||||
sortUsing: _SortComparisonMethod = ...,
|
||||
testNamePatterns: list[str] | None = ...,
|
||||
@@ -38,11 +38,11 @@ if sys.version_info >= (3, 7):
|
||||
|
||||
else:
|
||||
def getTestCaseNames(
|
||||
testCaseClass: Type[unittest.case.TestCase], prefix: str, sortUsing: _SortComparisonMethod = ...
|
||||
testCaseClass: type[unittest.case.TestCase], prefix: str, sortUsing: _SortComparisonMethod = ...
|
||||
) -> Sequence[str]: ...
|
||||
|
||||
def makeSuite(
|
||||
testCaseClass: Type[unittest.case.TestCase],
|
||||
testCaseClass: type[unittest.case.TestCase],
|
||||
prefix: str = ...,
|
||||
sortUsing: _SortComparisonMethod = ...,
|
||||
suiteClass: _SuiteClass = ...,
|
||||
|
||||
@@ -4,7 +4,7 @@ import unittest.loader
|
||||
import unittest.result
|
||||
import unittest.suite
|
||||
from types import ModuleType
|
||||
from typing import Any, Iterable, Protocol, Type
|
||||
from typing import Any, Iterable, Protocol
|
||||
|
||||
MAIN_EXAMPLES: str
|
||||
MODULE_EXAMPLES: str
|
||||
@@ -30,7 +30,7 @@ class TestProgram:
|
||||
module: None | str | ModuleType = ...,
|
||||
defaultTest: str | Iterable[str] | None = ...,
|
||||
argv: list[str] | None = ...,
|
||||
testRunner: Type[_TestRunner] | _TestRunner | None = ...,
|
||||
testRunner: type[_TestRunner] | _TestRunner | None = ...,
|
||||
testLoader: unittest.loader.TestLoader = ...,
|
||||
exit: bool = ...,
|
||||
verbosity: int = ...,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import sys
|
||||
from typing import Any, Awaitable, Callable, Generic, Iterable, Mapping, Sequence, Type, TypeVar, overload
|
||||
from typing import Any, Awaitable, Callable, Generic, Iterable, Mapping, Sequence, TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_TT = TypeVar("_TT", bound=Type[Any])
|
||||
_TT = TypeVar("_TT", bound=type[Any])
|
||||
_R = TypeVar("_R")
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
@@ -106,10 +106,10 @@ class NonCallableMock(Base, Any):
|
||||
def __new__(__cls, *args: Any, **kw: Any) -> NonCallableMock: ...
|
||||
def __init__(
|
||||
self,
|
||||
spec: list[str] | object | Type[object] | None = ...,
|
||||
spec: list[str] | object | type[object] | None = ...,
|
||||
wraps: Any | None = ...,
|
||||
name: str | None = ...,
|
||||
spec_set: list[str] | object | Type[object] | None = ...,
|
||||
spec_set: list[str] | object | type[object] | None = ...,
|
||||
parent: NonCallableMock | None = ...,
|
||||
_spec_state: Any | None = ...,
|
||||
_new_name: str = ...,
|
||||
@@ -258,7 +258,7 @@ class _patch_dict:
|
||||
|
||||
class _patcher:
|
||||
TEST_PREFIX: str
|
||||
dict: Type[_patch_dict]
|
||||
dict: type[_patch_dict]
|
||||
if sys.version_info >= (3, 8):
|
||||
# This overload also covers the case, where new==DEFAULT. In this case, the return type is _patch[Any].
|
||||
# Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock],
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import unittest.case
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, TextIO, Type, TypeVar, Union
|
||||
from typing import Any, Callable, TextIO, TypeVar, Union
|
||||
|
||||
_SysExcInfoType = Union[tuple[Type[BaseException], BaseException, TracebackType], tuple[None, None, None]]
|
||||
_SysExcInfoType = Union[tuple[type[BaseException], BaseException, TracebackType], tuple[None, None, None]]
|
||||
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import unittest.case
|
||||
import unittest.result
|
||||
import unittest.suite
|
||||
from typing import Callable, TextIO, Type
|
||||
from typing import Callable, TextIO
|
||||
|
||||
_ResultClassType = Callable[[TextIO, bool, int], unittest.result.TestResult]
|
||||
|
||||
@@ -27,7 +27,7 @@ class TextTestRunner:
|
||||
failfast: bool = ...,
|
||||
buffer: bool = ...,
|
||||
resultclass: _ResultClassType | None = ...,
|
||||
warnings: Type[Warning] | None = ...,
|
||||
warnings: type[Warning] | None = ...,
|
||||
*,
|
||||
tb_locals: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
from _typeshed import Self
|
||||
from email.message import Message
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, BinaryIO, Callable, Iterable, Type, TypeVar
|
||||
from typing import IO, Any, BinaryIO, Callable, Iterable, TypeVar
|
||||
|
||||
_AIUT = TypeVar("_AIUT", bound=addbase)
|
||||
|
||||
@@ -11,7 +11,7 @@ class addbase(BinaryIO):
|
||||
def __init__(self, fp: IO[bytes]) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
) -> None: ...
|
||||
def __iter__(self: _AIUT) -> _AIUT: ...
|
||||
def __next__(self) -> bytes: ...
|
||||
|
||||
+9
-9
@@ -1,32 +1,32 @@
|
||||
from _warnings import warn as warn, warn_explicit as warn_explicit
|
||||
from types import ModuleType, TracebackType
|
||||
from typing import Any, Sequence, TextIO, Type, overload
|
||||
from typing import Any, Sequence, TextIO, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_ActionKind = Literal["default", "error", "ignore", "always", "module", "once"]
|
||||
|
||||
filters: Sequence[tuple[str, str | None, Type[Warning], str | None, int]] # undocumented, do not mutate
|
||||
filters: Sequence[tuple[str, str | None, type[Warning], str | None, int]] # undocumented, do not mutate
|
||||
|
||||
def showwarning(
|
||||
message: Warning | str, category: Type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ...
|
||||
message: Warning | str, category: type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ...
|
||||
) -> None: ...
|
||||
def formatwarning(message: Warning | str, category: Type[Warning], filename: str, lineno: int, line: str | None = ...) -> str: ...
|
||||
def formatwarning(message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = ...) -> str: ...
|
||||
def filterwarnings(
|
||||
action: _ActionKind,
|
||||
message: str = ...,
|
||||
category: Type[Warning] = ...,
|
||||
category: type[Warning] = ...,
|
||||
module: str = ...,
|
||||
lineno: int = ...,
|
||||
append: bool = ...,
|
||||
) -> None: ...
|
||||
def simplefilter(action: _ActionKind, category: Type[Warning] = ..., lineno: int = ..., append: bool = ...) -> None: ...
|
||||
def simplefilter(action: _ActionKind, category: type[Warning] = ..., lineno: int = ..., append: bool = ...) -> None: ...
|
||||
def resetwarnings() -> None: ...
|
||||
|
||||
class _OptionError(Exception): ...
|
||||
|
||||
class WarningMessage:
|
||||
message: Warning | str
|
||||
category: Type[Warning]
|
||||
category: type[Warning]
|
||||
filename: str
|
||||
lineno: int
|
||||
file: TextIO | None
|
||||
@@ -35,7 +35,7 @@ class WarningMessage:
|
||||
def __init__(
|
||||
self,
|
||||
message: Warning | str,
|
||||
category: Type[Warning],
|
||||
category: type[Warning],
|
||||
filename: str,
|
||||
lineno: int,
|
||||
file: TextIO | None = ...,
|
||||
@@ -52,7 +52,7 @@ class catch_warnings:
|
||||
def __new__(cls, *, record: bool, module: ModuleType | None = ...) -> catch_warnings: ...
|
||||
def __enter__(self) -> list[WarningMessage] | None: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
class _catch_warnings_without_records(catch_warnings):
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
from _weakrefset import WeakSet as WeakSet
|
||||
from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, MutableMapping, Type, TypeVar, overload
|
||||
from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, MutableMapping, TypeVar, overload
|
||||
|
||||
from _weakref import (
|
||||
CallableProxyType as CallableProxyType,
|
||||
@@ -16,7 +16,7 @@ _KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
_CallableT = TypeVar("_CallableT", bound=Callable[..., Any])
|
||||
|
||||
ProxyTypes: tuple[Type[Any], ...]
|
||||
ProxyTypes: tuple[type[Any], ...]
|
||||
|
||||
class WeakMethod(ref[_CallableT], Generic[_CallableT]):
|
||||
def __new__(cls, meth: _CallableT, callback: Callable[[_CallableT], object] | None = ...) -> WeakMethod[_CallableT]: ...
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Any, Type, Union
|
||||
from typing import Any, Union
|
||||
from typing_extensions import Literal, final
|
||||
|
||||
if sys.platform == "win32":
|
||||
@@ -95,7 +95,7 @@ if sys.platform == "win32":
|
||||
def __int__(self) -> int: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
def Close(self) -> None: ...
|
||||
def Detach(self) -> int: ...
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from abc import abstractmethod
|
||||
from types import TracebackType
|
||||
from typing import IO, Callable, MutableMapping, Optional, Type
|
||||
from typing import IO, Callable, MutableMapping, Optional
|
||||
|
||||
from .headers import Headers
|
||||
from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment
|
||||
from .util import FileWrapper
|
||||
|
||||
_exc_info = tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
_exc_info = tuple[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
|
||||
def format_date_time(timestamp: float | None) -> str: ... # undocumented
|
||||
def read_environ() -> dict[str, str]: ...
|
||||
@@ -23,8 +23,8 @@ class BaseHandler:
|
||||
|
||||
os_environ: MutableMapping[str, str]
|
||||
|
||||
wsgi_file_wrapper: Type[FileWrapper] | None
|
||||
headers_class: Type[Headers] # undocumented
|
||||
wsgi_file_wrapper: type[FileWrapper] | None
|
||||
headers_class: type[Headers] # undocumented
|
||||
|
||||
traceback_limit: int | None
|
||||
error_status: str
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from typing import Type, TypeVar, overload
|
||||
from typing import TypeVar, overload
|
||||
|
||||
from .handlers import SimpleHandler
|
||||
from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment
|
||||
@@ -30,8 +30,8 @@ def demo_app(environ: WSGIEnvironment, start_response: StartResponse) -> list[by
|
||||
_S = TypeVar("_S", bound=WSGIServer)
|
||||
|
||||
@overload
|
||||
def make_server(host: str, port: int, app: WSGIApplication, *, handler_class: Type[WSGIRequestHandler] = ...) -> WSGIServer: ...
|
||||
def make_server(host: str, port: int, app: WSGIApplication, *, handler_class: type[WSGIRequestHandler] = ...) -> WSGIServer: ...
|
||||
@overload
|
||||
def make_server(
|
||||
host: str, port: int, app: WSGIApplication, server_class: Type[_S], handler_class: Type[WSGIRequestHandler] = ...
|
||||
host: str, port: int, app: WSGIApplication, server_class: type[_S], handler_class: type[WSGIRequestHandler] = ...
|
||||
) -> _S: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from typing import Any, Iterable, Type, TypeVar
|
||||
from typing import Any, Iterable, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
StringTypes: tuple[Type[str]]
|
||||
StringTypes: tuple[type[str]]
|
||||
|
||||
class NodeList(list[_T]):
|
||||
length: int
|
||||
@@ -14,4 +14,4 @@ class EmptyNodeList(tuple[Any, ...]):
|
||||
def __add__(self, other: Iterable[_T]) -> NodeList[_T]: ... # type: ignore[override]
|
||||
def __radd__(self, other: Iterable[_T]) -> NodeList[_T]: ...
|
||||
|
||||
def defproperty(klass: Type[Any], name: str, doc: str) -> None: ...
|
||||
def defproperty(klass: type[Any], name: str, doc: str) -> None: ...
|
||||
|
||||
@@ -6,7 +6,7 @@ from _typeshed import Self, SupportsRead, SupportsWrite
|
||||
from datetime import datetime
|
||||
from io import BytesIO
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, Iterable, Mapping, Protocol, Type, Union, overload
|
||||
from typing import Any, Callable, Iterable, Mapping, Protocol, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
class _SupportsTimeTuple(Protocol):
|
||||
@@ -86,7 +86,7 @@ class Binary:
|
||||
|
||||
def _binary(data: bytes) -> Binary: ... # undocumented
|
||||
|
||||
WRAPPERS: tuple[Type[DateTime], Type[Binary]] # undocumented
|
||||
WRAPPERS: tuple[type[DateTime], type[Binary]] # undocumented
|
||||
|
||||
class ExpatParser: # undocumented
|
||||
def __init__(self, target: Unmarshaller) -> None: ...
|
||||
@@ -96,7 +96,7 @@ class ExpatParser: # undocumented
|
||||
class Marshaller:
|
||||
|
||||
dispatch: dict[
|
||||
Type[Any], Callable[[Marshaller, Any, Callable[[str], Any]], None]
|
||||
type[Any], Callable[[Marshaller, Any, Callable[[str], Any]], None]
|
||||
] # TODO: Replace 'Any' with some kind of binding
|
||||
|
||||
memo: dict[Any, None]
|
||||
@@ -301,7 +301,7 @@ class ServerProxy:
|
||||
def __call__(self, attr: str) -> Callable[[], None] | Transport: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def __close(self) -> None: ... # undocumented
|
||||
def __request(self, methodname: str, params: tuple[_Marshallable, ...]) -> tuple[_Marshallable, ...]: ... # undocumented
|
||||
|
||||
@@ -3,7 +3,7 @@ import pydoc
|
||||
import socketserver
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Iterable, Mapping, Pattern, Protocol, Type, Union
|
||||
from typing import Any, Callable, Iterable, Mapping, Pattern, Protocol, Union
|
||||
from xmlrpc.client import Fault
|
||||
|
||||
# TODO: Recursive type on tuple, list, dict
|
||||
@@ -81,7 +81,7 @@ class SimpleXMLRPCServer(socketserver.TCPServer, SimpleXMLRPCDispatcher):
|
||||
def __init__(
|
||||
self,
|
||||
addr: tuple[str, int],
|
||||
requestHandler: Type[SimpleXMLRPCRequestHandler] = ...,
|
||||
requestHandler: type[SimpleXMLRPCRequestHandler] = ...,
|
||||
logRequests: bool = ...,
|
||||
allow_none: bool = ...,
|
||||
encoding: str | None = ...,
|
||||
@@ -97,7 +97,7 @@ class MultiPathXMLRPCServer(SimpleXMLRPCServer): # undocumented
|
||||
def __init__(
|
||||
self,
|
||||
addr: tuple[str, int],
|
||||
requestHandler: Type[SimpleXMLRPCRequestHandler] = ...,
|
||||
requestHandler: type[SimpleXMLRPCRequestHandler] = ...,
|
||||
logRequests: bool = ...,
|
||||
allow_none: bool = ...,
|
||||
encoding: str | None = ...,
|
||||
@@ -150,7 +150,7 @@ class DocXMLRPCServer(SimpleXMLRPCServer, XMLRPCDocGenerator):
|
||||
def __init__(
|
||||
self,
|
||||
addr: tuple[str, int],
|
||||
requestHandler: Type[SimpleXMLRPCRequestHandler] = ...,
|
||||
requestHandler: type[SimpleXMLRPCRequestHandler] = ...,
|
||||
logRequests: bool = ...,
|
||||
allow_none: bool = ...,
|
||||
encoding: str | None = ...,
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import sys
|
||||
from _typeshed import Self, StrPath
|
||||
from os import PathLike
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, Callable, Iterable, Iterator, Protocol, Sequence, Type, overload
|
||||
from typing import IO, Any, Callable, Iterable, Iterator, Protocol, Sequence, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_DateTuple = tuple[int, int, int, int, int, int]
|
||||
@@ -145,7 +145,7 @@ class ZipFile:
|
||||
) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def getinfo(self, name: str) -> ZipInfo: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import typing
|
||||
from _typeshed import StrPath
|
||||
from datetime import tzinfo
|
||||
from typing import Any, Iterable, Protocol, Sequence, Type
|
||||
from typing import Any, Iterable, Protocol, Sequence
|
||||
|
||||
_T = typing.TypeVar("_T", bound="ZoneInfo")
|
||||
|
||||
@@ -14,9 +14,9 @@ class ZoneInfo(tzinfo):
|
||||
def key(self) -> str: ...
|
||||
def __init__(self, key: str) -> None: ...
|
||||
@classmethod
|
||||
def no_cache(cls: Type[_T], key: str) -> _T: ...
|
||||
def no_cache(cls: type[_T], key: str) -> _T: ...
|
||||
@classmethod
|
||||
def from_file(cls: Type[_T], __fobj: _IOBytes, key: str | None = ...) -> _T: ...
|
||||
def from_file(cls: type[_T], __fobj: _IOBytes, key: str | None = ...) -> _T: ...
|
||||
@classmethod
|
||||
def clear_cache(cls, *, only_keys: Iterable[str] = ...) -> None: ...
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Type, TypeVar, overload
|
||||
from typing import Any, Callable, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
@@ -8,9 +8,9 @@ class ClassicAdapter:
|
||||
reason: str
|
||||
version: str
|
||||
action: _Actions | None
|
||||
category: Type[Warning]
|
||||
category: type[Warning]
|
||||
def __init__(
|
||||
self, reason: str = ..., version: str = ..., action: _Actions | None = ..., category: Type[Warning] = ...
|
||||
self, reason: str = ..., version: str = ..., action: _Actions | None = ..., category: type[Warning] = ...
|
||||
) -> None: ...
|
||||
def get_deprecated_msg(self, wrapped: Callable[..., Any], instance: object) -> str: ...
|
||||
def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ...
|
||||
@@ -19,5 +19,5 @@ class ClassicAdapter:
|
||||
def deprecated(__wrapped: _F) -> _F: ...
|
||||
@overload
|
||||
def deprecated(
|
||||
reason: str = ..., *, version: str = ..., action: _Actions | None = ..., category: Type[Warning] | None = ...
|
||||
reason: str = ..., *, version: str = ..., action: _Actions | None = ..., category: type[Warning] | None = ...
|
||||
) -> Callable[[_F], _F]: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Type, TypeVar
|
||||
from typing import Any, Callable, TypeVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .classic import ClassicAdapter, _Actions
|
||||
@@ -10,14 +10,14 @@ class SphinxAdapter(ClassicAdapter):
|
||||
reason: str
|
||||
version: str
|
||||
action: _Actions | None
|
||||
category: Type[Warning]
|
||||
category: type[Warning]
|
||||
def __init__(
|
||||
self,
|
||||
directive: Literal["versionadded", "versionchanged", "deprecated"],
|
||||
reason: str = ...,
|
||||
version: str = ...,
|
||||
action: _Actions | None = ...,
|
||||
category: Type[Warning] = ...,
|
||||
category: type[Warning] = ...,
|
||||
) -> None: ...
|
||||
def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ...
|
||||
|
||||
@@ -29,5 +29,5 @@ def deprecated(
|
||||
line_length: int = ...,
|
||||
*,
|
||||
action: _Actions | None = ...,
|
||||
category: Type[Warning] | None = ...,
|
||||
category: type[Warning] | None = ...,
|
||||
) -> Callable[[_F], _F]: ...
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user