diff --git a/stdlib/__future__.pyi b/stdlib/__future__.pyi index 4658afa9f09e..1a465c3e213d 100644 --- a/stdlib/__future__.pyi +++ b/stdlib/__future__.pyi @@ -1,5 +1,4 @@ import sys -from typing import List class _Feature: def __init__(self, optionalRelease: sys._version_info, mandatoryRelease: sys._version_info, compiler_flag: int) -> None: ... @@ -20,7 +19,7 @@ generator_stop: _Feature if sys.version_info >= (3, 7): annotations: _Feature -all_feature_names: List[str] # undocumented +all_feature_names: list[str] # undocumented if sys.version_info >= (3, 7): __all__ = [ diff --git a/stdlib/_ast.pyi b/stdlib/_ast.pyi index 66e3be054f5e..08725cfc0b77 100644 --- a/stdlib/_ast.pyi +++ b/stdlib/_ast.pyi @@ -29,16 +29,16 @@ if sys.version_info >= (3, 8): class TypeIgnore(type_ignore): tag: str class FunctionType(mod): - argtypes: typing.List[expr] + argtypes: list[expr] returns: expr class Module(mod): - body: typing.List[stmt] + body: list[stmt] if sys.version_info >= (3, 8): - type_ignores: typing.List[TypeIgnore] + type_ignores: list[TypeIgnore] class Interactive(mod): - body: typing.List[stmt] + body: list[stmt] class Expression(mod): body: expr @@ -48,32 +48,32 @@ class stmt(AST): ... class FunctionDef(stmt): name: _identifier args: arguments - body: typing.List[stmt] - decorator_list: typing.List[expr] + body: list[stmt] + decorator_list: list[expr] returns: expr | None class AsyncFunctionDef(stmt): name: _identifier args: arguments - body: typing.List[stmt] - decorator_list: typing.List[expr] + body: list[stmt] + decorator_list: list[expr] returns: expr | None class ClassDef(stmt): name: _identifier - bases: typing.List[expr] - keywords: typing.List[keyword] - body: typing.List[stmt] - decorator_list: typing.List[expr] + bases: list[expr] + keywords: list[keyword] + body: list[stmt] + decorator_list: list[expr] class Return(stmt): value: expr | None class Delete(stmt): - targets: typing.List[expr] + targets: list[expr] class Assign(stmt): - targets: typing.List[expr] + targets: list[expr] value: expr class AugAssign(stmt): @@ -90,60 +90,60 @@ class AnnAssign(stmt): class For(stmt): target: expr iter: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] class AsyncFor(stmt): target: expr iter: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] class While(stmt): test: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] class If(stmt): test: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] class With(stmt): - items: typing.List[withitem] - body: typing.List[stmt] + items: list[withitem] + body: list[stmt] class AsyncWith(stmt): - items: typing.List[withitem] - body: typing.List[stmt] + items: list[withitem] + body: list[stmt] class Raise(stmt): exc: expr | None cause: expr | None class Try(stmt): - body: typing.List[stmt] - handlers: typing.List[ExceptHandler] - orelse: typing.List[stmt] - finalbody: typing.List[stmt] + body: list[stmt] + handlers: list[ExceptHandler] + orelse: list[stmt] + finalbody: list[stmt] class Assert(stmt): test: expr msg: expr | None class Import(stmt): - names: typing.List[alias] + names: list[alias] class ImportFrom(stmt): module: _identifier | None - names: typing.List[alias] + names: list[alias] level: int class Global(stmt): - names: typing.List[_identifier] + names: list[_identifier] class Nonlocal(stmt): - names: typing.List[_identifier] + names: list[_identifier] class Expr(stmt): value: expr @@ -155,7 +155,7 @@ class expr(AST): ... class BoolOp(expr): op: boolop - values: typing.List[expr] + values: list[expr] class BinOp(expr): left: expr @@ -176,28 +176,28 @@ class IfExp(expr): orelse: expr class Dict(expr): - keys: typing.List[expr | None] - values: typing.List[expr] + keys: list[expr | None] + values: list[expr] class Set(expr): - elts: typing.List[expr] + elts: list[expr] class ListComp(expr): elt: expr - generators: typing.List[comprehension] + generators: list[comprehension] class SetComp(expr): elt: expr - generators: typing.List[comprehension] + generators: list[comprehension] class DictComp(expr): key: expr value: expr - generators: typing.List[comprehension] + generators: list[comprehension] class GeneratorExp(expr): elt: expr - generators: typing.List[comprehension] + generators: list[comprehension] class Await(expr): value: expr @@ -210,13 +210,13 @@ class YieldFrom(expr): class Compare(expr): left: expr - ops: typing.List[cmpop] - comparators: typing.List[expr] + ops: list[cmpop] + comparators: list[expr] class Call(expr): func: expr - args: typing.List[expr] - keywords: typing.List[keyword] + args: list[expr] + keywords: list[keyword] class FormattedValue(expr): value: expr @@ -224,7 +224,7 @@ class FormattedValue(expr): format_spec: expr | None class JoinedStr(expr): - values: typing.List[expr] + values: list[expr] if sys.version_info < (3, 8): class Num(expr): # Deprecated in 3.8; use Constant @@ -267,7 +267,7 @@ class Slice(_SliceT): if sys.version_info < (3, 9): class ExtSlice(slice): - dims: typing.List[slice] + dims: list[slice] class Index(slice): value: expr @@ -285,11 +285,11 @@ class Name(expr): ctx: expr_context class List(expr): - elts: typing.List[expr] + elts: list[expr] ctx: expr_context class Tuple(expr): - elts: typing.List[expr] + elts: list[expr] ctx: expr_context class expr_context(AST): ... @@ -299,7 +299,7 @@ if sys.version_info < (3, 9): class AugStore(expr_context): ... class Param(expr_context): ... class Suite(mod): - body: typing.List[stmt] + body: list[stmt] class Del(expr_context): ... class Load(expr_context): ... @@ -341,7 +341,7 @@ class NotIn(cmpop): ... class comprehension(AST): target: expr iter: expr - ifs: typing.List[expr] + ifs: list[expr] is_async: int class excepthandler(AST): ... @@ -349,17 +349,17 @@ class excepthandler(AST): ... class ExceptHandler(excepthandler): type: expr | None name: _identifier | None - body: typing.List[stmt] + body: list[stmt] class arguments(AST): if sys.version_info >= (3, 8): - posonlyargs: typing.List[arg] - args: typing.List[arg] + posonlyargs: list[arg] + args: list[arg] vararg: arg | None - kwonlyargs: typing.List[arg] - kw_defaults: typing.List[expr | None] + kwonlyargs: list[arg] + kw_defaults: list[expr | None] kwarg: arg | None - defaults: typing.List[expr] + defaults: list[expr] class arg(AST): arg: _identifier @@ -380,33 +380,33 @@ class withitem(AST): if sys.version_info >= (3, 10): class Match(stmt): subject: expr - cases: typing.List[match_case] + cases: list[match_case] class pattern(AST): ... # Without the alias, Pyright complains variables named pattern are recursively defined _pattern = pattern class match_case(AST): pattern: _pattern guard: expr | None - body: typing.List[stmt] + body: list[stmt] class MatchValue(pattern): value: expr class MatchSingleton(pattern): value: Literal[True, False, None] class MatchSequence(pattern): - patterns: typing.List[pattern] + patterns: list[pattern] class MatchStar(pattern): name: _identifier | None class MatchMapping(pattern): - keys: typing.List[expr] - patterns: typing.List[pattern] + keys: list[expr] + patterns: list[pattern] rest: _identifier | None class MatchClass(pattern): cls: expr - patterns: typing.List[pattern] - kwd_attrs: typing.List[_identifier] - kwd_patterns: typing.List[pattern] + patterns: list[pattern] + kwd_attrs: list[_identifier] + kwd_patterns: list[pattern] class MatchAs(pattern): pattern: _pattern | None name: _identifier | None class MatchOr(pattern): - patterns: typing.List[pattern] + patterns: list[pattern] diff --git a/stdlib/_compat_pickle.pyi b/stdlib/_compat_pickle.pyi index 5be4c9b9d829..ba6c88a03035 100644 --- a/stdlib/_compat_pickle.pyi +++ b/stdlib/_compat_pickle.pyi @@ -1,10 +1,10 @@ -from typing import Dict, Tuple +from typing import Tuple -IMPORT_MAPPING: Dict[str, str] -NAME_MAPPING: Dict[Tuple[str, str], Tuple[str, str]] +IMPORT_MAPPING: dict[str, str] +NAME_MAPPING: dict[Tuple[str, str], Tuple[str, str]] PYTHON2_EXCEPTIONS: Tuple[str, ...] MULTIPROCESSING_EXCEPTIONS: Tuple[str, ...] -REVERSE_IMPORT_MAPPING: Dict[str, str] -REVERSE_NAME_MAPPING: Dict[Tuple[str, str], Tuple[str, str]] +REVERSE_IMPORT_MAPPING: dict[str, str] +REVERSE_NAME_MAPPING: dict[Tuple[str, str], Tuple[str, str]] PYTHON3_OSERROR_EXCEPTIONS: Tuple[str, ...] PYTHON3_IMPORTERROR_EXCEPTIONS: Tuple[str, ...] diff --git a/stdlib/_csv.pyi b/stdlib/_csv.pyi index 94f304f3e3d1..1dc43780f687 100644 --- a/stdlib/_csv.pyi +++ b/stdlib/_csv.pyi @@ -23,7 +23,7 @@ _DialectLike = Union[str, Dialect, Type[Dialect]] class _reader(Iterator[List[str]]): dialect: Dialect line_num: int - def __next__(self) -> List[str]: ... + def __next__(self) -> list[str]: ... class _writer: dialect: Dialect @@ -38,5 +38,5 @@ def reader(csvfile: Iterable[str], dialect: _DialectLike = ..., **fmtparams: Any def register_dialect(name: str, dialect: Any = ..., **fmtparams: Any) -> None: ... def unregister_dialect(name: str) -> None: ... def get_dialect(name: str) -> Dialect: ... -def list_dialects() -> List[str]: ... +def list_dialects() -> list[str]: ... def field_size_limit(new_limit: int = ...) -> int: ... diff --git a/stdlib/_dummy_thread.pyi b/stdlib/_dummy_thread.pyi index ef0576799251..886d9d739780 100644 --- a/stdlib/_dummy_thread.pyi +++ b/stdlib/_dummy_thread.pyi @@ -1,9 +1,9 @@ -from typing import Any, Callable, Dict, NoReturn, Tuple +from typing import Any, Callable, NoReturn, Tuple TIMEOUT_MAX: int error = RuntimeError -def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> None: ... +def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: dict[str, Any] = ...) -> None: ... def exit() -> NoReturn: ... def get_ident() -> int: ... def allocate_lock() -> LockType: ... diff --git a/stdlib/_dummy_threading.pyi b/stdlib/_dummy_threading.pyi index 00394d500209..64998d86bf9f 100644 --- a/stdlib/_dummy_threading.pyi +++ b/stdlib/_dummy_threading.pyi @@ -1,6 +1,6 @@ import sys from types import FrameType, TracebackType -from typing import Any, Callable, Iterable, List, Mapping, Optional, Type, TypeVar +from typing import Any, Callable, Iterable, Mapping, Optional, Type, TypeVar # TODO recursive type _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] @@ -8,13 +8,13 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] _PF = Callable[[FrameType, str, Any], None] _T = TypeVar("_T") -__all__: List[str] +__all__: list[str] def active_count() -> int: ... def current_thread() -> Thread: ... def currentThread() -> Thread: ... def get_ident() -> int: ... -def enumerate() -> List[Thread]: ... +def enumerate() -> list[Thread]: ... def main_thread() -> Thread: ... if sys.version_info >= (3, 8): diff --git a/stdlib/_heapq.pyi b/stdlib/_heapq.pyi index 8c8339755342..87e0fe0fa777 100644 --- a/stdlib/_heapq.pyi +++ b/stdlib/_heapq.pyi @@ -1,9 +1,9 @@ -from typing import Any, List, TypeVar +from typing import Any, TypeVar _T = TypeVar("_T") -def heapify(__heap: List[Any]) -> None: ... -def heappop(__heap: List[_T]) -> _T: ... -def heappush(__heap: List[_T], __item: _T) -> None: ... -def heappushpop(__heap: List[_T], __item: _T) -> _T: ... -def heapreplace(__heap: List[_T], __item: _T) -> _T: ... +def heapify(__heap: list[Any]) -> None: ... +def heappop(__heap: list[_T]) -> _T: ... +def heappush(__heap: list[_T], __item: _T) -> None: ... +def heappushpop(__heap: list[_T], __item: _T) -> _T: ... +def heapreplace(__heap: list[_T], __item: _T) -> _T: ... diff --git a/stdlib/_imp.pyi b/stdlib/_imp.pyi index bfc4d42cd065..b61c9f29b96d 100644 --- a/stdlib/_imp.pyi +++ b/stdlib/_imp.pyi @@ -1,13 +1,13 @@ import types from importlib.machinery import ModuleSpec -from typing import Any, List +from typing import Any def create_builtin(__spec: ModuleSpec) -> types.ModuleType: ... def create_dynamic(__spec: ModuleSpec, __file: Any = ...) -> None: ... def acquire_lock() -> None: ... def exec_builtin(__mod: types.ModuleType) -> int: ... def exec_dynamic(__mod: types.ModuleType) -> int: ... -def extension_suffixes() -> List[str]: ... +def extension_suffixes() -> list[str]: ... def get_frozen_object(__name: str) -> types.CodeType: ... def init_frozen(__name: str) -> types.ModuleType: ... def is_builtin(__name: str) -> int: ... diff --git a/stdlib/_json.pyi b/stdlib/_json.pyi index 14b5c93e6e8d..f807a85b93f4 100644 --- a/stdlib/_json.pyi +++ b/stdlib/_json.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Tuple +from typing import Any, Callable, Tuple class make_encoder: sort_keys: Any @@ -11,7 +11,7 @@ class make_encoder: item_separator: Any def __init__( self, - markers: Dict[int, Any] | None, + markers: dict[int, Any] | None, default: Callable[[Any], Any], encoder: Callable[[str], str], indent: int | None, diff --git a/stdlib/_msi.pyi b/stdlib/_msi.pyi index a1030a66160f..754febe68da9 100644 --- a/stdlib/_msi.pyi +++ b/stdlib/_msi.pyi @@ -1,5 +1,4 @@ import sys -from typing import List if sys.platform == "win32": @@ -44,6 +43,6 @@ if sys.platform == "win32": __new__: None # type: ignore __init__: None # type: ignore def UuidCreate() -> str: ... - def FCICreate(cabname: str, files: List[str]) -> None: ... + def FCICreate(cabname: str, files: list[str]) -> None: ... def OpenDatabase(name: str, flags: int) -> _Database: ... def CreateRecord(count: int) -> _Record: ... diff --git a/stdlib/_osx_support.pyi b/stdlib/_osx_support.pyi index 1b890d8d8a0a..f03c37d1011a 100644 --- a/stdlib/_osx_support.pyi +++ b/stdlib/_osx_support.pyi @@ -1,10 +1,10 @@ -from typing import Dict, Iterable, List, Sequence, Tuple, TypeVar +from typing import Iterable, Sequence, Tuple, TypeVar _T = TypeVar("_T") _K = TypeVar("_K") _V = TypeVar("_V") -__all__: List[str] +__all__: list[str] _UNIVERSAL_CONFIG_VARS: Tuple[str, ...] # undocumented _COMPILER_CONFIG_VARS: Tuple[str, ...] # undocumented @@ -17,17 +17,17 @@ def _find_build_tool(toolname: str) -> str: ... # undocumented _SYSTEM_VERSION: str | None # undocumented def _get_system_version() -> str: ... # undocumented -def _remove_original_values(_config_vars: Dict[str, str]) -> None: ... # undocumented -def _save_modified_value(_config_vars: Dict[str, str], cv: str, newvalue: str) -> None: ... # undocumented +def _remove_original_values(_config_vars: dict[str, str]) -> None: ... # undocumented +def _save_modified_value(_config_vars: dict[str, str], cv: str, newvalue: str) -> None: ... # undocumented def _supports_universal_builds() -> bool: ... # undocumented -def _find_appropriate_compiler(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _remove_universal_flags(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _remove_unsupported_archs(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _override_all_archs(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def _check_for_unavailable_sdk(_config_vars: Dict[str, str]) -> Dict[str, str]: ... # undocumented -def compiler_fixup(compiler_so: Iterable[str], cc_args: Sequence[str]) -> List[str]: ... -def customize_config_vars(_config_vars: Dict[str, str]) -> Dict[str, str]: ... -def customize_compiler(_config_vars: Dict[str, str]) -> Dict[str, str]: ... +def _find_appropriate_compiler(_config_vars: dict[str, str]) -> dict[str, str]: ... # undocumented +def _remove_universal_flags(_config_vars: dict[str, str]) -> dict[str, str]: ... # undocumented +def _remove_unsupported_archs(_config_vars: dict[str, str]) -> dict[str, str]: ... # undocumented +def _override_all_archs(_config_vars: dict[str, str]) -> dict[str, str]: ... # undocumented +def _check_for_unavailable_sdk(_config_vars: dict[str, str]) -> dict[str, str]: ... # undocumented +def compiler_fixup(compiler_so: Iterable[str], cc_args: Sequence[str]) -> list[str]: ... +def customize_config_vars(_config_vars: dict[str, str]) -> dict[str, str]: ... +def customize_compiler(_config_vars: dict[str, str]) -> dict[str, str]: ... def get_platform_osx( - _config_vars: Dict[str, str], osname: _T, release: _K, machine: _V + _config_vars: dict[str, str], osname: _T, release: _K, machine: _V ) -> Tuple[str | _T, str | _K, str | _V]: ... diff --git a/stdlib/_py_abc.pyi b/stdlib/_py_abc.pyi index 9b0812d67c0f..8d7938918271 100644 --- a/stdlib/_py_abc.pyi +++ b/stdlib/_py_abc.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Tuple, Type, TypeVar +from typing import Any, Tuple, Type, 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 __new__(__mcls, __name: str, __bases: Tuple[Type[Any], ...], __namespace: dict[str, Any]) -> ABCMeta: ... def register(cls, subclass: Type[_T]) -> Type[_T]: ... diff --git a/stdlib/_thread.pyi b/stdlib/_thread.pyi index 076a6e2f254f..2425703121b5 100644 --- a/stdlib/_thread.pyi +++ b/stdlib/_thread.pyi @@ -1,7 +1,7 @@ import sys from threading import Thread from types import TracebackType -from typing import Any, Callable, Dict, NoReturn, Optional, Tuple, Type +from typing import Any, Callable, NoReturn, Optional, Tuple, Type error = RuntimeError @@ -18,7 +18,7 @@ class LockType: 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: ... +def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: dict[str, Any] = ...) -> int: ... def interrupt_main() -> None: ... def exit() -> NoReturn: ... def allocate_lock() -> LockType: ... diff --git a/stdlib/_threading_local.pyi b/stdlib/_threading_local.pyi index ed6eb8d9513e..461459d694dd 100644 --- a/stdlib/_threading_local.pyi +++ b/stdlib/_threading_local.pyi @@ -5,7 +5,7 @@ localdict = Dict[Any, Any] class _localimpl: key: str - dicts: Dict[int, Tuple[ReferenceType[Any], localdict]] + dicts: dict[int, Tuple[ReferenceType[Any], localdict]] def __init__(self) -> None: ... def get_dict(self) -> localdict: ... def create_dict(self) -> localdict: ... diff --git a/stdlib/_typeshed/wsgi.pyi b/stdlib/_typeshed/wsgi.pyi index 2f201444916b..ddb32b78332a 100644 --- a/stdlib/_typeshed/wsgi.pyi +++ b/stdlib/_typeshed/wsgi.pyi @@ -3,12 +3,12 @@ # See the README.md file in this directory for more information. from sys import _OptExcInfo -from typing import Any, Callable, Dict, Iterable, List, Protocol, Tuple +from typing import Any, Callable, Dict, Iterable, Protocol, Tuple # stable class StartResponse(Protocol): def __call__( - self, status: str, headers: List[Tuple[str, str]], exc_info: _OptExcInfo | None = ... + self, status: str, headers: list[Tuple[str, str]], exc_info: _OptExcInfo | None = ... ) -> Callable[[bytes], Any]: ... WSGIEnvironment = Dict[str, Any] # stable @@ -18,14 +18,14 @@ WSGIApplication = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]] # class InputStream(Protocol): def read(self, size: int = ...) -> bytes: ... def readline(self, size: int = ...) -> bytes: ... - def readlines(self, hint: int = ...) -> List[bytes]: ... + def readlines(self, hint: int = ...) -> list[bytes]: ... def __iter__(self) -> Iterable[bytes]: ... # WSGI error streams per PEP 3333, stable class ErrorStream(Protocol): def flush(self) -> None: ... def write(self, s: str) -> None: ... - def writelines(self, seq: List[str]) -> None: ... + def writelines(self, seq: list[str]) -> None: ... class _Readable(Protocol): def read(self, size: int = ...) -> bytes: ... diff --git a/stdlib/_warnings.pyi b/stdlib/_warnings.pyi index e0a1ccf5c201..b7023cea8fe3 100644 --- a/stdlib/_warnings.pyi +++ b/stdlib/_warnings.pyi @@ -1,8 +1,8 @@ -from typing import Any, Dict, List, Tuple, Type, overload +from typing import Any, Tuple, Type, overload _defaultaction: str -_onceregistry: Dict[Any, Any] -filters: List[Tuple[Any, ...]] +_onceregistry: dict[Any, Any] +filters: list[Tuple[Any, ...]] @overload def warn(message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ... @@ -15,8 +15,8 @@ def warn_explicit( filename: str, lineno: int, module: str | None = ..., - registry: Dict[str | Tuple[str, Type[Warning], int], int] | None = ..., - module_globals: Dict[str, Any] | None = ..., + registry: dict[str | Tuple[str, Type[Warning], int], int] | None = ..., + module_globals: dict[str, Any] | None = ..., source: Any | None = ..., ) -> None: ... @overload @@ -26,7 +26,7 @@ def warn_explicit( filename: str, lineno: int, module: str | None = ..., - registry: Dict[str | Tuple[str, Type[Warning], int], int] | None = ..., - module_globals: Dict[str, Any] | None = ..., + registry: dict[str | Tuple[str, Type[Warning], int], int] | None = ..., + module_globals: dict[str, Any] | None = ..., source: Any | None = ..., ) -> None: ... diff --git a/stdlib/_weakref.pyi b/stdlib/_weakref.pyi index 51d8205e7eff..006836f85055 100644 --- a/stdlib/_weakref.pyi +++ b/stdlib/_weakref.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Callable, Generic, List, TypeVar, overload +from typing import Any, Callable, Generic, TypeVar, overload if sys.version_info >= (3, 9): from types import GenericAlias @@ -24,7 +24,7 @@ class ReferenceType(Generic[_T]): ref = ReferenceType def getweakrefcount(__object: Any) -> int: ... -def getweakrefs(object: Any) -> List[Any]: ... +def getweakrefs(object: Any) -> list[Any]: ... @overload def proxy(object: _C, callback: Callable[[_C], Any] | None = ...) -> CallableProxyType[_C]: ... diff --git a/stdlib/_winapi.pyi b/stdlib/_winapi.pyi index 5e3db51435cd..5cb7a59cc8a1 100644 --- a/stdlib/_winapi.pyi +++ b/stdlib/_winapi.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Dict, NoReturn, Sequence, Tuple, overload +from typing import Any, NoReturn, Sequence, Tuple, overload from typing_extensions import Literal CREATE_NEW_CONSOLE: int @@ -81,7 +81,7 @@ def CreateProcess( __thread_attrs: Any, __inherit_handles: bool, __creation_flags: int, - __env_mapping: Dict[str, str], + __env_mapping: dict[str, str], __current_directory: str | None, __startup_info: Any, ) -> Tuple[int, int, int, int]: ... diff --git a/stdlib/abc.pyi b/stdlib/abc.pyi index bf98d5364101..7896e910c81f 100644 --- a/stdlib/abc.pyi +++ b/stdlib/abc.pyi @@ -1,5 +1,5 @@ from _typeshed import SupportsWrite -from typing import Any, Callable, Dict, Tuple, Type, TypeVar +from typing import Any, Callable, Tuple, Type, TypeVar _T = TypeVar("_T") _FuncT = TypeVar("_FuncT", bound=Callable[..., Any]) @@ -7,7 +7,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any]) # These definitions have special processing in mypy class ABCMeta(type): __abstractmethods__: frozenset[str] - def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> None: ... + def __init__(self, name: str, bases: Tuple[type, ...], namespace: dict[str, Any]) -> None: ... def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ... def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ... def _dump_registry(cls: ABCMeta, file: SupportsWrite[str] | None = ...) -> None: ... diff --git a/stdlib/aifc.pyi b/stdlib/aifc.pyi index c54ada6a1ebc..7d7c6b21f341 100644 --- a/stdlib/aifc.pyi +++ b/stdlib/aifc.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import Self from types import TracebackType -from typing import IO, Any, List, NamedTuple, Tuple, Type, Union, overload +from typing import IO, Any, NamedTuple, Tuple, Type, Union, overload from typing_extensions import Literal class Error(Exception): ... @@ -35,7 +35,7 @@ class Aifc_read: def getcomptype(self) -> bytes: ... def getcompname(self) -> bytes: ... def getparams(self) -> _aifc_params: ... - def getmarkers(self) -> List[_Marker] | None: ... + def getmarkers(self) -> list[_Marker] | None: ... def getmark(self, id: int) -> _Marker: ... def setpos(self, pos: int) -> None: ... def readframes(self, nframes: int) -> bytes: ... @@ -65,7 +65,7 @@ class Aifc_write: def getparams(self) -> _aifc_params: ... def setmark(self, id: int, pos: int, name: bytes) -> None: ... def getmark(self, id: int) -> _Marker: ... - def getmarkers(self) -> List[_Marker] | None: ... + def getmarkers(self) -> list[_Marker] | None: ... def tell(self) -> int: ... def writeframesraw(self, data: Any) -> None: ... # Actual type for data is Buffer Protocol def writeframes(self, data: Any) -> None: ... diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index ec66de722826..631030e94923 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -1,21 +1,5 @@ import sys -from typing import ( - IO, - Any, - Callable, - Dict, - Generator, - Iterable, - List, - NoReturn, - Pattern, - Protocol, - Sequence, - Tuple, - Type, - TypeVar, - overload, -) +from typing import IO, Any, Callable, Generator, Iterable, NoReturn, Pattern, Protocol, Sequence, Tuple, Type, TypeVar, overload _T = TypeVar("_T") _ActionT = TypeVar("_ActionT", bound=Action) @@ -36,8 +20,8 @@ class ArgumentError(Exception): # undocumented class _AttributeHolder: - def _get_kwargs(self) -> List[Tuple[str, Any]]: ... - def _get_args(self) -> List[Any]: ... + def _get_kwargs(self) -> list[Tuple[str, Any]]: ... + def _get_args(self) -> list[Any]: ... # undocumented class _ActionsContainer: @@ -46,14 +30,14 @@ class _ActionsContainer: argument_default: Any conflict_handler: str - _registries: Dict[str, Dict[Any, Any]] - _actions: List[Action] - _option_string_actions: Dict[str, Action] - _action_groups: List[_ArgumentGroup] - _mutually_exclusive_groups: List[_MutuallyExclusiveGroup] - _defaults: Dict[str, Any] + _registries: dict[str, dict[Any, Any]] + _actions: list[Action] + _option_string_actions: dict[str, Action] + _action_groups: list[_ArgumentGroup] + _mutually_exclusive_groups: list[_MutuallyExclusiveGroup] + _defaults: dict[str, Any] _negative_number_matcher: Pattern[str] - _has_negative_number_optionals: List[bool] + _has_negative_number_optionals: list[bool] def __init__(self, description: str | None, prefix_chars: str, argument_default: Any, conflict_handler: str) -> None: ... def register(self, registry_name: str, value: Any, object: Any) -> None: ... def _registry_get(self, registry_name: str, value: Any, default: Any = ...) -> Any: ... @@ -80,8 +64,8 @@ class _ActionsContainer: def _add_action(self, action: _ActionT) -> _ActionT: ... def _remove_action(self, action: Action) -> None: ... 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 _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 _get_handler(self) -> Callable[[Action, Iterable[Tuple[str, Action]]], Any]: ... def _check_conflict(self, action: Action) -> None: ... @@ -185,26 +169,26 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def format_help(self) -> str: ... def parse_known_args( self, args: Sequence[str] | None = ..., namespace: Namespace | None = ... - ) -> Tuple[Namespace, List[str]]: ... - def convert_arg_line_to_args(self, arg_line: str) -> List[str]: ... + ) -> Tuple[Namespace, list[str]]: ... + def convert_arg_line_to_args(self, arg_line: str) -> list[str]: ... def exit(self, status: int = ..., message: str | None = ...) -> NoReturn: ... def error(self, message: str) -> NoReturn: ... if sys.version_info >= (3, 7): def parse_intermixed_args(self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...) -> Namespace: ... def parse_known_intermixed_args( self, args: Sequence[str] | None = ..., namespace: Namespace | None = ... - ) -> Tuple[Namespace, List[str]]: ... + ) -> Tuple[Namespace, list[str]]: ... # undocumented - def _get_optional_actions(self) -> List[Action]: ... - def _get_positional_actions(self) -> List[Action]: ... - def _parse_known_args(self, arg_strings: List[str], namespace: Namespace) -> Tuple[Namespace, List[str]]: ... - def _read_args_from_files(self, arg_strings: List[str]) -> List[str]: ... + def _get_optional_actions(self) -> list[Action]: ... + def _get_positional_actions(self) -> list[Action]: ... + def _parse_known_args(self, arg_strings: list[str], namespace: Namespace) -> Tuple[Namespace, list[str]]: ... + def _read_args_from_files(self, arg_strings: list[str]) -> list[str]: ... def _match_argument(self, action: Action, arg_strings_pattern: str) -> int: ... - def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: str) -> List[int]: ... + def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: str) -> list[int]: ... def _parse_optional(self, arg_string: str) -> Tuple[Action | None, str, str | None] | None: ... - def _get_option_tuples(self, option_string: str) -> List[Tuple[Action, str, str | None]]: ... + def _get_option_tuples(self, option_string: str) -> list[Tuple[Action, str, str | None]]: ... def _get_nargs_pattern(self, action: Action) -> str: ... - def _get_values(self, action: Action, arg_strings: List[str]) -> Any: ... + def _get_values(self, action: Action, arg_strings: list[str]) -> Any: ... def _get_value(self, action: Action, arg_string: str) -> Any: ... def _check_value(self, action: Action, value: Any) -> None: ... def _get_formatter(self) -> HelpFormatter: ... @@ -249,7 +233,7 @@ class HelpFormatter: def _format_args(self, action: Action, default_metavar: str) -> str: ... def _expand_help(self, action: Action) -> str: ... def _iter_indented_subactions(self, action: Action) -> Generator[Action, None, None]: ... - def _split_lines(self, text: str, width: int) -> List[str]: ... + def _split_lines(self, text: str, width: int) -> list[str]: ... def _fill_text(self, text: str, width: int, indent: str) -> str: ... def _get_help_string(self, action: Action) -> str | None: ... def _get_default_metavar_for_optional(self, action: Action) -> str: ... @@ -322,7 +306,7 @@ class FileType: # undocumented class _ArgumentGroup(_ActionsContainer): title: str | None - _group_actions: List[Action] + _group_actions: list[Action] def __init__( self, container: _ActionsContainer, title: str | None = ..., description: str | None = ..., **kwargs: Any ) -> None: ... @@ -399,9 +383,9 @@ class _SubParsersAction(Action): _ChoicesPseudoAction: Type[Any] # nested class _prog_prefix: str _parser_class: Type[ArgumentParser] - _name_parser_map: Dict[str, ArgumentParser] - choices: Dict[str, ArgumentParser] - _choices_actions: List[Action] + _name_parser_map: dict[str, ArgumentParser] + choices: dict[str, ArgumentParser] + _choices_actions: list[Action] if sys.version_info >= (3, 7): def __init__( self, @@ -425,7 +409,7 @@ class _SubParsersAction(Action): ) -> None: ... # TODO: Type keyword args properly. def add_parser(self, name: str, **kwargs: Any) -> ArgumentParser: ... - def _get_subactions(self) -> List[Action]: ... + def _get_subactions(self) -> list[Action]: ... # undocumented class ArgumentTypeError(Exception): ... diff --git a/stdlib/array.pyi b/stdlib/array.pyi index 60d440dacf0e..c32136d559bf 100644 --- a/stdlib/array.pyi +++ b/stdlib/array.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, BinaryIO, Generic, Iterable, List, MutableSequence, Tuple, TypeVar, Union, overload +from typing import Any, BinaryIO, Generic, Iterable, MutableSequence, Tuple, TypeVar, Union, overload from typing_extensions import Literal _IntTypeCode = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"] @@ -29,7 +29,7 @@ class array(MutableSequence[_T], Generic[_T]): def extend(self, __bb: Iterable[_T]) -> None: ... def frombytes(self, __buffer: bytes) -> None: ... def fromfile(self, __f: BinaryIO, __n: int) -> None: ... - def fromlist(self, __list: List[_T]) -> None: ... + def fromlist(self, __list: list[_T]) -> None: ... def fromunicode(self, __ustr: str) -> None: ... if sys.version_info >= (3, 10): def index(self, __v: _T, __start: int = ..., __stop: int = ...) -> int: ... @@ -41,7 +41,7 @@ class array(MutableSequence[_T], Generic[_T]): def reverse(self) -> None: ... def tobytes(self) -> bytes: ... def tofile(self, __f: BinaryIO) -> None: ... - def tolist(self) -> List[_T]: ... + def tolist(self) -> list[_T]: ... def tounicode(self) -> str: ... if sys.version_info < (3, 9): def fromstring(self, __buffer: bytes) -> None: ... diff --git a/stdlib/asyncio/base_events.pyi b/stdlib/asyncio/base_events.pyi index d3cdc9b31d26..349050258a16 100644 --- a/stdlib/asyncio/base_events.pyi +++ b/stdlib/asyncio/base_events.pyi @@ -9,7 +9,7 @@ from asyncio.tasks import Task from asyncio.transports import BaseTransport from collections.abc import Iterable from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket -from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Sequence, Tuple, TypeVar, Union, overload +from typing import IO, Any, Awaitable, Callable, Dict, Generator, Sequence, Tuple, TypeVar, Union, overload from typing_extensions import Literal if sys.version_info >= (3, 7): @@ -89,7 +89,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta): # Network I/O methods returning Futures. async def getaddrinfo( self, host: str | None, port: str | int | None, *, family: int = ..., type: int = ..., proto: int = ..., flags: int = ... - ) -> List[Tuple[AddressFamily, SocketKind, int, str, Tuple[str, int] | Tuple[str, int, int, int]]]: ... + ) -> list[Tuple[AddressFamily, SocketKind, int, str, Tuple[str, int] | Tuple[str, int, int, int]]]: ... async def getnameinfo(self, sockaddr: Tuple[str, int] | Tuple[str, int, int, int], flags: int = ...) -> Tuple[str, str]: ... if sys.version_info >= (3, 8): @overload diff --git a/stdlib/asyncio/base_futures.pyi b/stdlib/asyncio/base_futures.pyi index 270a69685c24..1c5f03e8ea72 100644 --- a/stdlib/asyncio/base_futures.pyi +++ b/stdlib/asyncio/base_futures.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Callable, List, Sequence, Tuple +from typing import Any, Callable, Sequence, Tuple from typing_extensions import Literal if sys.version_info >= (3, 7): @@ -19,4 +19,4 @@ if sys.version_info >= (3, 7): else: def _format_callbacks(cb: Sequence[Callable[[futures.Future[Any]], None]]) -> str: ... # undocumented -def _future_repr_info(future: futures.Future[Any]) -> List[str]: ... # undocumented +def _future_repr_info(future: futures.Future[Any]) -> list[str]: ... # undocumented diff --git a/stdlib/asyncio/base_subprocess.pyi b/stdlib/asyncio/base_subprocess.pyi index 96cea24f06a9..6165e0bb88d0 100644 --- a/stdlib/asyncio/base_subprocess.pyi +++ b/stdlib/asyncio/base_subprocess.pyi @@ -1,5 +1,5 @@ import subprocess -from typing import IO, Any, Callable, Deque, Dict, List, Optional, Sequence, Tuple, Union +from typing import IO, Any, Callable, Deque, Optional, Sequence, Tuple, Union from . import events, futures, protocols, transports @@ -13,9 +13,9 @@ class BaseSubprocessTransport(transports.SubprocessTransport): _proc: subprocess.Popen[Any] | None # undocumented _pid: int | None # undocumented _returncode: int | None # undocumented - _exit_waiters: List[futures.Future[Any]] # undocumented + _exit_waiters: list[futures.Future[Any]] # undocumented _pending_calls: Deque[Tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented - _pipes: Dict[int, _File] # undocumented + _pipes: dict[int, _File] # undocumented _finished: bool # undocumented def __init__( self, diff --git a/stdlib/asyncio/base_tasks.pyi b/stdlib/asyncio/base_tasks.pyi index 0bb394f1beb8..42e952ffacaf 100644 --- a/stdlib/asyncio/base_tasks.pyi +++ b/stdlib/asyncio/base_tasks.pyi @@ -1,9 +1,9 @@ from _typeshed import StrOrBytesPath from types import FrameType -from typing import Any, List +from typing import Any from . import tasks -def _task_repr_info(task: tasks.Task[Any]) -> List[str]: ... # undocumented -def _task_get_stack(task: tasks.Task[Any], limit: int | None) -> List[FrameType]: ... # undocumented +def _task_repr_info(task: tasks.Task[Any]) -> list[str]: ... # undocumented +def _task_get_stack(task: tasks.Task[Any], limit: int | None) -> list[FrameType]: ... # undocumented def _task_print_stack(task: tasks.Task[Any], limit: int | None, file: StrOrBytesPath) -> None: ... # undocumented diff --git a/stdlib/asyncio/compat.pyi b/stdlib/asyncio/compat.pyi index 2dbc03d543dc..1beeea9d6c3f 100644 --- a/stdlib/asyncio/compat.pyi +++ b/stdlib/asyncio/compat.pyi @@ -1,8 +1,7 @@ import sys -from typing import List if sys.version_info < (3, 7): PY34: bool PY35: bool PY352: bool - def flatten_list_bytes(list_of_data: List[bytes]) -> bytes: ... + def flatten_list_bytes(list_of_data: list[bytes]) -> bytes: ... diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index c66163b45ff7..419af1859b75 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -3,7 +3,7 @@ import sys from _typeshed import FileDescriptorLike, Self from abc import ABCMeta, abstractmethod from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket -from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Sequence, Tuple, TypeVar, Union, overload +from typing import IO, Any, Awaitable, Callable, Dict, Generator, Sequence, Tuple, TypeVar, Union, overload from typing_extensions import Literal from .base_events import Server @@ -120,7 +120,7 @@ class AbstractEventLoop(metaclass=ABCMeta): @abstractmethod async def getaddrinfo( self, host: str | None, port: str | int | None, *, family: int = ..., type: int = ..., proto: int = ..., flags: int = ... - ) -> List[Tuple[AddressFamily, SocketKind, int, str, Tuple[str, int] | Tuple[str, int, int, int]]]: ... + ) -> list[Tuple[AddressFamily, SocketKind, int, str, Tuple[str, int] | Tuple[str, int, int, int]]]: ... @abstractmethod async def getnameinfo(self, sockaddr: Tuple[str, int] | Tuple[str, int, int, int], flags: int = ...) -> Tuple[str, str]: ... if sys.version_info >= (3, 8): diff --git a/stdlib/asyncio/format_helpers.pyi b/stdlib/asyncio/format_helpers.pyi index 5e09a6798892..29cb8839716e 100644 --- a/stdlib/asyncio/format_helpers.pyi +++ b/stdlib/asyncio/format_helpers.pyi @@ -2,7 +2,7 @@ import functools import sys import traceback from types import FrameType, FunctionType -from typing import Any, Dict, Iterable, Tuple, Union, overload +from typing import Any, Iterable, Tuple, Union, overload class _HasWrapper: __wrapper__: _HasWrapper | FunctionType @@ -15,6 +15,6 @@ if sys.version_info >= (3, 7): @overload def _get_function_source(func: object) -> Tuple[str, int] | None: ... def _format_callback_source(func: object, args: Iterable[Any]) -> str: ... - def _format_args_and_kwargs(args: Iterable[Any], kwargs: Dict[str, Any]) -> str: ... - def _format_callback(func: object, args: Iterable[Any], kwargs: Dict[str, Any], suffix: str = ...) -> str: ... + def _format_args_and_kwargs(args: Iterable[Any], kwargs: dict[str, Any]) -> str: ... + def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = ...) -> str: ... def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> traceback.StackSummary: ... diff --git a/stdlib/asyncio/futures.pyi b/stdlib/asyncio/futures.pyi index a8954e75a03b..b05dd38635c9 100644 --- a/stdlib/asyncio/futures.pyi +++ b/stdlib/asyncio/futures.pyi @@ -1,6 +1,6 @@ import sys from concurrent.futures._base import Error, Future as _ConcurrentFuture -from typing import Any, Awaitable, Callable, Generator, Iterable, List, Tuple, TypeVar +from typing import Any, Awaitable, Callable, Generator, Iterable, Tuple, TypeVar from .events import AbstractEventLoop @@ -20,7 +20,7 @@ _S = TypeVar("_S") if sys.version_info < (3, 7): class _TracebackLogger: exc: BaseException - tb: List[str] + tb: list[str] def __init__(self, exc: Any, loop: AbstractEventLoop) -> None: ... def activate(self) -> None: ... def clear(self) -> None: ... @@ -38,11 +38,11 @@ class Future(Awaitable[_T], Iterable[_T]): def __del__(self) -> None: ... if sys.version_info >= (3, 7): def get_loop(self) -> AbstractEventLoop: ... - def _callbacks(self: _S) -> List[Tuple[Callable[[_S], Any], Context]]: ... + def _callbacks(self: _S) -> list[Tuple[Callable[[_S], Any], Context]]: ... def add_done_callback(self: _S, __fn: Callable[[_S], Any], *, context: Context | None = ...) -> None: ... else: @property - def _callbacks(self: _S) -> List[Callable[[_S], Any]]: ... + def _callbacks(self: _S) -> list[Callable[[_S], Any]]: ... def add_done_callback(self: _S, __fn: Callable[[_S], Any]) -> None: ... if sys.version_info >= (3, 9): def cancel(self, msg: str | None = ...) -> bool: ... diff --git a/stdlib/asyncio/sslproto.pyi b/stdlib/asyncio/sslproto.pyi index 7bbb6215e1d6..9dda54cc84bb 100644 --- a/stdlib/asyncio/sslproto.pyi +++ b/stdlib/asyncio/sslproto.pyi @@ -1,6 +1,6 @@ import ssl import sys -from typing import Any, Callable, ClassVar, Deque, Dict, List, Tuple +from typing import Any, Callable, ClassVar, Deque, Tuple from typing_extensions import Literal from . import constants, events, futures, protocols, transports @@ -35,11 +35,11 @@ class _SSLPipe: def need_ssldata(self) -> bool: ... @property def wrapped(self) -> bool: ... - def do_handshake(self, callback: Callable[[BaseException | None], None] | None = ...) -> List[bytes]: ... - def shutdown(self, callback: Callable[[], None] | None = ...) -> List[bytes]: ... + def do_handshake(self, callback: Callable[[BaseException | None], None] | None = ...) -> list[bytes]: ... + def shutdown(self, callback: Callable[[], None] | None = ...) -> list[bytes]: ... def feed_eof(self) -> None: ... - def feed_ssldata(self, data: bytes, only_handshake: bool = ...) -> Tuple[List[bytes], List[bytes]]: ... - def feed_appdata(self, data: bytes, offset: int = ...) -> Tuple[List[bytes], int]: ... + def feed_ssldata(self, data: bytes, only_handshake: bool = ...) -> Tuple[list[bytes], list[bytes]]: ... + def feed_appdata(self, data: bytes, offset: int = ...) -> Tuple[list[bytes], int]: ... class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport): @@ -49,7 +49,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport): _ssl_protocol: SSLProtocol _closed: bool def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ... - def get_extra_info(self, name: str, default: Any | None = ...) -> Dict[str, Any]: ... + def get_extra_info(self, name: str, default: Any | None = ...) -> dict[str, Any]: ... def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ... def get_protocol(self) -> protocols.BaseProtocol: ... def is_closing(self) -> bool: ... @@ -72,7 +72,7 @@ class SSLProtocol(protocols.Protocol): _server_side: bool _server_hostname: str | None _sslcontext: ssl.SSLContext - _extra: Dict[str, Any] + _extra: dict[str, Any] _write_backlog: Deque[Tuple[bytes, int]] _write_buffer_size: int _waiter: futures.Future[Any] diff --git a/stdlib/asyncio/staggered.pyi b/stdlib/asyncio/staggered.pyi index 93227bf2c6b9..6ac405ab77fd 100644 --- a/stdlib/asyncio/staggered.pyi +++ b/stdlib/asyncio/staggered.pyi @@ -1,9 +1,9 @@ import sys -from typing import Any, Awaitable, Callable, Iterable, List, Tuple +from typing import Any, Awaitable, Callable, Iterable, Tuple from . import events if sys.version_info >= (3, 8): async def staggered_race( coro_fns: Iterable[Callable[[], Awaitable[Any]]], delay: float | None, *, loop: events.AbstractEventLoop | None = ... - ) -> Tuple[Any, int | None, List[Exception | None]]: ... + ) -> Tuple[Any, int | None, list[Exception | None]]: ... diff --git a/stdlib/asyncio/tasks.pyi b/stdlib/asyncio/tasks.pyi index 1cce04305d9d..f9d57aae47a9 100644 --- a/stdlib/asyncio/tasks.pyi +++ b/stdlib/asyncio/tasks.pyi @@ -2,7 +2,7 @@ import concurrent.futures import sys from collections.abc import Awaitable, Generator, Iterable, Iterator from types import FrameType -from typing import Any, Generic, List, Optional, Set, TextIO, Tuple, TypeVar, Union, overload +from typing import Any, Generic, Optional, Set, TextIO, Tuple, TypeVar, Union, overload from typing_extensions import Literal from .events import AbstractEventLoop @@ -89,7 +89,7 @@ if sys.version_info >= (3, 10): coro_or_future6: _FutureT[Any], *coros_or_futures: _FutureT[Any], return_exceptions: bool = ..., - ) -> Future[List[Any]]: ... + ) -> Future[list[Any]]: ... @overload def gather(coro_or_future1: _FutureT[_T1], *, return_exceptions: bool = ...) -> Future[Tuple[_T1 | BaseException]]: ... @overload @@ -180,7 +180,7 @@ else: *coros_or_futures: _FutureT[Any], loop: AbstractEventLoop | None = ..., return_exceptions: bool = ..., - ) -> Future[List[Any]]: ... + ) -> Future[list[Any]]: ... @overload def gather( coro_or_future1: _FutureT[_T1], *, loop: AbstractEventLoop | None = ..., return_exceptions: bool = ... @@ -268,7 +268,7 @@ class Task(Future[_T], Generic[_T]): def get_coro(self) -> Generator[_TaskYieldType, None, _T] | Awaitable[_T]: ... def get_name(self) -> str: ... def set_name(self, __value: object) -> None: ... - def get_stack(self, *, limit: int | None = ...) -> List[FrameType]: ... + def get_stack(self, *, limit: int | None = ...) -> list[FrameType]: ... def print_stack(self, *, limit: int | None = ..., file: TextIO | None = ...) -> None: ... if sys.version_info >= (3, 9): def cancel(self, msg: str | None = ...) -> bool: ... diff --git a/stdlib/asyncio/transports.pyi b/stdlib/asyncio/transports.pyi index 0dc5f63cef53..51bf22b882b7 100644 --- a/stdlib/asyncio/transports.pyi +++ b/stdlib/asyncio/transports.pyi @@ -2,7 +2,7 @@ import sys from asyncio.events import AbstractEventLoop from asyncio.protocols import BaseProtocol from socket import _Address -from typing import Any, List, Mapping, Tuple +from typing import Any, Mapping, Tuple class BaseTransport: def __init__(self, extra: Mapping[Any, Any] | None = ...) -> None: ... @@ -22,7 +22,7 @@ class WriteTransport(BaseTransport): def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ... def get_write_buffer_size(self) -> int: ... def write(self, data: Any) -> None: ... - def writelines(self, list_of_data: List[Any]) -> None: ... + def writelines(self, list_of_data: list[Any]) -> None: ... def write_eof(self) -> None: ... def can_write_eof(self) -> bool: ... def abort(self) -> None: ... diff --git a/stdlib/asyncio/trsock.pyi b/stdlib/asyncio/trsock.pyi index ffb2095d4291..16c65d5683f6 100644 --- a/stdlib/asyncio/trsock.pyi +++ b/stdlib/asyncio/trsock.pyi @@ -1,7 +1,7 @@ import socket import sys from types import TracebackType -from typing import Any, BinaryIO, Iterable, List, NoReturn, Tuple, Type, Union, overload +from typing import Any, BinaryIO, Iterable, NoReturn, Tuple, Type, Union, overload if sys.version_info >= (3, 8): # These are based in socket, maybe move them out into _typeshed.pyi or such @@ -73,8 +73,8 @@ if sys.version_info >= (3, 8): def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> Tuple[int, _RetAddress]: ... def recvmsg_into( self, __buffers: Iterable[_WriteBuffer], __ancbufsize: int = ..., __flags: int = ... - ) -> Tuple[int, List[_CMSG], int, Any]: ... - def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> Tuple[bytes, List[_CMSG], int, Any]: ... + ) -> Tuple[int, list[_CMSG], int, Any]: ... + def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> Tuple[bytes, list[_CMSG], int, Any]: ... def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ... def recv(self, bufsize: int, flags: int = ...) -> bytes: ... def settimeout(self, value: float | None) -> None: ... diff --git a/stdlib/asyncio/windows_events.pyi b/stdlib/asyncio/windows_events.pyi index 8a8bfd8ecca8..19e456138394 100644 --- a/stdlib/asyncio/windows_events.pyi +++ b/stdlib/asyncio/windows_events.pyi @@ -1,7 +1,7 @@ import socket import sys from _typeshed import WriteableBuffer -from typing import IO, Any, Callable, ClassVar, List, NoReturn, Tuple, Type +from typing import IO, Any, Callable, ClassVar, NoReturn, Tuple, Type from . import events, futures, proactor_events, selector_events, streams, windows_utils @@ -36,14 +36,14 @@ class ProactorEventLoop(proactor_events.BaseProactorEventLoop): ) -> Tuple[proactor_events._ProactorDuplexPipeTransport, streams.StreamReaderProtocol]: ... async def start_serving_pipe( self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str - ) -> List[PipeServer]: ... + ) -> list[PipeServer]: ... class IocpProactor: def __init__(self, concurrency: int = ...) -> None: ... def __repr__(self) -> str: ... def __del__(self) -> None: ... def set_loop(self, loop: events.AbstractEventLoop) -> None: ... - def select(self, timeout: int | None = ...) -> List[futures.Future[Any]]: ... + def select(self, timeout: int | None = ...) -> list[futures.Future[Any]]: ... def recv(self, conn: socket.socket, nbytes: int, flags: int = ...) -> futures.Future[bytes]: ... if sys.version_info >= (3, 7): def recv_into(self, conn: socket.socket, buf: WriteableBuffer, flags: int = ...) -> futures.Future[Any]: ... diff --git a/stdlib/bdb.pyi b/stdlib/bdb.pyi index 5bee9dadb928..72b172ee66aa 100644 --- a/stdlib/bdb.pyi +++ b/stdlib/bdb.pyi @@ -1,5 +1,5 @@ from types import CodeType, FrameType, TracebackType -from typing import IO, Any, Callable, Dict, Iterable, List, Mapping, Set, SupportsInt, Tuple, Type, TypeVar +from typing import IO, Any, Callable, Iterable, Mapping, Set, SupportsInt, Tuple, Type, TypeVar _T = TypeVar("_T") _TraceDispatch = Callable[[FrameType, str, Any], Any] # TODO: Recursive type @@ -12,8 +12,8 @@ class BdbQuit(Exception): ... class Bdb: skip: Set[str] | None - breaks: Dict[str, List[int]] - fncache: Dict[str, str] + breaks: dict[str, list[int]] + fncache: dict[str, str] frame_returning: FrameType | None botframe: FrameType | None quitting: bool @@ -53,21 +53,21 @@ class Bdb: def clear_all_breaks(self) -> None: ... def get_bpbynumber(self, arg: SupportsInt) -> Breakpoint: ... def get_break(self, filename: str, lineno: int) -> bool: ... - def get_breaks(self, filename: str, lineno: int) -> List[Breakpoint]: ... - def get_file_breaks(self, filename: str) -> List[Breakpoint]: ... - def get_all_breaks(self) -> List[Breakpoint]: ... - def get_stack(self, f: FrameType | None, t: TracebackType | None) -> Tuple[List[Tuple[FrameType, int]], int]: ... + def get_breaks(self, filename: str, lineno: int) -> list[Breakpoint]: ... + def get_file_breaks(self, filename: str) -> list[Breakpoint]: ... + def get_all_breaks(self) -> list[Breakpoint]: ... + def get_stack(self, f: FrameType | None, t: TracebackType | None) -> Tuple[list[Tuple[FrameType, int]], int]: ... def format_stack_entry(self, frame_lineno: int, lprefix: str = ...) -> str: ... - def run(self, cmd: str | CodeType, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... - def runeval(self, expr: str, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... - def runctx(self, cmd: str | CodeType, globals: Dict[str, Any] | None, locals: Mapping[str, Any] | None) -> None: ... + def run(self, cmd: str | CodeType, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... + def runeval(self, expr: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... + def runctx(self, cmd: str | CodeType, globals: dict[str, Any] | None, locals: Mapping[str, Any] | None) -> None: ... def runcall(self, __func: Callable[..., _T], *args: Any, **kwds: Any) -> _T | None: ... class Breakpoint: next: int = ... - bplist: Dict[Tuple[str, int], List[Breakpoint]] = ... - bpbynumber: List[Breakpoint | None] = ... + bplist: dict[Tuple[str, int], list[Breakpoint]] = ... + bpbynumber: list[Breakpoint | None] = ... funcname: str | None func_first_executable_line: int | None diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 93db44b0c451..473c66e097e9 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -29,14 +29,12 @@ from typing import ( BinaryIO, ByteString, Callable, - Dict, FrozenSet, Generic, ItemsView, Iterable, Iterator, KeysView, - List, Mapping, MutableMapping, MutableSequence, @@ -84,10 +82,10 @@ _TBE = TypeVar("_TBE", bound="BaseException") class object: __doc__: str | None - __dict__: Dict[str, Any] + __dict__: dict[str, Any] __slots__: str | Iterable[str] __module__: str - __annotations__: Dict[str, Any] + __annotations__: dict[str, Any] @property def __class__(self: _T) -> Type[_T]: ... # Ignore errors about type mismatch between property getter and setter @@ -131,7 +129,7 @@ class type(object): __base__: type __bases__: Tuple[type, ...] __basicsize__: int - __dict__: Dict[str, Any] + __dict__: dict[str, Any] __dictoffset__: int __flags__: int __itemsize__: int @@ -144,16 +142,16 @@ class type(object): @overload def __init__(self, o: object) -> None: ... @overload - def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any], **kwds: Any) -> None: ... + def __init__(self, name: str, bases: Tuple[type, ...], dict: dict[str, Any], **kwds: Any) -> None: ... @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]: ... + def __subclasses__(self: _TT) -> list[_TT]: ... # Note: the documentation doesnt specify what the return type is, the standard # implementation seems to be returning a list. - def mro(self) -> List[type]: ... + def mro(self) -> list[type]: ... def __instancecheck__(self, instance: Any) -> bool: ... def __subclasscheck__(self, subclass: type) -> bool: ... @classmethod @@ -378,10 +376,10 @@ class str(Sequence[str]): def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ... def rjust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... def rpartition(self, __sep: str) -> Tuple[str, str, str]: ... - def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> List[str]: ... + def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... def rstrip(self, __chars: str | None = ...) -> str: ... - def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> List[str]: ... - def splitlines(self, keepends: bool = ...) -> List[str]: ... + def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... + def splitlines(self, keepends: bool = ...) -> list[str]: ... def startswith( self, __prefix: str | Tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> bool: ... @@ -393,10 +391,10 @@ class str(Sequence[str]): def zfill(self, __width: SupportsIndex) -> str: ... @staticmethod @overload - def maketrans(__x: Dict[int, _T] | Dict[str, _T] | Dict[str | int, _T]) -> Dict[int, _T]: ... + def maketrans(__x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ... @staticmethod @overload - def maketrans(__x: str, __y: str, __z: str | None = ...) -> Dict[int, int | None]: ... + def maketrans(__x: str, __y: str, __z: str | None = ...) -> dict[int, int | None]: ... def __add__(self, s: str) -> str: ... # Incompatible with Sequence.__contains__ def __contains__(self, o: str) -> bool: ... # type: ignore @@ -477,10 +475,10 @@ class bytes(ByteString): ) -> int: ... def rjust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ... def rpartition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ... - def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ... + def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ... def rstrip(self, __bytes: bytes | None = ...) -> bytes: ... - def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ... - def splitlines(self, keepends: bool = ...) -> List[bytes]: ... + def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ... + def splitlines(self, keepends: bool = ...) -> list[bytes]: ... def startswith( self, __prefix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> bool: ... @@ -579,10 +577,10 @@ class bytearray(MutableSequence[int], ByteString): ) -> int: ... def rjust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytearray: ... def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ... - def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ... + def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ... def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ... - def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ... - def splitlines(self, keepends: bool = ...) -> List[bytearray]: ... + def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ... + def splitlines(self, keepends: bool = ...) -> list[bytearray]: ... def startswith( self, __prefix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> bool: ... @@ -644,7 +642,7 @@ class memoryview(Sized, Sequence[int]): def __exit__( 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: ... + def cast(self, format: str, shape: list[int] | Tuple[int] = ...) -> memoryview: ... @overload def __getitem__(self, i: SupportsIndex) -> int: ... @overload @@ -660,7 +658,7 @@ class memoryview(Sized, Sequence[int]): def tobytes(self, order: Literal["C", "F", "A"] | None = ...) -> bytes: ... else: def tobytes(self) -> bytes: ... - def tolist(self) -> List[int]: ... + def tolist(self) -> list[int]: ... if sys.version_info >= (3, 8): def toreadonly(self) -> memoryview: ... def release(self) -> None: ... @@ -739,7 +737,7 @@ class function: __module__: str __code__: CodeType __qualname__: str - __annotations__: Dict[str, Any] + __annotations__: dict[str, Any] class list(MutableSequence[_T], Generic[_T]): @overload @@ -747,7 +745,7 @@ class list(MutableSequence[_T], Generic[_T]): @overload def __init__(self, iterable: Iterable[_T]) -> None: ... def clear(self) -> None: ... - def copy(self) -> List[_T]: ... + def copy(self) -> list[_T]: ... def append(self, __object: _T) -> None: ... def extend(self, __iterable: Iterable[_T]) -> None: ... def pop(self, __index: SupportsIndex = ...) -> _T: ... @@ -757,7 +755,7 @@ class list(MutableSequence[_T], Generic[_T]): def remove(self, __value: _T) -> None: ... def reverse(self) -> None: ... @overload - def sort(self: List[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> None: ... + def sort(self: list[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> None: ... @overload def sort(self, *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> None: ... def __len__(self) -> int: ... @@ -767,38 +765,38 @@ class list(MutableSequence[_T], Generic[_T]): @overload def __getitem__(self, i: SupportsIndex) -> _T: ... @overload - def __getitem__(self, s: slice) -> List[_T]: ... + def __getitem__(self, s: slice) -> list[_T]: ... @overload def __setitem__(self, i: SupportsIndex, o: _T) -> None: ... @overload def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... def __delitem__(self, i: SupportsIndex | slice) -> None: ... - def __add__(self, x: List[_T]) -> List[_T]: ... + def __add__(self, x: list[_T]) -> list[_T]: ... def __iadd__(self: _S, x: Iterable[_T]) -> _S: ... - def __mul__(self, n: SupportsIndex) -> List[_T]: ... - def __rmul__(self, n: SupportsIndex) -> List[_T]: ... + def __mul__(self, n: SupportsIndex) -> list[_T]: ... + def __rmul__(self, n: SupportsIndex) -> list[_T]: ... def __imul__(self: _S, n: SupportsIndex) -> _S: ... def __contains__(self, o: object) -> bool: ... def __reversed__(self) -> Iterator[_T]: ... - def __gt__(self, x: List[_T]) -> bool: ... - def __ge__(self, x: List[_T]) -> bool: ... - def __lt__(self, x: List[_T]) -> bool: ... - def __le__(self, x: List[_T]) -> bool: ... + def __gt__(self, x: list[_T]) -> bool: ... + def __ge__(self, x: list[_T]) -> bool: ... + def __lt__(self, x: list[_T]) -> bool: ... + def __le__(self, x: list[_T]) -> bool: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): @overload - def __init__(self: Dict[_KT, _VT]) -> None: ... + def __init__(self: dict[_KT, _VT]) -> None: ... @overload - def __init__(self: Dict[str, _VT], **kwargs: _VT) -> None: ... + def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ... @overload def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ... @overload def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ... def clear(self) -> None: ... - def copy(self) -> Dict[_KT, _VT]: ... + def copy(self) -> dict[_KT, _VT]: ... def popitem(self) -> Tuple[_KT, _VT]: ... def setdefault(self, __key: _KT, __default: _VT = ...) -> _VT: ... @overload @@ -827,9 +825,9 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): __hash__: None # type: ignore if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... - def __or__(self, __value: Mapping[_T1, _T2]) -> Dict[_KT | _T1, _VT | _T2]: ... - def __ror__(self, __value: Mapping[_T1, _T2]) -> Dict[_KT | _T1, _VT | _T2]: ... - def __ior__(self, __value: Mapping[_KT, _VT]) -> Dict[_KT, _VT]: ... # type: ignore + def __or__(self, __value: Mapping[_T1, _T2]) -> dict[_KT | _T1, _VT | _T2]: ... + def __ror__(self, __value: Mapping[_T1, _T2]) -> dict[_KT | _T1, _VT | _T2]: ... + def __ior__(self, __value: Mapping[_KT, _VT]) -> dict[_KT, _VT]: ... # type: ignore class set(MutableSet[_T], Generic[_T]): def __init__(self, iterable: Iterable[_T] = ...) -> None: ... @@ -998,16 +996,16 @@ else: def copyright() -> None: ... def credits() -> None: ... def delattr(__obj: Any, __name: str) -> None: ... -def dir(__o: object = ...) -> List[str]: ... +def dir(__o: object = ...) -> list[str]: ... @overload def divmod(__x: SupportsDivMod[_T_contra, _T_co], __y: _T_contra) -> _T_co: ... @overload def divmod(__x: _T_contra, __y: SupportsRDivMod[_T_contra, _T_co]) -> _T_co: ... def eval( - __source: str | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... + __source: str | bytes | CodeType, __globals: dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... ) -> Any: ... def exec( - __source: str | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... + __source: str | bytes | CodeType, __globals: dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ... ) -> Any: ... def exit(code: object = ...) -> NoReturn: ... @@ -1031,7 +1029,7 @@ def getattr(__o: object, name: str, __default: None) -> Any | None: ... def getattr(__o: object, name: str, __default: bool) -> Any | bool: ... @overload def getattr(__o: object, name: str, __default: _T) -> Any | _T: ... -def globals() -> Dict[str, Any]: ... +def globals() -> dict[str, Any]: ... def hasattr(__obj: object, __name: str) -> bool: ... def hash(__obj: object) -> int: ... def help(*args: Any, **kwds: Any) -> None: ... @@ -1059,7 +1057,7 @@ else: def len(__obj: Sized) -> int: ... def license() -> None: ... -def locals() -> Dict[str, Any]: ... +def locals() -> dict[str, Any]: ... class map(Iterator[_S], Generic[_S]): @overload @@ -1286,9 +1284,9 @@ def round(number: SupportsRound[Any], ndigits: None) -> int: ... def round(number: SupportsRound[_T], ndigits: SupportsIndex) -> _T: ... def setattr(__obj: object, __name: str, __value: Any) -> None: ... @overload -def sorted(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> List[SupportsLessThanT]: ... +def sorted(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> list[SupportsLessThanT]: ... @overload -def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> List[_T]: ... +def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> list[_T]: ... if sys.version_info >= (3, 8): @overload @@ -1302,7 +1300,7 @@ else: @overload def sum(__iterable: Iterable[_T], __start: _S) -> _T | _S: ... -def vars(__object: Any = ...) -> Dict[str, Any]: ... +def vars(__object: Any = ...) -> dict[str, Any]: ... class zip(Iterator[_T_co], Generic[_T_co]): @overload diff --git a/stdlib/bz2.pyi b/stdlib/bz2.pyi index 66e7b62fe590..e7b57ec54db0 100644 --- a/stdlib/bz2.pyi +++ b/stdlib/bz2.pyi @@ -2,7 +2,7 @@ import _compression import sys from _compression import BaseStream from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer -from typing import IO, Any, Iterable, List, Protocol, TextIO, TypeVar, overload +from typing import IO, Any, Iterable, Protocol, TextIO, TypeVar, overload from typing_extensions import Literal, SupportsIndex # The following attributes and methods are optional: @@ -113,7 +113,7 @@ class BZ2File(BaseStream, IO[bytes]): def read1(self, size: int = ...) -> bytes: ... def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore def readinto(self, b: WriteableBuffer) -> int: ... - def readlines(self, size: SupportsIndex = ...) -> List[bytes]: ... + def readlines(self, size: SupportsIndex = ...) -> list[bytes]: ... def seek(self, offset: int, whence: int = ...) -> int: ... def write(self, data: ReadableBuffer) -> int: ... def writelines(self, seq: Iterable[ReadableBuffer]) -> None: ... diff --git a/stdlib/cProfile.pyi b/stdlib/cProfile.pyi index 969f13adca37..f4a7ab50cc11 100644 --- a/stdlib/cProfile.pyi +++ b/stdlib/cProfile.pyi @@ -1,11 +1,11 @@ import sys from _typeshed import Self, StrOrBytesPath from types import CodeType -from typing import Any, Callable, Dict, Tuple, TypeVar +from typing import Any, Callable, Tuple, TypeVar def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... def runctx( - statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: str | None = ..., sort: str | int = ... + statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = ..., sort: str | int = ... ) -> None: ... _T = TypeVar("_T") @@ -23,7 +23,7 @@ class Profile: def create_stats(self) -> None: ... def snapshot_stats(self) -> None: ... def run(self: Self, cmd: str) -> Self: ... - def runctx(self: Self, cmd: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> Self: ... + def runctx(self: Self, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> Self: ... def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... if sys.version_info >= (3, 8): def __enter__(self: Self) -> Self: ... diff --git a/stdlib/calendar.pyi b/stdlib/calendar.pyi index 2b59c502fa9e..9d701a788a80 100644 --- a/stdlib/calendar.pyi +++ b/stdlib/calendar.pyi @@ -1,7 +1,7 @@ import datetime import sys from time import struct_time -from typing import Any, Iterable, List, Optional, Sequence, Tuple +from typing import Any, Iterable, Optional, Sequence, Tuple _LocaleType = Tuple[Optional[str], Optional[str]] @@ -27,12 +27,12 @@ class Calendar: def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: ... def itermonthdays2(self, year: int, month: int) -> Iterable[Tuple[int, int]]: ... def itermonthdays(self, year: int, month: int) -> Iterable[int]: ... - def monthdatescalendar(self, year: int, month: int) -> List[List[datetime.date]]: ... - def monthdays2calendar(self, year: int, month: int) -> List[List[Tuple[int, int]]]: ... - def monthdayscalendar(self, year: int, month: int) -> List[List[int]]: ... - def yeardatescalendar(self, year: int, width: int = ...) -> List[List[int]]: ... - def yeardays2calendar(self, year: int, width: int = ...) -> List[List[Tuple[int, int]]]: ... - def yeardayscalendar(self, year: int, width: int = ...) -> List[List[int]]: ... + def monthdatescalendar(self, year: int, month: int) -> list[list[datetime.date]]: ... + def monthdays2calendar(self, year: int, month: int) -> list[list[Tuple[int, int]]]: ... + def monthdayscalendar(self, year: int, month: int) -> list[list[int]]: ... + def yeardatescalendar(self, year: int, width: int = ...) -> list[list[int]]: ... + def yeardays2calendar(self, year: int, width: int = ...) -> list[list[Tuple[int, int]]]: ... + def yeardayscalendar(self, year: int, width: int = ...) -> list[list[int]]: ... if sys.version_info >= (3, 7): def itermonthdays3(self, year: int, month: int) -> Iterable[Tuple[int, int, int]]: ... def itermonthdays4(self, year: int, month: int) -> Iterable[Tuple[int, int, int, int]]: ... @@ -50,7 +50,7 @@ class TextCalendar(Calendar): def pryear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ... def firstweekday() -> int: ... -def monthcalendar(year: int, month: int) -> List[List[int]]: ... +def monthcalendar(year: int, month: int) -> list[list[int]]: ... def prweek(theweek: int, width: int) -> None: ... def week(theweek: int, width: int) -> str: ... def weekheader(width: int) -> str: ... @@ -69,9 +69,9 @@ class HTMLCalendar(Calendar): def formatyear(self, theyear: int, width: int = ...) -> str: ... def formatyearpage(self, theyear: int, width: int = ..., css: str | None = ..., encoding: str | None = ...) -> str: ... if sys.version_info >= (3, 7): - cssclasses: List[str] + cssclasses: list[str] cssclass_noday: str - cssclasses_weekday_head: List[str] + cssclasses_weekday_head: list[str] cssclass_month_head: str cssclass_month: str cssclass_year: str diff --git a/stdlib/cgitb.pyi b/stdlib/cgitb.pyi index b9ef8e312aec..90226dc134e8 100644 --- a/stdlib/cgitb.pyi +++ b/stdlib/cgitb.pyi @@ -1,6 +1,6 @@ from _typeshed import StrOrBytesPath from types import FrameType, TracebackType -from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type +from typing import IO, Any, Callable, Optional, Tuple, Type _ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] @@ -8,10 +8,10 @@ def reset() -> str: ... # undocumented def small(text: str) -> str: ... # undocumented def strong(text: str) -> str: ... # undocumented def grey(text: str) -> str: ... # undocumented -def lookup(name: str, frame: FrameType, locals: Dict[str, Any]) -> Tuple[str | None, Any]: ... # undocumented +def lookup(name: str, frame: FrameType, locals: dict[str, Any]) -> Tuple[str | None, Any]: ... # undocumented def scanvars( - reader: Callable[[], bytes], frame: FrameType, locals: Dict[str, Any] -) -> List[Tuple[str, str | None, Any]]: ... # undocumented + reader: Callable[[], bytes], frame: FrameType, locals: dict[str, Any] +) -> list[Tuple[str, str | None, Any]]: ... # undocumented def html(einfo: _ExcInfo, context: int = ...) -> str: ... def text(einfo: _ExcInfo, context: int = ...) -> str: ... diff --git a/stdlib/cmd.pyi b/stdlib/cmd.pyi index ffccba84ec16..9f2593d3bfdf 100644 --- a/stdlib/cmd.pyi +++ b/stdlib/cmd.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Callable, List, Tuple +from typing import IO, Any, Callable, Tuple class Cmd: prompt: str @@ -14,7 +14,7 @@ class Cmd: use_rawinput: bool stdin: IO[str] stdout: IO[str] - cmdqueue: List[str] + cmdqueue: list[str] completekey: str def __init__(self, completekey: str = ..., stdin: IO[str] | None = ..., stdout: IO[str] | None = ...) -> None: ... old_completer: Callable[[str, int], str | None] | None @@ -27,13 +27,13 @@ class Cmd: def onecmd(self, line: str) -> bool: ... def emptyline(self) -> bool: ... def default(self, line: str) -> bool: ... - def completedefault(self, *ignored: Any) -> List[str]: ... - def completenames(self, text: str, *ignored: Any) -> List[str]: ... - completion_matches: List[str] | None - def complete(self, text: str, state: int) -> List[str] | None: ... - def get_names(self) -> List[str]: ... + def completedefault(self, *ignored: Any) -> list[str]: ... + def completenames(self, text: str, *ignored: Any) -> list[str]: ... + completion_matches: list[str] | None + def complete(self, text: str, state: int) -> list[str] | None: ... + def get_names(self) -> list[str]: ... # Only the first element of args matters. - def complete_help(self, *args: Any) -> List[str]: ... + def complete_help(self, *args: Any) -> list[str]: ... def do_help(self, arg: str) -> bool | None: ... - def print_topics(self, header: str, cmds: List[str] | None, cmdlen: Any, maxcol: int) -> None: ... - def columnize(self, list: List[str] | None, displaywidth: int = ...) -> None: ... + def print_topics(self, header: str, cmds: list[str] | None, cmdlen: Any, maxcol: int) -> None: ... + def columnize(self, list: list[str] | None, displaywidth: int = ...) -> None: ... diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index dffd6c104f64..9f27cfebf099 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -2,22 +2,7 @@ import sys import types from _typeshed import Self from abc import abstractmethod -from typing import ( - IO, - Any, - BinaryIO, - Callable, - Generator, - Iterable, - Iterator, - List, - Protocol, - TextIO, - Tuple, - Type, - TypeVar, - overload, -) +from typing import IO, Any, BinaryIO, Callable, Generator, Iterable, Iterator, Protocol, TextIO, Tuple, Type, TypeVar, overload from typing_extensions import Literal # TODO: this only satisfies the most common interface, where @@ -204,7 +189,7 @@ class StreamReader(Codec): def __init__(self, stream: IO[bytes], errors: str = ...) -> None: ... def read(self, size: int = ..., chars: int = ..., firstline: bool = ...) -> str: ... def readline(self, size: int | None = ..., keepends: bool = ...) -> str: ... - def readlines(self, sizehint: int | None = ..., keepends: bool = ...) -> List[str]: ... + 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: ... @@ -219,7 +204,7 @@ class StreamReaderWriter(TextIO): def __init__(self, stream: IO[bytes], Reader: _StreamReader, Writer: _StreamWriter, errors: str = ...) -> None: ... def read(self, size: int = ...) -> str: ... def readline(self, size: int | None = ...) -> str: ... - def readlines(self, sizehint: int | None = ...) -> List[str]: ... + def readlines(self, sizehint: int | None = ...) -> list[str]: ... def __next__(self) -> str: ... def __iter__(self: _T) -> _T: ... # This actually returns None, but that's incompatible with the supertype @@ -257,7 +242,7 @@ class StreamRecoder(BinaryIO): ) -> None: ... def read(self, size: int = ...) -> bytes: ... def readline(self, size: int | None = ...) -> bytes: ... - def readlines(self, sizehint: int | None = ...) -> List[bytes]: ... + def readlines(self, sizehint: int | None = ...) -> list[bytes]: ... def __next__(self) -> bytes: ... def __iter__(self: _SRT) -> _SRT: ... def write(self, data: bytes) -> int: ... diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index b6bd10ec265f..0176ea461de4 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import Self -from typing import Any, Dict, Generic, List, NoReturn, Tuple, Type, TypeVar, overload +from typing import Any, Dict, Generic, NoReturn, Tuple, Type, TypeVar, overload if sys.version_info >= (3, 10): from typing import ( @@ -41,7 +41,7 @@ else: ) -> Type[Tuple[Any, ...]]: ... class UserDict(MutableMapping[_KT, _VT]): - data: Dict[_KT, _VT] + data: dict[_KT, _VT] def __init__(self, __dict: Mapping[_KT, _VT] | None = ..., **kwargs: _VT) -> None: ... def __len__(self) -> int: ... def __getitem__(self, key: _KT) -> _VT: ... @@ -54,7 +54,7 @@ class UserDict(MutableMapping[_KT, _VT]): def fromkeys(cls: Type[_S], iterable: Iterable[_KT], value: _VT | None = ...) -> _S: ... class UserList(MutableSequence[_T]): - data: List[_T] + data: list[_T] def __init__(self, initlist: Iterable[_T] | None = ...) -> None: ... def __lt__(self, other: object) -> bool: ... def __le__(self, other: object) -> bool: ... @@ -138,10 +138,10 @@ class UserString(Sequence[str]): def lstrip(self: _UserStringT, chars: str | None = ...) -> _UserStringT: ... @staticmethod @overload - def maketrans(x: Dict[int, _T] | Dict[str, _T] | Dict[str | int, _T]) -> Dict[int, _T]: ... + def maketrans(x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ... @staticmethod @overload - def maketrans(x: str, y: str, z: str = ...) -> Dict[int, int | None]: ... + def maketrans(x: str, y: str, z: str = ...) -> dict[int, int | None]: ... def partition(self, sep: str) -> Tuple[str, str, str]: ... if sys.version_info >= (3, 9): def removeprefix(self: _UserStringT, __prefix: str | UserString) -> _UserStringT: ... @@ -152,9 +152,9 @@ class UserString(Sequence[str]): def rjust(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ... def rpartition(self, sep: str) -> Tuple[str, str, str]: ... def rstrip(self: _UserStringT, chars: str | None = ...) -> _UserStringT: ... - def split(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ... - def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ... - def splitlines(self, keepends: bool = ...) -> List[str]: ... + def split(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ... + def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ... + def splitlines(self, keepends: bool = ...) -> list[str]: ... def startswith(self, prefix: str | Tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ... def strip(self: _UserStringT, chars: str | None = ...) -> _UserStringT: ... def swapcase(self: _UserStringT) -> _UserStringT: ... @@ -214,7 +214,7 @@ class Counter(Dict[_T, int], Generic[_T]): def __init__(self, __iterable: Iterable[_T]) -> None: ... def copy(self: _S) -> _S: ... def elements(self) -> Iterator[_T]: ... - def most_common(self, n: int | None = ...) -> List[Tuple[_T, int]]: ... + def most_common(self, n: int | None = ...) -> list[Tuple[_T, int]]: ... @classmethod def fromkeys(cls, iterable: Any, v: int | None = ...) -> NoReturn: ... # type: ignore @overload @@ -284,7 +284,7 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): def copy(self: _S) -> _S: ... class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): - maps: List[Mapping[_KT, _VT]] + maps: list[Mapping[_KT, _VT]] def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ... def new_child(self, m: Mapping[_KT, _VT] | None = ...) -> ChainMap[_KT, _VT]: ... @property diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index e804b82d87cd..eaa6c6440636 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -3,7 +3,7 @@ import threading from _typeshed import Self from abc import abstractmethod from logging import Logger -from typing import Any, Callable, Container, Generic, Iterable, Iterator, List, Protocol, Sequence, Set, TypeVar, overload +from typing import Any, Callable, Container, Generic, Iterable, Iterator, Protocol, Sequence, Set, TypeVar, overload if sys.version_info >= (3, 9): from types import GenericAlias @@ -86,7 +86,7 @@ def wait(fs: Iterable[Future[_T]], timeout: float | None = ..., return_when: str class _Waiter: event: threading.Event - finished_futures: List[Future[Any]] + finished_futures: list[Future[Any]] def __init__(self) -> None: ... def add_result(self, future: Future[Any]) -> None: ... def add_exception(self, future: Future[Any]) -> None: ... diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index 87cf96a40f85..a860911a4f31 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -8,7 +8,6 @@ from typing import ( Dict, Iterable, Iterator, - List, Mapping, MutableMapping, Optional, @@ -98,12 +97,12 @@ class RawConfigParser(_parser): def __delitem__(self, section: str) -> None: ... def __iter__(self) -> Iterator[str]: ... def defaults(self) -> _section: ... - def sections(self) -> List[str]: ... + def sections(self) -> list[str]: ... def add_section(self, section: str) -> None: ... def has_section(self, section: str) -> bool: ... - def options(self, section: str) -> List[str]: ... + def options(self, section: str) -> list[str]: ... def has_option(self, section: str, option: str) -> bool: ... - def read(self, filenames: _Path | Iterable[_Path], encoding: str | None = ...) -> List[str]: ... + def read(self, filenames: _Path | Iterable[_Path], encoding: str | None = ...) -> list[str]: ... def read_file(self, f: Iterable[str], source: str | None = ...) -> None: ... def read_string(self, string: str, source: str = ...) -> None: ... def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = ...) -> None: ... @@ -146,7 +145,7 @@ class RawConfigParser(_parser): @overload def items(self, *, raw: bool = ..., vars: _section | None = ...) -> AbstractSet[Tuple[str, SectionProxy]]: ... @overload - def items(self, section: str, raw: bool = ..., vars: _section | None = ...) -> List[Tuple[str, str]]: ... + def items(self, section: str, raw: bool = ..., vars: _section | None = ...) -> list[Tuple[str, str]]: ... def set(self, section: str, option: str, value: str | None = ...) -> None: ... def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = ...) -> None: ... def remove_option(self, section: str, option: str) -> bool: ... @@ -237,7 +236,7 @@ class InterpolationSyntaxError(InterpolationError): ... class ParsingError(Error): source: str - errors: List[Tuple[int, str]] + errors: list[Tuple[int, str]] def __init__(self, source: str | None = ..., filename: str | None = ...) -> None: ... def append(self, lineno: int, line: str) -> None: ... diff --git a/stdlib/copy.pyi b/stdlib/copy.pyi index c88f92846ddf..a5f9420e3811 100644 --- a/stdlib/copy.pyi +++ b/stdlib/copy.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, TypeVar +from typing import Any, TypeVar _T = TypeVar("_T") @@ -6,7 +6,7 @@ _T = TypeVar("_T") PyStringMap: Any # Note: memo and _nil are internal kwargs. -def deepcopy(x: _T, memo: Dict[int, Any] | None = ..., _nil: Any = ...) -> _T: ... +def deepcopy(x: _T, memo: dict[int, Any] | None = ..., _nil: Any = ...) -> _T: ... def copy(x: _T) -> _T: ... class Error(Exception): ... diff --git a/stdlib/copyreg.pyi b/stdlib/copyreg.pyi index 91b099888bab..d275968d586f 100644 --- a/stdlib/copyreg.pyi +++ b/stdlib/copyreg.pyi @@ -1,9 +1,9 @@ -from typing import Any, Callable, Hashable, List, Optional, SupportsInt, Tuple, TypeVar, Union +from typing import Any, Callable, Hashable, Optional, SupportsInt, Tuple, TypeVar, Union _TypeT = TypeVar("_TypeT", bound=type) _Reduce = Union[Tuple[Callable[..., _TypeT], Tuple[Any, ...]], Tuple[Callable[..., _TypeT], Tuple[Any, ...], Optional[Any]]] -__all__: List[str] +__all__: list[str] def pickle( ob_type: _TypeT, diff --git a/stdlib/crypt.pyi b/stdlib/crypt.pyi index d453450308fc..27e30433f702 100644 --- a/stdlib/crypt.pyi +++ b/stdlib/crypt.pyi @@ -1,5 +1,4 @@ import sys -from typing import List class _Method: ... @@ -10,7 +9,7 @@ METHOD_SHA512: _Method if sys.version_info >= (3, 7): METHOD_BLOWFISH: _Method -methods: List[_Method] +methods: list[_Method] if sys.version_info >= (3, 7): def mksalt(method: _Method | None = ..., *, rounds: int | None = ...) -> str: ... diff --git a/stdlib/csv.pyi b/stdlib/csv.pyi index 5d82a639cd56..6e242f495948 100644 --- a/stdlib/csv.pyi +++ b/stdlib/csv.pyi @@ -17,7 +17,7 @@ from _csv import ( unregister_dialect as unregister_dialect, writer as writer, ) -from typing import Any, Generic, Iterable, Iterator, List, Mapping, Sequence, Type, TypeVar, overload +from typing import Any, Generic, Iterable, Iterator, Mapping, Sequence, Type, TypeVar, overload if sys.version_info >= (3, 8): from typing import Dict as _DictReadMapping @@ -100,7 +100,7 @@ class DictWriter(Generic[_T]): def writerows(self, rowdicts: Iterable[Mapping[_T, Any]]) -> None: ... class Sniffer(object): - preferred: List[str] + preferred: list[str] def __init__(self) -> None: ... def sniff(self, sample: str, delimiters: str | None = ...) -> Type[Dialect]: ... def has_header(self, sample: str) -> bool: ... diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index e678ff5c3bf0..88de35271783 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -7,7 +7,6 @@ from typing import ( Generic, Iterable, Iterator, - List, Mapping, Optional, Sequence, @@ -187,7 +186,7 @@ class pointer(Generic[_CT], _PointerLike, _CData): @overload def __getitem__(self, i: int) -> _CT: ... @overload - def __getitem__(self, s: slice) -> List[_CT]: ... + def __getitem__(self, s: slice) -> list[_CT]: ... @overload def __setitem__(self, i: int, o: _CT) -> None: ... @overload @@ -296,7 +295,7 @@ class Array(Generic[_CT], _CData): @overload def __getitem__(self, i: int) -> Any: ... @overload - def __getitem__(self, s: slice) -> List[Any]: ... + def __getitem__(self, s: slice) -> list[Any]: ... @overload def __setitem__(self, i: int, o: Any) -> None: ... @overload diff --git a/stdlib/curses/ascii.pyi b/stdlib/curses/ascii.pyi index 05efb326687a..66efbe36a7df 100644 --- a/stdlib/curses/ascii.pyi +++ b/stdlib/curses/ascii.pyi @@ -1,4 +1,4 @@ -from typing import List, TypeVar +from typing import TypeVar _CharT = TypeVar("_CharT", str, int) @@ -39,7 +39,7 @@ US: int SP: int DEL: int -controlnames: List[int] +controlnames: list[int] def isalnum(c: str | int) -> bool: ... def isalpha(c: str | int) -> bool: ... diff --git a/stdlib/dataclasses.pyi b/stdlib/dataclasses.pyi index 551b33172df5..7ea887da9465 100644 --- a/stdlib/dataclasses.pyi +++ b/stdlib/dataclasses.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Tuple, Type, TypeVar, overload +from typing import Any, Callable, Generic, Iterable, Mapping, Tuple, Type, TypeVar, overload from typing_extensions import Protocol if sys.version_info >= (3, 9): @@ -16,13 +16,13 @@ if sys.version_info >= (3, 10): class KW_ONLY: ... @overload -def asdict(obj: Any) -> Dict[str, Any]: ... +def asdict(obj: Any) -> dict[str, Any]: ... @overload -def asdict(obj: Any, *, dict_factory: Callable[[List[Tuple[str, Any]]], _T]) -> _T: ... +def asdict(obj: Any, *, dict_factory: Callable[[list[Tuple[str, Any]]], _T]) -> _T: ... @overload def astuple(obj: Any) -> Tuple[Any, ...]: ... @overload -def astuple(obj: Any, *, tuple_factory: Callable[[List[Any]], _T]) -> _T: ... +def astuple(obj: Any, *, tuple_factory: Callable[[list[Any]], _T]) -> _T: ... if sys.version_info >= (3, 10): @overload @@ -192,7 +192,7 @@ if sys.version_info >= (3, 10): fields: Iterable[str | Tuple[str, type] | Tuple[str, type, Field[Any]]], *, bases: Tuple[type, ...] = ..., - namespace: Dict[str, Any] | None = ..., + namespace: dict[str, Any] | None = ..., init: bool = ..., repr: bool = ..., eq: bool = ..., @@ -209,7 +209,7 @@ else: fields: Iterable[str | Tuple[str, type] | Tuple[str, type, Field[Any]]], *, bases: Tuple[type, ...] = ..., - namespace: Dict[str, Any] | None = ..., + namespace: dict[str, Any] | None = ..., init: bool = ..., repr: bool = ..., eq: bool = ..., diff --git a/stdlib/dbm/gnu.pyi b/stdlib/dbm/gnu.pyi index 6cb2cac24485..7cec827e8992 100644 --- a/stdlib/dbm/gnu.pyi +++ b/stdlib/dbm/gnu.pyi @@ -1,6 +1,6 @@ from _typeshed import Self from types import TracebackType -from typing import List, Type, TypeVar, Union, overload +from typing import Type, TypeVar, Union, overload _T = TypeVar("_T") _KeyType = Union[str, bytes] @@ -28,7 +28,7 @@ class _gdbm: def get(self, k: _KeyType) -> bytes | None: ... @overload def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ... - def keys(self) -> List[bytes]: ... + def keys(self) -> list[bytes]: ... def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... # Don't exist at runtime __new__: None # type: ignore diff --git a/stdlib/dbm/ndbm.pyi b/stdlib/dbm/ndbm.pyi index 4da04feed9cb..076f10bc7fdf 100644 --- a/stdlib/dbm/ndbm.pyi +++ b/stdlib/dbm/ndbm.pyi @@ -1,6 +1,6 @@ from _typeshed import Self from types import TracebackType -from typing import List, Type, TypeVar, Union, overload +from typing import Type, TypeVar, Union, overload _T = TypeVar("_T") _KeyType = Union[str, bytes] @@ -26,7 +26,7 @@ class _dbm: def get(self, k: _KeyType) -> bytes | None: ... @overload def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ... - def keys(self) -> List[bytes]: ... + def keys(self) -> list[bytes]: ... def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... # Don't exist at runtime __new__: None # type: ignore diff --git a/stdlib/decimal.pyi b/stdlib/decimal.pyi index 15cb686c07ed..3c2f23fa4fd8 100644 --- a/stdlib/decimal.pyi +++ b/stdlib/decimal.pyi @@ -1,6 +1,6 @@ import numbers from types import TracebackType -from typing import Any, Container, Dict, List, NamedTuple, Sequence, Tuple, Type, TypeVar, Union, overload +from typing import Any, Container, NamedTuple, Sequence, Tuple, Type, TypeVar, Union, overload _Decimal = Union[Decimal, int] _DecimalNew = Union[Decimal, float, str, Tuple[int, Sequence[int], int]] @@ -164,8 +164,8 @@ class Context(object): Emax: int capitals: int clamp: int - traps: Dict[_TrapType, bool] - flags: Dict[_TrapType, bool] + traps: dict[_TrapType, bool] + flags: dict[_TrapType, bool] def __init__( self, prec: int | None = ..., @@ -174,9 +174,9 @@ class Context(object): Emax: int | None = ..., capitals: int | None = ..., clamp: int | None = ..., - flags: None | Dict[_TrapType, bool] | Container[_TrapType] = ..., - traps: None | Dict[_TrapType, bool] | Container[_TrapType] = ..., - _ignored_flags: List[_TrapType] | None = ..., + flags: None | dict[_TrapType, bool] | Container[_TrapType] = ..., + traps: None | dict[_TrapType, bool] | Container[_TrapType] = ..., + _ignored_flags: list[_TrapType] | None = ..., ) -> None: ... # __setattr__() only allows to set a specific set of attributes, # already defined above. diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index 7a1310160f63..5db947293e42 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, List, NamedTuple, Sequence, Tuple, TypeVar, Union, overload +from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, NamedTuple, Sequence, Tuple, TypeVar, Union, overload if sys.version_info >= (3, 9): from types import GenericAlias @@ -23,9 +23,9 @@ class SequenceMatcher(Generic[_T]): def find_longest_match(self, alo: int = ..., ahi: int | None = ..., blo: int = ..., bhi: int | None = ...) -> Match: ... else: def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ... - def get_matching_blocks(self) -> List[Match]: ... - def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ... - def get_grouped_opcodes(self, n: int = ...) -> Iterable[List[Tuple[str, int, int, int, int]]]: ... + def get_matching_blocks(self) -> list[Match]: ... + def get_opcodes(self) -> list[Tuple[str, int, int, int, int]]: ... + def get_grouped_opcodes(self, n: int = ...) -> Iterable[list[Tuple[str, int, int, int, int]]]: ... def ratio(self) -> float: ... def quick_ratio(self) -> float: ... def real_quick_ratio(self) -> float: ... @@ -36,11 +36,11 @@ class SequenceMatcher(Generic[_T]): @overload def get_close_matches( # type: ignore word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ... -) -> List[AnyStr]: ... +) -> list[AnyStr]: ... @overload def get_close_matches( word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ... -) -> List[Sequence[_T]]: ... +) -> list[Sequence[_T]]: ... class Differ: def __init__(self, linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...) -> None: ... diff --git a/stdlib/dis.pyi b/stdlib/dis.pyi index 5790c7340b9f..d9e3c7213c84 100644 --- a/stdlib/dis.pyi +++ b/stdlib/dis.pyi @@ -16,7 +16,7 @@ from opcode import ( opname as opname, stack_effect as stack_effect, ) -from typing import IO, Any, Callable, Dict, Iterator, List, NamedTuple, Tuple, Union +from typing import IO, Any, Callable, Iterator, NamedTuple, Tuple, Union # Strictly this should not have to include Callable, but mypy doesn't use FunctionType # for functions (python/mypy#3171) @@ -44,9 +44,9 @@ class Bytecode: @classmethod def from_traceback(cls, tb: types.TracebackType) -> Bytecode: ... -COMPILER_FLAG_NAMES: Dict[int, str] +COMPILER_FLAG_NAMES: dict[int, str] -def findlabels(code: _have_code) -> List[int]: ... +def findlabels(code: _have_code) -> list[int]: ... def findlinestarts(code: _have_code) -> Iterator[Tuple[int, int]]: ... def pretty_flags(flags: int) -> str: ... def code_info(x: _have_code_or_string) -> str: ... diff --git a/stdlib/distutils/ccompiler.pyi b/stdlib/distutils/ccompiler.pyi index b0539bf9e5dc..d21de4691503 100644 --- a/stdlib/distutils/ccompiler.pyi +++ b/stdlib/distutils/ccompiler.pyi @@ -1,11 +1,11 @@ -from typing import Any, Callable, List, Optional, Tuple, Union +from typing import Any, Callable, Optional, Tuple, Union _Macro = Union[Tuple[str], Tuple[str, Optional[str]]] def gen_lib_options( - compiler: CCompiler, library_dirs: List[str], runtime_library_dirs: List[str], libraries: List[str] -) -> List[str]: ... -def gen_preprocess_options(macros: List[_Macro], include_dirs: List[str]) -> List[str]: ... + compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str] +) -> list[str]: ... +def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ... def get_default_compiler(osname: str | None = ..., platform: str | None = ...) -> str: ... def new_compiler( plat: str | None = ..., compiler: str | None = ..., verbose: int = ..., dry_run: int = ..., force: int = ... @@ -17,34 +17,34 @@ class CCompiler: force: bool verbose: bool output_dir: str | None - macros: List[_Macro] - include_dirs: List[str] - libraries: List[str] - library_dirs: List[str] - runtime_library_dirs: List[str] - objects: List[str] + macros: list[_Macro] + include_dirs: list[str] + libraries: list[str] + library_dirs: list[str] + runtime_library_dirs: list[str] + objects: list[str] def __init__(self, verbose: int = ..., dry_run: int = ..., force: int = ...) -> None: ... def add_include_dir(self, dir: str) -> None: ... - def set_include_dirs(self, dirs: List[str]) -> None: ... + def set_include_dirs(self, dirs: list[str]) -> None: ... def add_library(self, libname: str) -> None: ... - def set_libraries(self, libnames: List[str]) -> None: ... + def set_libraries(self, libnames: list[str]) -> None: ... def add_library_dir(self, dir: str) -> None: ... - def set_library_dirs(self, dirs: List[str]) -> None: ... + def set_library_dirs(self, dirs: list[str]) -> None: ... def add_runtime_library_dir(self, dir: str) -> None: ... - def set_runtime_library_dirs(self, dirs: List[str]) -> None: ... + def set_runtime_library_dirs(self, dirs: list[str]) -> None: ... def define_macro(self, name: str, value: str | None = ...) -> None: ... def undefine_macro(self, name: str) -> None: ... def add_link_object(self, object: str) -> None: ... - def set_link_objects(self, objects: List[str]) -> None: ... - def detect_language(self, sources: str | List[str]) -> str | None: ... - def find_library_file(self, dirs: List[str], lib: str, debug: bool = ...) -> str | None: ... + def set_link_objects(self, objects: list[str]) -> None: ... + def detect_language(self, sources: str | list[str]) -> str | None: ... + def find_library_file(self, dirs: list[str], lib: str, debug: bool = ...) -> str | None: ... def has_function( self, funcname: str, - includes: List[str] | None = ..., - include_dirs: List[str] | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., + includes: list[str] | None = ..., + include_dirs: list[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., ) -> bool: ... def library_dir_option(self, dir: str) -> str: ... def library_option(self, lib: str) -> str: ... @@ -52,18 +52,18 @@ class CCompiler: def set_executables(self, **args: str) -> None: ... def compile( self, - sources: List[str], + sources: list[str], output_dir: str | None = ..., macros: _Macro | None = ..., - include_dirs: List[str] | None = ..., + include_dirs: list[str] | None = ..., debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., - depends: List[str] | None = ..., - ) -> List[str]: ... + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., + depends: list[str] | None = ..., + ) -> list[str]: ... def create_static_lib( self, - objects: List[str], + objects: list[str], output_libname: str, output_dir: str | None = ..., debug: bool = ..., @@ -72,59 +72,59 @@ class CCompiler: def link( self, target_desc: str, - objects: List[str], + objects: list[str], output_filename: str, output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - export_symbols: List[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + export_symbols: list[str] | None = ..., debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., build_temp: str | None = ..., target_lang: str | None = ..., ) -> None: ... def link_executable( self, - objects: List[str], + objects: list[str], output_progname: str, output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., target_lang: str | None = ..., ) -> None: ... def link_shared_lib( self, - objects: List[str], + objects: list[str], output_libname: str, output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - export_symbols: List[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + export_symbols: list[str] | None = ..., debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., build_temp: str | None = ..., target_lang: str | None = ..., ) -> None: ... def link_shared_object( self, - objects: List[str], + objects: list[str], output_filename: str, output_dir: str | None = ..., - libraries: List[str] | None = ..., - library_dirs: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - export_symbols: List[str] | None = ..., + libraries: list[str] | None = ..., + library_dirs: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + export_symbols: list[str] | None = ..., debug: bool = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., build_temp: str | None = ..., target_lang: str | None = ..., ) -> None: ... @@ -132,17 +132,17 @@ class CCompiler: self, source: str, output_file: str | None = ..., - macros: List[_Macro] | None = ..., - include_dirs: List[str] | None = ..., - extra_preargs: List[str] | None = ..., - extra_postargs: List[str] | None = ..., + macros: list[_Macro] | None = ..., + include_dirs: list[str] | None = ..., + extra_preargs: list[str] | None = ..., + extra_postargs: list[str] | None = ..., ) -> None: ... def executable_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ... - def object_filenames(self, source_filenames: List[str], strip_dir: int = ..., output_dir: str = ...) -> List[str]: ... + def object_filenames(self, source_filenames: list[str], strip_dir: int = ..., output_dir: str = ...) -> list[str]: ... def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ... - def spawn(self, cmd: List[str]) -> None: ... + def spawn(self, cmd: list[str]) -> None: ... def mkpath(self, name: str, mode: int = ...) -> None: ... def move_file(self, src: str, dst: str) -> str: ... def announce(self, msg: str, level: int = ...) -> None: ... diff --git a/stdlib/distutils/cmd.pyi b/stdlib/distutils/cmd.pyi index 56383e8a0d65..dd2e1905adf5 100644 --- a/stdlib/distutils/cmd.pyi +++ b/stdlib/distutils/cmd.pyi @@ -1,9 +1,9 @@ from abc import abstractmethod from distutils.dist import Distribution -from typing import Any, Callable, Iterable, List, Tuple +from typing import Any, Callable, Iterable, Tuple class Command: - sub_commands: List[Tuple[str, Callable[[Command], bool] | None]] + sub_commands: list[Tuple[str, Callable[[Command], bool] | None]] def __init__(self, dist: Distribution) -> None: ... @abstractmethod def initialize_options(self) -> None: ... @@ -14,7 +14,7 @@ class Command: def announce(self, msg: str, level: int = ...) -> None: ... def debug_print(self, msg: str) -> None: ... def ensure_string(self, option: str, default: str | None = ...) -> None: ... - def ensure_string_list(self, option: str | List[str]) -> None: ... + def ensure_string_list(self, option: str | list[str]) -> None: ... def ensure_filename(self, option: str) -> None: ... def ensure_dirname(self, option: str) -> None: ... def get_command_name(self) -> str: ... @@ -22,7 +22,7 @@ class Command: def get_finalized_command(self, command: str, create: int = ...) -> Command: ... def reinitialize_command(self, command: Command | str, reinit_subcommands: int = ...) -> Command: ... def run_command(self, command: str) -> None: ... - def get_sub_commands(self) -> List[str]: ... + def get_sub_commands(self) -> list[str]: ... def warn(self, msg: str) -> None: ... def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: str | None = ..., level: int = ...) -> None: ... def mkpath(self, name: str, mode: int = ...) -> None: ... @@ -43,7 +43,7 @@ class Command: preserve_times: int = ..., preserve_symlinks: int = ..., level: Any = ..., - ) -> List[str]: ... # level is not used + ) -> list[str]: ... # level is not used def move_file(self, src: str, dst: str, level: Any = ...) -> str: ... # level is not used def spawn(self, cmd: Iterable[str], search_path: int = ..., level: Any = ...) -> None: ... # level is not used def make_archive( @@ -57,10 +57,10 @@ class Command: ) -> str: ... def make_file( self, - infiles: str | List[str] | Tuple[str], + infiles: str | list[str] | Tuple[str], outfile: str, func: Callable[..., Any], - args: List[Any], + args: list[Any], exec_msg: str | None = ..., skip_msg: str | None = ..., level: Any = ..., diff --git a/stdlib/distutils/core.pyi b/stdlib/distutils/core.pyi index 48bd7b5018bc..dc0870895cf9 100644 --- a/stdlib/distutils/core.pyi +++ b/stdlib/distutils/core.pyi @@ -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, List, Mapping, Tuple, Type +from typing import Any, Mapping, Tuple, Type def setup( *, @@ -15,34 +15,34 @@ def setup( maintainer_email: str = ..., url: str = ..., download_url: str = ..., - packages: List[str] = ..., - py_modules: List[str] = ..., - scripts: List[str] = ..., - ext_modules: List[Extension] = ..., - classifiers: List[str] = ..., + packages: list[str] = ..., + py_modules: list[str] = ..., + scripts: list[str] = ..., + ext_modules: list[Extension] = ..., + classifiers: list[str] = ..., distclass: Type[Distribution] = ..., script_name: str = ..., - script_args: List[str] = ..., + script_args: list[str] = ..., options: Mapping[str, Any] = ..., license: str = ..., - keywords: List[str] | str = ..., - platforms: List[str] | str = ..., + keywords: list[str] | str = ..., + platforms: list[str] | str = ..., cmdclass: Mapping[str, Type[Command]] = ..., - data_files: List[Tuple[str, List[str]]] = ..., + data_files: list[Tuple[str, list[str]]] = ..., package_dir: Mapping[str, str] = ..., - obsoletes: List[str] = ..., - provides: List[str] = ..., - requires: List[str] = ..., - command_packages: List[str] = ..., + obsoletes: list[str] = ..., + provides: list[str] = ..., + requires: list[str] = ..., + command_packages: list[str] = ..., command_options: Mapping[str, Mapping[str, Tuple[Any, Any]]] = ..., - package_data: Mapping[str, List[str]] = ..., + package_data: Mapping[str, list[str]] = ..., include_package_data: bool = ..., - libraries: List[str] = ..., - headers: List[str] = ..., + libraries: list[str] = ..., + headers: list[str] = ..., ext_package: str = ..., - include_dirs: List[str] = ..., + include_dirs: list[str] = ..., password: str = ..., fullname: str = ..., **attrs: Any, ) -> None: ... -def run_setup(script_name: str, script_args: List[str] | None = ..., stop_after: str = ...) -> Distribution: ... +def run_setup(script_name: str, script_args: list[str] | None = ..., stop_after: str = ...) -> Distribution: ... diff --git a/stdlib/distutils/dep_util.pyi b/stdlib/distutils/dep_util.pyi index 6f779d540e5e..595dcb80a38c 100644 --- a/stdlib/distutils/dep_util.pyi +++ b/stdlib/distutils/dep_util.pyi @@ -1,5 +1,5 @@ -from typing import List, Tuple +from typing import Tuple def newer(source: str, target: str) -> bool: ... -def newer_pairwise(sources: List[str], targets: List[str]) -> List[Tuple[str, str]]: ... -def newer_group(sources: List[str], target: str, missing: str = ...) -> bool: ... +def newer_pairwise(sources: list[str], targets: list[str]) -> list[Tuple[str, str]]: ... +def newer_group(sources: list[str], target: str, missing: str = ...) -> bool: ... diff --git a/stdlib/distutils/dir_util.pyi b/stdlib/distutils/dir_util.pyi index 4c4a22102558..ffe5ff1cfbd4 100644 --- a/stdlib/distutils/dir_util.pyi +++ b/stdlib/distutils/dir_util.pyi @@ -1,7 +1,5 @@ -from typing import List - -def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> List[str]: ... -def create_tree(base_dir: str, files: List[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ... +def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> list[str]: ... +def create_tree(base_dir: str, files: list[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ... def copy_tree( src: str, dst: str, @@ -11,5 +9,5 @@ def copy_tree( update: int = ..., verbose: int = ..., dry_run: int = ..., -) -> List[str]: ... +) -> list[str]: ... def remove_tree(directory: str, verbose: int = ..., dry_run: int = ...) -> None: ... diff --git a/stdlib/distutils/dist.pyi b/stdlib/distutils/dist.pyi index b6d47fcae4dd..ca3f108ab681 100644 --- a/stdlib/distutils/dist.pyi +++ b/stdlib/distutils/dist.pyi @@ -1,6 +1,6 @@ from _typeshed import StrOrBytesPath, SupportsWrite from distutils.cmd import Command -from typing import IO, Any, Dict, Iterable, List, Mapping, Tuple, Type +from typing import IO, Any, Iterable, Mapping, Tuple, Type class DistributionMetadata: def __init__(self, path: int | StrOrBytesPath | None = ...) -> None: ... @@ -14,13 +14,13 @@ class DistributionMetadata: license: str | None description: str | None long_description: str | None - keywords: str | List[str] | None - platforms: str | List[str] | None - classifiers: str | List[str] | None + keywords: str | list[str] | None + platforms: str | list[str] | None + classifiers: str | list[str] | None download_url: str | None - provides: List[str] | None - requires: List[str] | None - obsoletes: List[str] | None + provides: list[str] | None + requires: list[str] | None + obsoletes: list[str] | None def read_pkg_file(self, file: IO[str]) -> None: ... def write_pkg_info(self, base_dir: str) -> None: ... def write_pkg_file(self, file: SupportsWrite[str]) -> None: ... @@ -38,21 +38,21 @@ class DistributionMetadata: def get_licence(self) -> str: ... def get_description(self) -> str: ... def get_long_description(self) -> str: ... - def get_keywords(self) -> str | List[str]: ... - def get_platforms(self) -> str | List[str]: ... - def get_classifiers(self) -> str | List[str]: ... + def get_keywords(self) -> str | list[str]: ... + def get_platforms(self) -> str | list[str]: ... + def get_classifiers(self) -> str | list[str]: ... def get_download_url(self) -> str: ... - def get_requires(self) -> List[str]: ... + def get_requires(self) -> list[str]: ... def set_requires(self, value: Iterable[str]) -> None: ... - def get_provides(self) -> List[str]: ... + def get_provides(self) -> list[str]: ... def set_provides(self, value: Iterable[str]) -> None: ... - def get_obsoletes(self) -> List[str]: ... + def get_obsoletes(self) -> list[str]: ... 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]]: ... + def get_option_dict(self, command: str) -> dict[str, Tuple[str, str]]: ... def parse_config_files(self, filenames: Iterable[str] | None = ...) -> None: ... def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ... diff --git a/stdlib/distutils/extension.pyi b/stdlib/distutils/extension.pyi index 041a6a449b18..0941a402e604 100644 --- a/stdlib/distutils/extension.pyi +++ b/stdlib/distutils/extension.pyi @@ -1,22 +1,22 @@ -from typing import List, Tuple +from typing import Tuple class Extension: def __init__( self, name: str, - sources: List[str], - include_dirs: List[str] | None = ..., - define_macros: List[Tuple[str, str | None]] | None = ..., - undef_macros: List[str] | None = ..., - library_dirs: List[str] | None = ..., - libraries: List[str] | None = ..., - runtime_library_dirs: List[str] | None = ..., - extra_objects: List[str] | None = ..., - extra_compile_args: List[str] | None = ..., - extra_link_args: List[str] | None = ..., - export_symbols: List[str] | None = ..., + sources: list[str], + include_dirs: list[str] | None = ..., + define_macros: list[Tuple[str, str | None]] | None = ..., + undef_macros: list[str] | None = ..., + library_dirs: list[str] | None = ..., + libraries: list[str] | None = ..., + runtime_library_dirs: list[str] | None = ..., + extra_objects: list[str] | None = ..., + extra_compile_args: list[str] | None = ..., + extra_link_args: list[str] | None = ..., + export_symbols: list[str] | None = ..., swig_opts: str | None = ..., # undocumented - depends: List[str] | None = ..., + depends: list[str] | None = ..., language: str | None = ..., optional: bool | None = ..., ) -> None: ... diff --git a/stdlib/distutils/fancy_getopt.pyi b/stdlib/distutils/fancy_getopt.pyi index cc81997fe1a3..a2c24187a498 100644 --- a/stdlib/distutils/fancy_getopt.pyi +++ b/stdlib/distutils/fancy_getopt.pyi @@ -4,19 +4,19 @@ _Option = Tuple[str, Optional[str], str] _GR = Tuple[List[str], OptionDummy] def fancy_getopt( - options: List[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: List[str] | None -) -> List[str] | _GR: ... -def wrap_text(text: str, width: int) -> List[str]: ... + options: list[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: list[str] | None +) -> list[str] | _GR: ... +def wrap_text(text: str, width: int) -> list[str]: ... class FancyGetopt: - def __init__(self, option_table: List[_Option] | None = ...) -> None: ... + def __init__(self, option_table: list[_Option] | None = ...) -> None: ... # TODO kinda wrong, `getopt(object=object())` is invalid @overload - def getopt(self, args: List[str] | None = ...) -> _GR: ... + def getopt(self, args: list[str] | None = ...) -> _GR: ... @overload - def getopt(self, args: List[str] | None, object: Any) -> List[str]: ... - def get_option_order(self) -> List[Tuple[str, str]]: ... - def generate_help(self, header: str | None = ...) -> List[str]: ... + def getopt(self, args: list[str] | None, object: Any) -> list[str]: ... + def get_option_order(self) -> list[Tuple[str, str]]: ... + def generate_help(self, header: str | None = ...) -> list[str]: ... class OptionDummy: def __init__(self, options: Iterable[str] = ...) -> None: ... diff --git a/stdlib/distutils/filelist.pyi b/stdlib/distutils/filelist.pyi index a0b02c87dc85..8ab16d2d5c75 100644 --- a/stdlib/distutils/filelist.pyi +++ b/stdlib/distutils/filelist.pyi @@ -1,10 +1,10 @@ -from typing import Iterable, List, Pattern, overload +from typing import Iterable, Pattern, overload from typing_extensions import Literal # class is entirely undocumented class FileList: allfiles: Iterable[str] | None = ... - files: List[str] = ... + files: list[str] = ... def __init__(self, warn: None = ..., debug_print: None = ...) -> None: ... def set_allfiles(self, allfiles: Iterable[str]) -> None: ... def findall(self, dir: str = ...) -> None: ... @@ -35,7 +35,7 @@ class FileList: self, pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ... ) -> bool: ... -def findall(dir: str = ...) -> List[str]: ... +def findall(dir: str = ...) -> list[str]: ... def glob_to_re(pattern: str) -> str: ... @overload def translate_pattern( diff --git a/stdlib/distutils/spawn.pyi b/stdlib/distutils/spawn.pyi index 0fffc5402c62..dda05ad7e85a 100644 --- a/stdlib/distutils/spawn.pyi +++ b/stdlib/distutils/spawn.pyi @@ -1,4 +1,2 @@ -from typing import List - -def spawn(cmd: List[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ... +def spawn(cmd: list[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ... def find_executable(executable: str, path: str | None = ...) -> str | None: ... diff --git a/stdlib/distutils/text_file.pyi b/stdlib/distutils/text_file.pyi index 1dd7a206f8bf..6a0aded5176e 100644 --- a/stdlib/distutils/text_file.pyi +++ b/stdlib/distutils/text_file.pyi @@ -1,4 +1,4 @@ -from typing import IO, List, Tuple +from typing import IO, Tuple class TextFile: def __init__( @@ -15,7 +15,7 @@ class TextFile: ) -> None: ... def open(self, filename: str) -> None: ... def close(self) -> None: ... - def warn(self, msg: str, line: List[int] | Tuple[int, int] | int | None = ...) -> None: ... + def warn(self, msg: str, line: list[int] | Tuple[int, int] | int | None = ...) -> None: ... def readline(self) -> str | None: ... - def readlines(self) -> List[str]: ... + def readlines(self) -> list[str]: ... def unreadline(self, line: str) -> str: ... diff --git a/stdlib/doctest.pyi b/stdlib/doctest.pyi index 9babdf2372dc..9a9f83b0d8fe 100644 --- a/stdlib/doctest.pyi +++ b/stdlib/doctest.pyi @@ -1,12 +1,12 @@ import types import unittest -from typing import Any, Callable, Dict, List, NamedTuple, Tuple, Type +from typing import Any, Callable, NamedTuple, Tuple, Type class TestResults(NamedTuple): failed: int attempted: int -OPTIONFLAGS_BY_NAME: Dict[str, int] +OPTIONFLAGS_BY_NAME: dict[str, int] def register_optionflag(name: str) -> int: ... @@ -36,7 +36,7 @@ class Example: exc_msg: str | None lineno: int indent: int - options: Dict[int, bool] + options: dict[int, bool] def __init__( self, source: str, @@ -44,21 +44,21 @@ class Example: exc_msg: str | None = ..., lineno: int = ..., indent: int = ..., - options: Dict[int, bool] | None = ..., + options: dict[int, bool] | None = ..., ) -> None: ... def __hash__(self) -> int: ... class DocTest: - examples: List[Example] - globs: Dict[str, Any] + examples: list[Example] + globs: dict[str, Any] name: str filename: str | None lineno: int | None docstring: str | None def __init__( self, - examples: List[Example], - globs: Dict[str, Any], + examples: list[Example], + globs: dict[str, Any], name: str, filename: str | None, lineno: int | None, @@ -68,9 +68,9 @@ class DocTest: def __lt__(self, other: DocTest) -> bool: ... class DocTestParser: - def parse(self, string: str, name: str = ...) -> List[str | Example]: ... - def get_doctest(self, string: str, globs: Dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ... - def get_examples(self, string: str, name: str = ...) -> List[Example]: ... + def parse(self, string: str, name: str = ...) -> list[str | Example]: ... + def get_doctest(self, string: str, globs: dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ... + def get_examples(self, string: str, name: str = ...) -> list[Example]: ... class DocTestFinder: def __init__( @@ -81,9 +81,9 @@ class DocTestFinder: obj: object, name: str | None = ..., module: None | bool | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., - extraglobs: Dict[str, Any] | None = ..., - ) -> List[DocTest]: ... + globs: dict[str, Any] | None = ..., + extraglobs: dict[str, Any] | None = ..., + ) -> list[DocTest]: ... _Out = Callable[[str], Any] _ExcInfo = Tuple[Type[BaseException], BaseException, types.TracebackType] @@ -129,11 +129,11 @@ master: DocTestRunner | None def testmod( m: types.ModuleType | None = ..., name: str | None = ..., - globs: Dict[str, Any] | None = ..., + globs: dict[str, Any] | None = ..., verbose: bool | None = ..., report: bool = ..., optionflags: int = ..., - extraglobs: Dict[str, Any] | None = ..., + extraglobs: dict[str, Any] | None = ..., raise_on_error: bool = ..., exclude_empty: bool = ..., ) -> TestResults: ... @@ -142,17 +142,17 @@ def testfile( module_relative: bool = ..., name: str | None = ..., package: None | str | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., + globs: dict[str, Any] | None = ..., verbose: bool | None = ..., report: bool = ..., optionflags: int = ..., - extraglobs: Dict[str, Any] | None = ..., + extraglobs: dict[str, Any] | None = ..., raise_on_error: bool = ..., parser: DocTestParser = ..., encoding: str | None = ..., ) -> TestResults: ... def run_docstring_examples( - f: object, globs: Dict[str, Any], verbose: bool = ..., name: str = ..., compileflags: int | None = ..., optionflags: int = ... + f: object, globs: dict[str, Any], verbose: bool = ..., name: str = ..., compileflags: int | None = ..., optionflags: int = ... ) -> None: ... def set_unittest_reportflags(flags: int) -> int: ... @@ -184,8 +184,8 @@ class _DocTestSuite(unittest.TestSuite): ... def DocTestSuite( module: None | str | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., - extraglobs: Dict[str, Any] | None = ..., + globs: dict[str, Any] | None = ..., + extraglobs: dict[str, Any] | None = ..., test_finder: DocTestFinder | None = ..., **options: Any, ) -> _DocTestSuite: ... @@ -198,7 +198,7 @@ def DocFileTest( path: str, module_relative: bool = ..., package: None | str | types.ModuleType = ..., - globs: Dict[str, Any] | None = ..., + globs: dict[str, Any] | None = ..., parser: DocTestParser = ..., encoding: str | None = ..., **options: Any, @@ -206,6 +206,6 @@ def DocFileTest( def DocFileSuite(*paths: str, **kw: Any) -> _DocTestSuite: ... def script_from_examples(s: str) -> str: ... def testsource(module: None | str | types.ModuleType, name: str) -> str: ... -def debug_src(src: str, pm: bool = ..., globs: Dict[str, Any] | None = ...) -> None: ... -def debug_script(src: str, pm: bool = ..., globs: Dict[str, Any] | None = ...) -> None: ... +def debug_src(src: str, pm: bool = ..., globs: dict[str, Any] | None = ...) -> None: ... +def debug_script(src: str, pm: bool = ..., globs: dict[str, Any] | None = ...) -> None: ... def debug(module: None | str | types.ModuleType, name: str, pm: bool = ...) -> None: ... diff --git a/stdlib/email/_header_value_parser.pyi b/stdlib/email/_header_value_parser.pyi index 1917a22e6438..46391a2470d3 100644 --- a/stdlib/email/_header_value_parser.pyi +++ b/stdlib/email/_header_value_parser.pyi @@ -27,17 +27,17 @@ class TokenList(List[Union[TokenList, Terminal]]): token_type: str | None = ... syntactic_break: bool = ... ew_combine_allowed: bool = ... - defects: List[MessageDefect] = ... + defects: list[MessageDefect] = ... def __init__(self, *args: Any, **kw: Any) -> None: ... @property def value(self) -> str: ... @property - def all_defects(self) -> List[MessageDefect]: ... + def all_defects(self) -> list[MessageDefect]: ... def startswith_fws(self) -> bool: ... @property def as_ew_allowed(self) -> bool: ... @property - def comments(self) -> List[str]: ... + def comments(self) -> list[str]: ... def fold(self, *, policy: Policy) -> str: ... def pprint(self, indent: str = ...) -> None: ... def ppstr(self, indent: str = ...) -> str: ... @@ -46,7 +46,7 @@ class WhiteSpaceTokenList(TokenList): @property def value(self) -> str: ... @property - def comments(self) -> List[str]: ... + def comments(self) -> list[str]: ... class UnstructuredTokenList(TokenList): token_type: str = ... @@ -93,46 +93,46 @@ class Comment(WhiteSpaceTokenList): @property def content(self) -> str: ... @property - def comments(self) -> List[str]: ... + def comments(self) -> list[str]: ... class AddressList(TokenList): token_type: str = ... @property - def addresses(self) -> List[Address]: ... + def addresses(self) -> list[Address]: ... @property - def mailboxes(self) -> List[Mailbox]: ... + def mailboxes(self) -> list[Mailbox]: ... @property - def all_mailboxes(self) -> List[Mailbox]: ... + def all_mailboxes(self) -> list[Mailbox]: ... class Address(TokenList): token_type: str = ... @property def display_name(self) -> str: ... @property - def mailboxes(self) -> List[Mailbox]: ... + def mailboxes(self) -> list[Mailbox]: ... @property - def all_mailboxes(self) -> List[Mailbox]: ... + def all_mailboxes(self) -> list[Mailbox]: ... class MailboxList(TokenList): token_type: str = ... @property - def mailboxes(self) -> List[Mailbox]: ... + def mailboxes(self) -> list[Mailbox]: ... @property - def all_mailboxes(self) -> List[Mailbox]: ... + def all_mailboxes(self) -> list[Mailbox]: ... class GroupList(TokenList): token_type: str = ... @property - def mailboxes(self) -> List[Mailbox]: ... + def mailboxes(self) -> list[Mailbox]: ... @property - def all_mailboxes(self) -> List[Mailbox]: ... + def all_mailboxes(self) -> list[Mailbox]: ... class Group(TokenList): token_type: str = ... @property - def mailboxes(self) -> List[Mailbox]: ... + def mailboxes(self) -> list[Mailbox]: ... @property - def all_mailboxes(self) -> List[Mailbox]: ... + def all_mailboxes(self) -> list[Mailbox]: ... @property def display_name(self) -> str: ... @@ -145,7 +145,7 @@ class NameAddr(TokenList): @property def domain(self) -> str: ... @property - def route(self) -> List[Domain] | None: ... + def route(self) -> list[Domain] | None: ... @property def addr_spec(self) -> str: ... @@ -156,14 +156,14 @@ class AngleAddr(TokenList): @property def domain(self) -> str: ... @property - def route(self) -> List[Domain] | None: ... + def route(self) -> list[Domain] | None: ... @property def addr_spec(self) -> str: ... class ObsRoute(TokenList): token_type: str = ... @property - def domains(self) -> List[Domain]: ... + def domains(self) -> list[Domain]: ... class Mailbox(TokenList): token_type: str = ... @@ -174,7 +174,7 @@ class Mailbox(TokenList): @property def domain(self) -> str: ... @property - def route(self) -> List[str]: ... + def route(self) -> list[str]: ... @property def addr_spec(self) -> str: ... @@ -326,14 +326,14 @@ class Terminal(str): ew_combine_allowed: bool = ... syntactic_break: bool = ... token_type: str = ... - defects: List[MessageDefect] = ... + defects: list[MessageDefect] = ... def __new__(cls: Type[_T], value: str, token_type: str) -> _T: ... def pprint(self) -> None: ... @property - def all_defects(self) -> List[MessageDefect]: ... + def all_defects(self) -> list[MessageDefect]: ... def pop_trailing_ws(self) -> None: ... @property - def comments(self) -> List[str]: ... + def comments(self) -> list[str]: ... def __getnewargs__(self) -> Tuple[str, str]: ... # type: ignore class WhiteSpaceTerminal(Terminal): diff --git a/stdlib/email/charset.pyi b/stdlib/email/charset.pyi index 485764378f5a..4bf5d11690eb 100644 --- a/stdlib/email/charset.pyi +++ b/stdlib/email/charset.pyi @@ -1,4 +1,4 @@ -from typing import Any, Iterator, List +from typing import Any, Iterator QP: int # undocumented BASE64: int # undocumented @@ -15,7 +15,7 @@ class Charset: def get_body_encoding(self) -> str: ... def get_output_charset(self) -> str | None: ... def header_encode(self, string: str) -> str: ... - def header_encode_lines(self, string: str, maxlengths: Iterator[int]) -> List[str]: ... + def header_encode_lines(self, string: str, maxlengths: Iterator[int]) -> list[str]: ... def body_encode(self, string: str) -> str: ... def __str__(self) -> str: ... def __eq__(self, other: Any) -> bool: ... diff --git a/stdlib/email/header.pyi b/stdlib/email/header.pyi index 6d9e8d43d4c1..0d7691a622cb 100644 --- a/stdlib/email/header.pyi +++ b/stdlib/email/header.pyi @@ -1,5 +1,5 @@ from email.charset import Charset -from typing import Any, List, Tuple +from typing import Any, Tuple class Header: def __init__( @@ -17,9 +17,9 @@ class Header: def __eq__(self, other: Any) -> bool: ... def __ne__(self, other: Any) -> bool: ... -def decode_header(header: Header | str) -> List[Tuple[bytes, str | None]]: ... +def decode_header(header: Header | str) -> list[Tuple[bytes, str | None]]: ... def make_header( - decoded_seq: List[Tuple[bytes, str | None]], + decoded_seq: list[Tuple[bytes, str | None]], maxlinelen: int | None = ..., header_name: str | None = ..., continuation_ws: str = ..., diff --git a/stdlib/email/headerregistry.pyi b/stdlib/email/headerregistry.pyi index 5d718805c6ae..dc5dac90e44e 100644 --- a/stdlib/email/headerregistry.pyi +++ b/stdlib/email/headerregistry.pyi @@ -11,7 +11,7 @@ from email._header_value_parser import ( ) from email.errors import MessageDefect from email.policy import Policy -from typing import Any, Dict, Iterable, Mapping, Tuple, Type +from typing import Any, Iterable, Mapping, Tuple, Type class BaseHeader(str): @property @@ -28,7 +28,7 @@ class UnstructuredHeader: @staticmethod def value_parser(value: str) -> UnstructuredTokenList: ... @classmethod - def parse(cls, value: str, kwds: Dict[str, Any]) -> None: ... + def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... class UniqueUnstructuredHeader(UnstructuredHeader): ... @@ -38,7 +38,7 @@ class DateHeader: @staticmethod def value_parser(value: str) -> UnstructuredTokenList: ... @classmethod - def parse(cls, value: str | _datetime, kwds: Dict[str, Any]) -> None: ... + def parse(cls, value: str | _datetime, kwds: dict[str, Any]) -> None: ... class UniqueDateHeader(DateHeader): ... @@ -50,7 +50,7 @@ class AddressHeader: @staticmethod def value_parser(value: str) -> AddressList: ... @classmethod - def parse(cls, value: str, kwds: Dict[str, Any]) -> None: ... + def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... class UniqueAddressHeader(AddressHeader): ... @@ -70,13 +70,13 @@ class MIMEVersionHeader: @staticmethod def value_parser(value: str) -> MIMEVersion: ... @classmethod - def parse(cls, value: str, kwds: Dict[str, Any]) -> None: ... + def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... class ParameterizedMIMEHeader: @property def params(self) -> Mapping[str, Any]: ... @classmethod - def parse(cls, value: str, kwds: Dict[str, Any]) -> None: ... + def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... class ContentTypeHeader(ParameterizedMIMEHeader): @property @@ -98,7 +98,7 @@ class ContentTransferEncodingHeader: @property def cte(self) -> str: ... @classmethod - def parse(cls, value: str, kwds: Dict[str, Any]) -> None: ... + def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... @staticmethod def value_parser(value: str) -> ContentTransferEncoding: ... @@ -106,7 +106,7 @@ if sys.version_info >= (3, 8): from email._header_value_parser import MessageID class MessageIDHeader: @classmethod - def parse(cls, value: str, kwds: Dict[str, Any]) -> None: ... + def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... @staticmethod def value_parser(value: str) -> MessageID: ... diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index b08ccd78cc2d..fcf8d7969450 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -16,7 +16,7 @@ class Message: policy: Policy # undocumented preamble: str | None epilogue: str | None - defects: List[MessageDefect] + defects: list[MessageDefect] def __str__(self) -> str: ... def is_multipart(self) -> bool: ... def set_unixfrom(self, unixfrom: str) -> None: ... @@ -31,11 +31,11 @@ class Message: def __getitem__(self, name: str) -> _HeaderType: ... def __setitem__(self, name: str, val: _HeaderType) -> None: ... def __delitem__(self, name: str) -> None: ... - def keys(self) -> List[str]: ... - def values(self) -> List[_HeaderType]: ... - def items(self) -> List[Tuple[str, _HeaderType]]: ... + def keys(self) -> list[str]: ... + def values(self) -> list[_HeaderType]: ... + def items(self) -> list[Tuple[str, _HeaderType]]: ... def get(self, name: str, failobj: _T = ...) -> _HeaderType | _T: ... - def get_all(self, name: str, failobj: _T = ...) -> List[_HeaderType] | _T: ... + def get_all(self, name: str, failobj: _T = ...) -> list[_HeaderType] | _T: ... def add_header(self, _name: str, _value: str, **_params: _ParamsType) -> None: ... def replace_header(self, _name: str, _value: _HeaderType) -> None: ... def get_content_type(self) -> str: ... @@ -43,7 +43,7 @@ class Message: def get_content_subtype(self) -> str: ... def get_default_type(self) -> str: ... def set_default_type(self, ctype: str) -> None: ... - def get_params(self, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> List[Tuple[str, str]] | _T: ... + def get_params(self, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> list[Tuple[str, str]] | _T: ... def get_param(self, param: str, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> _T | _ParamType: ... def del_param(self, param: str, header: str = ..., requote: bool = ...) -> None: ... def set_type(self, type: str, header: str = ..., requote: bool = ...) -> None: ... @@ -51,7 +51,7 @@ class Message: def get_boundary(self, failobj: _T = ...) -> _T | str: ... def set_boundary(self, boundary: str) -> None: ... def get_content_charset(self, failobj: _T = ...) -> _T | str: ... - def get_charsets(self, failobj: _T = ...) -> _T | List[str]: ... + def get_charsets(self, failobj: _T = ...) -> _T | list[str]: ... def walk(self) -> Generator[Message, None, None]: ... def get_content_disposition(self) -> str | None: ... def as_string(self, unixfrom: bool = ..., maxheaderlen: int = ..., policy: Policy | None = ...) -> str: ... diff --git a/stdlib/email/policy.pyi b/stdlib/email/policy.pyi index 56d1f989239f..625e6a5dcdbc 100644 --- a/stdlib/email/policy.pyi +++ b/stdlib/email/policy.pyi @@ -3,7 +3,7 @@ from email.contentmanager import ContentManager from email.errors import MessageDefect from email.header import Header from email.message import Message -from typing import Any, Callable, List, Tuple +from typing import Any, Callable, Tuple class Policy: max_line_length: int | None @@ -17,7 +17,7 @@ class Policy: def register_defect(self, obj: Message, defect: MessageDefect) -> None: ... def header_max_count(self, name: str) -> int | None: ... @abstractmethod - def header_source_parse(self, sourcelines: List[str]) -> Tuple[str, str]: ... + def header_source_parse(self, sourcelines: list[str]) -> Tuple[str, str]: ... @abstractmethod def header_store_parse(self, name: str, value: str) -> Tuple[str, str]: ... @abstractmethod @@ -28,7 +28,7 @@ class Policy: def fold_binary(self, name: str, value: str) -> bytes: ... class Compat32(Policy): - def header_source_parse(self, sourcelines: List[str]) -> Tuple[str, str]: ... + def header_source_parse(self, sourcelines: list[str]) -> Tuple[str, str]: ... def header_store_parse(self, name: str, value: str) -> Tuple[str, str]: ... def header_fetch_parse(self, name: str, value: str) -> str | Header: ... # type: ignore def fold(self, name: str, value: str) -> str: ... @@ -41,7 +41,7 @@ class EmailPolicy(Policy): refold_source: str header_factory: Callable[[str, str], str] content_manager: ContentManager - def header_source_parse(self, sourcelines: List[str]) -> Tuple[str, str]: ... + def header_source_parse(self, sourcelines: list[str]) -> Tuple[str, str]: ... def header_store_parse(self, name: str, value: str) -> Tuple[str, str]: ... def header_fetch_parse(self, name: str, value: str) -> str: ... def fold(self, name: str, value: str) -> str: ... diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 4230e6062d5c..96d75a63ab12 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -1,7 +1,7 @@ import datetime import sys from email.charset import Charset -from typing import List, Optional, Tuple, Union, overload +from typing import Optional, Tuple, Union, overload _ParamType = Union[str, Tuple[Optional[str], Optional[str], str]] _PDTZ = Tuple[int, int, int, int, int, int, int, int, int, Optional[int]] @@ -10,7 +10,7 @@ def quote(str: str) -> str: ... def unquote(str: str) -> str: ... def parseaddr(addr: str | None) -> Tuple[str, str]: ... def formataddr(pair: Tuple[str | None, str], charset: str | Charset = ...) -> str: ... -def getaddresses(fieldvalues: List[str]) -> List[Tuple[str, str]]: ... +def getaddresses(fieldvalues: list[str]) -> list[Tuple[str, str]]: ... @overload def parsedate(data: None) -> None: ... @overload @@ -37,4 +37,4 @@ def make_msgid(idstring: str | None = ..., domain: str | None = ...) -> str: ... def decode_rfc2231(s: str) -> Tuple[str | None, str | None, str]: ... def encode_rfc2231(s: str, charset: str | None = ..., language: str | None = ...) -> str: ... def collapse_rfc2231_value(value: _ParamType, errors: str = ..., fallback_charset: str = ...) -> str: ... -def decode_params(params: List[Tuple[str, str]]) -> List[Tuple[str, _ParamType]]: ... +def decode_params(params: list[Tuple[str, str]]) -> list[Tuple[str, _ParamType]]: ... diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 77a3fe6ef582..5b796e887328 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -1,7 +1,7 @@ import sys from abc import ABCMeta from builtins import property as _builtins_property -from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar +from typing import Any, Iterator, Mapping, Type, TypeVar _T = TypeVar("_T") _S = TypeVar("_S", bound=Type[Enum]) @@ -25,21 +25,21 @@ class Enum(metaclass=EnumMeta): value: Any _name_: str _value_: Any - _member_names_: List[str] # undocumented - _member_map_: Dict[str, Enum] # undocumented - _value2member_map_: Dict[int, Enum] # undocumented + _member_names_: list[str] # undocumented + _member_map_: dict[str, Enum] # undocumented + _value2member_map_: dict[int, Enum] # undocumented if sys.version_info >= (3, 7): - _ignore_: str | List[str] + _ignore_: str | list[str] _order_: str __order__: str @classmethod def _missing_(cls, value: object) -> Any: ... @staticmethod - def _generate_next_value_(name: str, start: int, count: int, last_values: List[Any]) -> Any: ... + def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> Any: ... def __new__(cls: Type[_T], value: object) -> _T: ... def __repr__(self) -> str: ... def __str__(self) -> str: ... - def __dir__(self) -> List[str]: ... + def __dir__(self) -> list[str]: ... def __format__(self, format_spec: str) -> str: ... def __hash__(self) -> Any: ... def __reduce_ex__(self, proto: object) -> Any: ... diff --git a/stdlib/filecmp.pyi b/stdlib/filecmp.pyi index 2ddfd18c2d99..0cc92ed9e3ed 100644 --- a/stdlib/filecmp.pyi +++ b/stdlib/filecmp.pyi @@ -1,17 +1,17 @@ import sys from _typeshed import StrOrBytesPath from os import PathLike -from typing import Any, AnyStr, Callable, Dict, Generic, Iterable, List, Sequence, Tuple +from typing import Any, AnyStr, Callable, Generic, Iterable, Sequence, Tuple if sys.version_info >= (3, 9): from types import GenericAlias -DEFAULT_IGNORES: List[str] +DEFAULT_IGNORES: list[str] def cmp(f1: StrOrBytesPath, f2: StrOrBytesPath, shallow: int | bool = ...) -> bool: ... def cmpfiles( a: AnyStr | PathLike[AnyStr], b: AnyStr | PathLike[AnyStr], common: Iterable[AnyStr], shallow: int | bool = ... -) -> Tuple[List[AnyStr], List[AnyStr], List[AnyStr]]: ... +) -> Tuple[list[AnyStr], list[AnyStr], list[AnyStr]]: ... class dircmp(Generic[AnyStr]): def __init__( @@ -26,22 +26,22 @@ class dircmp(Generic[AnyStr]): hide: Sequence[AnyStr] ignore: Sequence[AnyStr] # These properties are created at runtime by __getattr__ - subdirs: Dict[AnyStr, dircmp[AnyStr]] - same_files: List[AnyStr] - diff_files: List[AnyStr] - funny_files: List[AnyStr] - common_dirs: List[AnyStr] - common_files: List[AnyStr] - common_funny: List[AnyStr] - common: List[AnyStr] - left_only: List[AnyStr] - right_only: List[AnyStr] - left_list: List[AnyStr] - right_list: List[AnyStr] + subdirs: dict[AnyStr, dircmp[AnyStr]] + same_files: list[AnyStr] + diff_files: list[AnyStr] + funny_files: list[AnyStr] + common_dirs: list[AnyStr] + common_files: list[AnyStr] + common_funny: list[AnyStr] + common: list[AnyStr] + left_only: list[AnyStr] + right_only: list[AnyStr] + left_list: list[AnyStr] + right_list: list[AnyStr] def report(self) -> None: ... def report_partial_closure(self) -> None: ... def report_full_closure(self) -> None: ... - methodmap: Dict[str, Callable[[], None]] + methodmap: dict[str, Callable[[], None]] def phase0(self) -> None: ... def phase1(self) -> None: ... def phase2(self) -> None: ... diff --git a/stdlib/fnmatch.pyi b/stdlib/fnmatch.pyi index 5311f13e8874..1cbcf00729ed 100644 --- a/stdlib/fnmatch.pyi +++ b/stdlib/fnmatch.pyi @@ -1,6 +1,6 @@ -from typing import AnyStr, Iterable, List +from typing import AnyStr, Iterable def fnmatch(name: AnyStr, pat: AnyStr) -> bool: ... def fnmatchcase(name: AnyStr, pat: AnyStr) -> bool: ... -def filter(names: Iterable[AnyStr], pat: AnyStr) -> List[AnyStr]: ... +def filter(names: Iterable[AnyStr], pat: AnyStr) -> list[AnyStr]: ... def translate(pat: str) -> str: ... diff --git a/stdlib/formatter.pyi b/stdlib/formatter.pyi index da165f2d55e3..7c3b97688dbd 100644 --- a/stdlib/formatter.pyi +++ b/stdlib/formatter.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Iterable, List, Tuple +from typing import IO, Any, Iterable, Tuple AS_IS: None _FontType = Tuple[str, bool, bool, bool] @@ -28,9 +28,9 @@ class NullFormatter: class AbstractFormatter: writer: NullWriter align: str | None - align_stack: List[str | None] - font_stack: List[_FontType] - margin_stack: List[int] + align_stack: list[str | None] + font_stack: list[_FontType] + margin_stack: list[int] spacing: str | None style_stack: Any nospace: int diff --git a/stdlib/ftplib.pyi b/stdlib/ftplib.pyi index 692f63c73457..4275888f5fc6 100644 --- a/stdlib/ftplib.pyi +++ b/stdlib/ftplib.pyi @@ -2,7 +2,7 @@ from _typeshed import Self, SupportsRead, SupportsReadline from socket import socket from ssl import SSLContext from types import TracebackType -from typing import Any, Callable, Dict, Iterable, Iterator, List, TextIO, Tuple, Type +from typing import Any, Callable, Iterable, Iterator, TextIO, Tuple, Type from typing_extensions import Literal MSG_OOB: int @@ -85,10 +85,10 @@ class FTP: def retrlines(self, cmd: str, callback: Callable[[str], Any] | None = ...) -> str: ... def storlines(self, cmd: str, fp: SupportsReadline[bytes], callback: Callable[[bytes], Any] | None = ...) -> str: ... def acct(self, password: str) -> str: ... - def nlst(self, *args: str) -> List[str]: ... + def nlst(self, *args: str) -> list[str]: ... # Technically only the last arg can be a Callable but ... def dir(self, *args: str | Callable[[str], None]) -> None: ... - def mlsd(self, path: str = ..., facts: Iterable[str] = ...) -> Iterator[Tuple[str, Dict[str, str]]]: ... + def mlsd(self, path: str = ..., facts: Iterable[str] = ...) -> Iterator[Tuple[str, dict[str, str]]]: ... def rename(self, fromname: str, toname: str) -> str: ... def delete(self, filename: str) -> str: ... def cwd(self, dirname: str) -> str: ... diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index 1ebf4f13c7cf..a6327c3a8072 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -3,7 +3,6 @@ from _typeshed import SupportsItems, SupportsLessThan from typing import ( Any, Callable, - Dict, Generic, Hashable, Iterable, @@ -63,7 +62,7 @@ def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsLessTha class partial(Generic[_T]): func: Callable[..., _T] args: Tuple[Any, ...] - keywords: Dict[str, Any] + keywords: dict[str, Any] def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> _T: ... if sys.version_info >= (3, 9): @@ -75,7 +74,7 @@ _Descriptor = Any class partialmethod(Generic[_T]): func: Callable[..., _T] | _Descriptor args: Tuple[Any, ...] - keywords: Dict[str, Any] + keywords: dict[str, Any] @overload def __init__(self, __func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ... @overload diff --git a/stdlib/gc.pyi b/stdlib/gc.pyi index 44bb2fd20bb9..6eea01848939 100644 --- a/stdlib/gc.pyi +++ b/stdlib/gc.pyi @@ -1,13 +1,13 @@ import sys -from typing import Any, Dict, List, Tuple +from typing import Any, Tuple DEBUG_COLLECTABLE: int DEBUG_LEAK: int DEBUG_SAVEALL: int DEBUG_STATS: int DEBUG_UNCOLLECTABLE: int -callbacks: List[Any] -garbage: List[Any] +callbacks: list[Any] +garbage: list[Any] def collect(generation: int = ...) -> int: ... def disable() -> None: ... @@ -16,19 +16,19 @@ def get_count() -> Tuple[int, int, int]: ... def get_debug() -> int: ... if sys.version_info >= (3, 8): - def get_objects(generation: int | None = ...) -> List[Any]: ... + def get_objects(generation: int | None = ...) -> list[Any]: ... else: - def get_objects() -> List[Any]: ... + def get_objects() -> list[Any]: ... if sys.version_info >= (3, 7): def freeze() -> None: ... def unfreeze() -> None: ... def get_freeze_count() -> int: ... -def get_referents(*objs: Any) -> List[Any]: ... -def get_referrers(*objs: Any) -> List[Any]: ... -def get_stats() -> List[Dict[str, Any]]: ... +def get_referents(*objs: Any) -> list[Any]: ... +def get_referrers(*objs: Any) -> list[Any]: ... +def get_stats() -> list[dict[str, Any]]: ... def get_threshold() -> Tuple[int, int, int]: ... def is_tracked(__obj: Any) -> bool: ... diff --git a/stdlib/genericpath.pyi b/stdlib/genericpath.pyi index 999715c8e5f1..1c7be922e941 100644 --- a/stdlib/genericpath.pyi +++ b/stdlib/genericpath.pyi @@ -1,17 +1,17 @@ import os from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsLessThanT -from typing import List, Sequence, Tuple, overload +from typing import Sequence, Tuple, overload from typing_extensions import Literal # All overloads can return empty string. Ideally, Literal[""] would be a valid -# Iterable[T], so that List[T] | Literal[""] could be used as a return +# Iterable[T], so that list[T] | Literal[""] could be used as a return # type. But because this only works when T is str, we need Sequence[T] instead. @overload def commonprefix(m: Sequence[StrPath]) -> str: ... @overload def commonprefix(m: Sequence[BytesPath]) -> bytes | Literal[""]: ... @overload -def commonprefix(m: Sequence[List[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ... +def commonprefix(m: Sequence[list[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ... @overload def commonprefix(m: Sequence[Tuple[SupportsLessThanT, ...]]) -> Sequence[SupportsLessThanT]: ... def exists(path: StrOrBytesPath) -> bool: ... diff --git a/stdlib/glob.pyi b/stdlib/glob.pyi index d8e5b494857c..c1cd176f500c 100644 --- a/stdlib/glob.pyi +++ b/stdlib/glob.pyi @@ -1,20 +1,20 @@ import sys from _typeshed import StrOrBytesPath -from typing import AnyStr, Iterator, List +from typing import AnyStr, Iterator -def glob0(dirname: AnyStr, pattern: AnyStr) -> List[AnyStr]: ... -def glob1(dirname: AnyStr, pattern: AnyStr) -> List[AnyStr]: ... +def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... +def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... if sys.version_info >= (3, 10): def glob( pathname: AnyStr, *, root_dir: StrOrBytesPath | None = ..., dir_fd: int | None = ..., recursive: bool = ... - ) -> List[AnyStr]: ... + ) -> list[AnyStr]: ... def iglob( pathname: AnyStr, *, root_dir: StrOrBytesPath | None = ..., dir_fd: int | None = ..., recursive: bool = ... ) -> Iterator[AnyStr]: ... else: - def glob(pathname: AnyStr, *, recursive: bool = ...) -> List[AnyStr]: ... + def glob(pathname: AnyStr, *, recursive: bool = ...) -> list[AnyStr]: ... def iglob(pathname: AnyStr, *, recursive: bool = ...) -> Iterator[AnyStr]: ... def escape(pathname: AnyStr) -> AnyStr: ... diff --git a/stdlib/grp.pyi b/stdlib/grp.pyi index 63898b26bf17..08cbe6b86476 100644 --- a/stdlib/grp.pyi +++ b/stdlib/grp.pyi @@ -1,11 +1,11 @@ -from typing import List, NamedTuple +from typing import NamedTuple class struct_group(NamedTuple): gr_name: str gr_passwd: str | None gr_gid: int - gr_mem: List[str] + gr_mem: list[str] -def getgrall() -> List[struct_group]: ... +def getgrall() -> list[struct_group]: ... def getgrgid(id: int) -> struct_group: ... def getgrnam(name: str) -> struct_group: ... diff --git a/stdlib/heapq.pyi b/stdlib/heapq.pyi index 72153930ce95..81ee02582a6a 100644 --- a/stdlib/heapq.pyi +++ b/stdlib/heapq.pyi @@ -1,14 +1,14 @@ from _typeshed import SupportsLessThan -from typing import Any, Callable, Iterable, List, TypeVar +from typing import Any, Callable, Iterable, TypeVar _T = TypeVar("_T") -def heappush(__heap: List[_T], __item: _T) -> None: ... -def heappop(__heap: List[_T]) -> _T: ... -def heappushpop(__heap: List[_T], __item: _T) -> _T: ... -def heapify(__heap: List[Any]) -> None: ... -def heapreplace(__heap: List[_T], __item: _T) -> _T: ... +def heappush(__heap: list[_T], __item: _T) -> None: ... +def heappop(__heap: list[_T]) -> _T: ... +def heappushpop(__heap: list[_T], __item: _T) -> _T: ... +def heapify(__heap: list[Any]) -> None: ... +def heapreplace(__heap: list[_T], __item: _T) -> _T: ... def merge(*iterables: Iterable[_T], key: Callable[[_T], Any] | None = ..., reverse: bool = ...) -> Iterable[_T]: ... -def nlargest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> List[_T]: ... -def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> List[_T]: ... -def _heapify_max(__x: List[Any]) -> None: ... # undocumented +def nlargest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> list[_T]: ... +def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> list[_T]: ... +def _heapify_max(__x: list[Any]) -> None: ... # undocumented diff --git a/stdlib/html/entities.pyi b/stdlib/html/entities.pyi index 97d9b2d320bc..1743fccf32b9 100644 --- a/stdlib/html/entities.pyi +++ b/stdlib/html/entities.pyi @@ -1,6 +1,4 @@ -from typing import Dict - -name2codepoint: Dict[str, int] -html5: Dict[str, str] -codepoint2name: Dict[int, str] -entitydefs: Dict[str, str] +name2codepoint: dict[str, int] +html5: dict[str, str] +codepoint2name: dict[int, str] +entitydefs: dict[str, str] diff --git a/stdlib/html/parser.pyi b/stdlib/html/parser.pyi index dd94f0383e39..1cdaf72ff561 100644 --- a/stdlib/html/parser.pyi +++ b/stdlib/html/parser.pyi @@ -1,5 +1,5 @@ from _markupbase import ParserBase -from typing import List, Tuple +from typing import Tuple class HTMLParser(ParserBase): def __init__(self, *, convert_charrefs: bool = ...) -> None: ... @@ -8,9 +8,9 @@ class HTMLParser(ParserBase): def reset(self) -> None: ... def getpos(self) -> Tuple[int, int]: ... def get_starttag_text(self) -> str | None: ... - def handle_starttag(self, tag: str, attrs: List[Tuple[str, str | None]]) -> None: ... + def handle_starttag(self, tag: str, attrs: list[Tuple[str, str | None]]) -> None: ... def handle_endtag(self, tag: str) -> None: ... - def handle_startendtag(self, tag: str, attrs: List[Tuple[str, str | None]]) -> None: ... + def handle_startendtag(self, tag: str, attrs: list[Tuple[str, str | None]]) -> None: ... def handle_data(self, data: str) -> None: ... def handle_entityref(self, name: str) -> None: ... def handle_charref(self, name: str) -> None: ... diff --git a/stdlib/http/client.pyi b/stdlib/http/client.pyi index b6d11bbdef0f..7a46fa1a8be5 100644 --- a/stdlib/http/client.pyi +++ b/stdlib/http/client.pyi @@ -5,23 +5,7 @@ import sys import types from _typeshed import Self, WriteableBuffer from socket import socket -from typing import ( - IO, - Any, - BinaryIO, - Callable, - Dict, - Iterable, - Iterator, - List, - Mapping, - Protocol, - Tuple, - Type, - TypeVar, - Union, - overload, -) +from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, Mapping, Protocol, Tuple, Type, TypeVar, Union, overload _DataType = Union[bytes, IO[Any], Iterable[bytes], str] _T = TypeVar("_T") @@ -87,7 +71,7 @@ INSUFFICIENT_STORAGE: int NOT_EXTENDED: int NETWORK_AUTHENTICATION_REQUIRED: int -responses: Dict[int, str] +responses: dict[int, str] class HTTPMessage(email.message.Message): def getallmatchingheaders(self, name: str) -> list[str]: ... # undocumented @@ -112,7 +96,7 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): def getheader(self, name: str) -> str | None: ... @overload def getheader(self, name: str, default: _T) -> str | _T: ... - def getheaders(self) -> List[Tuple[str, str]]: ... + def getheaders(self) -> list[Tuple[str, str]]: ... def fileno(self) -> int: ... def isclosed(self) -> bool: ... def __iter__(self) -> Iterator[bytes]: ... diff --git a/stdlib/http/cookiejar.pyi b/stdlib/http/cookiejar.pyi index 568b14dca427..b47a19d4c612 100644 --- a/stdlib/http/cookiejar.pyi +++ b/stdlib/http/cookiejar.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import StrPath from http.client import HTTPResponse -from typing import ClassVar, Dict, Iterable, Iterator, Pattern, Sequence, Tuple, TypeVar, overload +from typing import ClassVar, Iterable, Iterator, Pattern, Sequence, Tuple, TypeVar, overload from urllib.request import Request _T = TypeVar("_T") @@ -155,7 +155,7 @@ class Cookie: discard: bool, comment: str | None, comment_url: str | None, - rest: Dict[str, str], + rest: dict[str, str], rfc2109: bool = ..., ) -> None: ... def has_nonstandard_attr(self, name: str) -> bool: ... diff --git a/stdlib/http/cookies.pyi b/stdlib/http/cookies.pyi index 4d4420ec1cd8..5a88121f5070 100644 --- a/stdlib/http/cookies.pyi +++ b/stdlib/http/cookies.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Dict, Generic, Iterable, List, Mapping, Tuple, TypeVar, Union, overload +from typing import Any, Dict, Generic, Iterable, Mapping, Tuple, TypeVar, Union, overload if sys.version_info >= (3, 9): from types import GenericAlias @@ -34,9 +34,9 @@ class Morsel(Dict[str, Any], Generic[_T]): @overload def update(self, values: Iterable[Tuple[str, str]]) -> None: ... def isReservedKey(self, K: str) -> bool: ... - def output(self, attrs: List[str] | None = ..., header: str = ...) -> str: ... - def js_output(self, attrs: List[str] | None = ...) -> str: ... - def OutputString(self, attrs: List[str] | None = ...) -> str: ... + def output(self, attrs: list[str] | None = ..., header: str = ...) -> str: ... + def js_output(self, attrs: list[str] | None = ...) -> str: ... + def OutputString(self, attrs: list[str] | None = ...) -> str: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... @@ -44,8 +44,8 @@ class BaseCookie(Dict[str, Morsel[_T]], Generic[_T]): def __init__(self, input: _DataType | None = ...) -> None: ... def value_decode(self, val: str) -> _T: ... def value_encode(self, val: _T) -> str: ... - def output(self, attrs: List[str] | None = ..., header: str = ..., sep: str = ...) -> str: ... - def js_output(self, attrs: List[str] | None = ...) -> str: ... + def output(self, attrs: list[str] | None = ..., header: str = ..., sep: str = ...) -> str: ... + def js_output(self, attrs: list[str] | None = ...) -> str: ... def load(self, rawdata: _DataType) -> None: ... def __setitem__(self, key: str, value: str | Morsel[_T]) -> None: ... diff --git a/stdlib/http/server.pyi b/stdlib/http/server.pyi index 4d6cdcb75fb5..7979d8168576 100644 --- a/stdlib/http/server.pyi +++ b/stdlib/http/server.pyi @@ -3,7 +3,7 @@ import io import socketserver import sys from _typeshed import StrPath, SupportsRead, SupportsWrite -from typing import Any, AnyStr, BinaryIO, ClassVar, Dict, List, Mapping, Sequence, Tuple +from typing import Any, AnyStr, BinaryIO, ClassVar, Mapping, Sequence, Tuple class HTTPServer(socketserver.TCPServer): server_name: str @@ -53,7 +53,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): server_version: str - extensions_map: Dict[str, str] + extensions_map: dict[str, str] if sys.version_info >= (3, 7): def __init__( self, request: bytes, client_address: Tuple[str, int], server: socketserver.BaseServer, directory: str | None = ... @@ -71,7 +71,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): def executable(path: StrPath) -> bool: ... # undocumented class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): - cgi_directories: List[str] + cgi_directories: list[str] have_fork: bool # undocumented def do_POST(self) -> None: ... def is_cgi(self) -> bool: ... # undocumented diff --git a/stdlib/imghdr.pyi b/stdlib/imghdr.pyi index 850a317ad9b1..4515cf2269b0 100644 --- a/stdlib/imghdr.pyi +++ b/stdlib/imghdr.pyi @@ -1,5 +1,5 @@ from _typeshed import StrPath -from typing import Any, BinaryIO, Callable, List, Protocol, overload +from typing import Any, BinaryIO, Callable, Protocol, overload class _ReadableBinary(Protocol): def tell(self) -> int: ... @@ -11,4 +11,4 @@ def what(file: StrPath | _ReadableBinary, h: None = ...) -> str | None: ... @overload def what(file: Any, h: bytes) -> str | None: ... -tests: List[Callable[[bytes, BinaryIO | None], str | None]] +tests: list[Callable[[bytes, BinaryIO | None], str | None]] diff --git a/stdlib/imp.pyi b/stdlib/imp.pyi index 154259807651..aac16f029424 100644 --- a/stdlib/imp.pyi +++ b/stdlib/imp.pyi @@ -1,7 +1,7 @@ import types from _typeshed import StrPath from os import PathLike -from typing import IO, Any, List, Protocol, Tuple, TypeVar +from typing import IO, Any, Protocol, Tuple, TypeVar from _imp import ( acquire_lock as acquire_lock, @@ -33,7 +33,7 @@ def get_magic() -> bytes: ... def get_tag() -> str: ... def cache_from_source(path: StrPath, debug_override: bool | None = ...) -> str: ... def source_from_cache(path: StrPath) -> str: ... -def get_suffixes() -> List[Tuple[str, str, int]]: ... +def get_suffixes() -> list[Tuple[str, str, int]]: ... class NullImporter: def __init__(self, path: StrPath) -> None: ... @@ -57,7 +57,7 @@ def load_module(name: str, file: _FileLike | None, filename: str, details: Tuple # IO[Any] is a TextIOWrapper if name is a .py file, and a FileIO otherwise. def find_module( - name: str, path: None | List[str] | List[PathLike[str]] | List[StrPath] = ... + name: str, path: None | list[str] | list[PathLike[str]] | list[StrPath] = ... ) -> Tuple[IO[Any], str, Tuple[str, str, int]]: ... def reload(module: types.ModuleType) -> types.ModuleType: ... def init_builtin(name: str) -> types.ModuleType | None: ... diff --git a/stdlib/importlib/machinery.pyi b/stdlib/importlib/machinery.pyi index 3f879dfcbf15..a2e89bb2d8de 100644 --- a/stdlib/importlib/machinery.pyi +++ b/stdlib/importlib/machinery.pyi @@ -1,6 +1,6 @@ import importlib.abc import types -from typing import Any, Callable, List, Sequence, Tuple +from typing import Any, Callable, Sequence, Tuple # TODO: the loaders seem a bit backwards, attribute is protocol but __init__ arg isn't? class ModuleSpec: @@ -16,7 +16,7 @@ class ModuleSpec: name: str loader: importlib.abc._LoaderProtocol | None origin: str | None - submodule_search_locations: List[str] | None + submodule_search_locations: list[str] | None loader_state: Any cached: str | None parent: str | None @@ -90,20 +90,20 @@ class PathFinder: @classmethod def find_module(cls, fullname: str, path: Sequence[bytes | str] | None = ...) -> importlib.abc.Loader | None: ... -SOURCE_SUFFIXES: List[str] -DEBUG_BYTECODE_SUFFIXES: List[str] -OPTIMIZED_BYTECODE_SUFFIXES: List[str] -BYTECODE_SUFFIXES: List[str] -EXTENSION_SUFFIXES: List[str] +SOURCE_SUFFIXES: list[str] +DEBUG_BYTECODE_SUFFIXES: list[str] +OPTIMIZED_BYTECODE_SUFFIXES: list[str] +BYTECODE_SUFFIXES: list[str] +EXTENSION_SUFFIXES: list[str] -def all_suffixes() -> List[str]: ... +def all_suffixes() -> list[str]: ... class FileFinder(importlib.abc.PathEntryFinder): path: str - def __init__(self, path: str, *loader_details: Tuple[importlib.abc.Loader, List[str]]) -> None: ... + def __init__(self, path: str, *loader_details: Tuple[importlib.abc.Loader, list[str]]) -> None: ... @classmethod def path_hook( - cls, *loader_details: Tuple[importlib.abc.Loader, List[str]] + cls, *loader_details: Tuple[importlib.abc.Loader, list[str]] ) -> Callable[[str], importlib.abc.PathEntryFinder]: ... class SourceFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): diff --git a/stdlib/importlib/metadata.pyi b/stdlib/importlib/metadata.pyi index 8aea3e9227a0..2c1041b76503 100644 --- a/stdlib/importlib/metadata.pyi +++ b/stdlib/importlib/metadata.pyi @@ -7,10 +7,10 @@ from email.message import Message from importlib.abc import MetaPathFinder from os import PathLike from pathlib import Path -from typing import Any, Dict, Iterable, List, NamedTuple, Tuple, overload +from typing import Any, Iterable, NamedTuple, Tuple, overload if sys.version_info >= (3, 10): - def packages_distributions() -> Mapping[str, List[str]]: ... + def packages_distributions() -> Mapping[str, list[str]]: ... if sys.version_info >= (3, 8): class PackageNotFoundError(ModuleNotFoundError): ... @@ -21,7 +21,7 @@ if sys.version_info >= (3, 8): class EntryPoint(_EntryPointBase): def load(self) -> Any: ... # Callable[[], Any] or an importable module @property - def extras(self) -> List[str]: ... + def extras(self) -> list[str]: ... class PackagePath(pathlib.PurePosixPath): def read_text(self, encoding: str = ...) -> str: ... def read_binary(self) -> bytes: ... @@ -47,7 +47,7 @@ if sys.version_info >= (3, 8): @overload @classmethod def discover( - cls, *, context: None = ..., name: str | None = ..., path: List[str] = ..., **kwargs: Any + cls, *, context: None = ..., name: str | None = ..., path: list[str] = ..., **kwargs: Any ) -> Iterable[Distribution]: ... @staticmethod def at(path: StrPath) -> PathDistribution: ... @@ -56,17 +56,17 @@ if sys.version_info >= (3, 8): @property def version(self) -> str: ... @property - def entry_points(self) -> List[EntryPoint]: ... + def entry_points(self) -> list[EntryPoint]: ... @property - def files(self) -> List[PackagePath] | None: ... + def files(self) -> list[PackagePath] | None: ... @property - def requires(self) -> List[str] | None: ... + def requires(self) -> list[str] | None: ... class DistributionFinder(MetaPathFinder): class Context: name: str | None - def __init__(self, *, name: str | None = ..., path: List[str] = ..., **kwargs: Any) -> None: ... + def __init__(self, *, name: str | None = ..., path: list[str] = ..., **kwargs: Any) -> None: ... @property - def path(self) -> List[str]: ... + def path(self) -> list[str]: ... @abc.abstractmethod def find_distributions(self, context: DistributionFinder.Context = ...) -> Iterable[Distribution]: ... class MetadataPathFinder(DistributionFinder): @@ -81,10 +81,10 @@ if sys.version_info >= (3, 8): def distributions(*, context: DistributionFinder.Context) -> Iterable[Distribution]: ... @overload def distributions( - *, context: None = ..., name: str | None = ..., path: List[str] = ..., **kwargs: Any + *, context: None = ..., name: str | None = ..., path: list[str] = ..., **kwargs: Any ) -> Iterable[Distribution]: ... def metadata(distribution_name: str) -> Message: ... def version(distribution_name: str) -> str: ... - def entry_points() -> Dict[str, Tuple[EntryPoint, ...]]: ... - def files(distribution_name: str) -> List[PackagePath] | None: ... - def requires(distribution_name: str) -> List[str] | None: ... + def entry_points() -> dict[str, Tuple[EntryPoint, ...]]: ... + def files(distribution_name: str) -> list[PackagePath] | None: ... + def requires(distribution_name: str) -> list[str] | None: ... diff --git a/stdlib/importlib/util.pyi b/stdlib/importlib/util.pyi index 006a00ce2095..e16bf4795a75 100644 --- a/stdlib/importlib/util.pyi +++ b/stdlib/importlib/util.pyi @@ -2,7 +2,7 @@ import importlib.abc import importlib.machinery import types from _typeshed import StrOrBytesPath -from typing import Any, Callable, List +from typing import Any, Callable def module_for_loader(fxn: Callable[..., types.ModuleType]) -> Callable[..., types.ModuleType]: ... def set_loader(fxn: Callable[..., types.ModuleType]) -> Callable[..., types.ModuleType]: ... @@ -23,7 +23,7 @@ def spec_from_file_location( location: StrOrBytesPath | None = ..., *, loader: importlib.abc.Loader | None = ..., - submodule_search_locations: List[str] | None = ..., + submodule_search_locations: list[str] | None = ..., ) -> importlib.machinery.ModuleSpec | None: ... def module_from_spec(spec: importlib.machinery.ModuleSpec) -> types.ModuleType: ... diff --git a/stdlib/io.pyi b/stdlib/io.pyi index becfd7e6ad9d..6342907004d5 100644 --- a/stdlib/io.pyi +++ b/stdlib/io.pyi @@ -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, List, TextIO, Tuple, Type +from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, TextIO, Tuple, Type DEFAULT_BUFFER_SIZE: int @@ -34,7 +34,7 @@ class IOBase: def isatty(self) -> bool: ... def readable(self) -> bool: ... read: Callable[..., Any] - def readlines(self, __hint: int = ...) -> List[bytes]: ... + def readlines(self, __hint: int = ...) -> list[bytes]: ... def seek(self, __offset: int, __whence: int = ...) -> int: ... def seekable(self) -> bool: ... def tell(self) -> int: ... @@ -126,7 +126,7 @@ class TextIOBase(IOBase): def write(self, __s: str) -> int: ... def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore def readline(self, __size: int = ...) -> str: ... # type: ignore - def readlines(self, __hint: int = ...) -> List[str]: ... # type: ignore + def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore def read(self, __size: int | None = ...) -> str: ... def tell(self) -> int: ... @@ -164,7 +164,7 @@ class TextIOWrapper(TextIOBase, TextIO): def __next__(self) -> str: ... # type: ignore def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore def readline(self, __size: int = ...) -> str: ... # type: ignore - def readlines(self, __hint: int = ...) -> List[str]: ... # type: ignore + def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore def seek(self, __cookie: int, __whence: int = ...) -> int: ... class StringIO(TextIOWrapper): diff --git a/stdlib/json/__init__.pyi b/stdlib/json/__init__.pyi index 1194bd2eaf4d..e37e68ca3b99 100644 --- a/stdlib/json/__init__.pyi +++ b/stdlib/json/__init__.pyi @@ -1,5 +1,5 @@ from _typeshed import SupportsRead -from typing import IO, Any, Callable, Dict, List, Tuple, Type +from typing import IO, Any, Callable, Tuple, Type from .decoder import JSONDecodeError as JSONDecodeError, JSONDecoder as JSONDecoder from .encoder import JSONEncoder as JSONEncoder @@ -37,22 +37,22 @@ def loads( s: str | bytes, *, cls: Type[JSONDecoder] | None = ..., - object_hook: Callable[[Dict[Any, Any]], Any] | None = ..., + object_hook: Callable[[dict[Any, Any]], Any] | None = ..., parse_float: Callable[[str], Any] | None = ..., parse_int: Callable[[str], Any] | None = ..., parse_constant: Callable[[str], Any] | None = ..., - object_pairs_hook: Callable[[List[Tuple[Any, Any]]], Any] | None = ..., + object_pairs_hook: Callable[[list[Tuple[Any, Any]]], Any] | None = ..., **kwds: Any, ) -> Any: ... def load( fp: SupportsRead[str | bytes], *, cls: Type[JSONDecoder] | None = ..., - object_hook: Callable[[Dict[Any, Any]], Any] | None = ..., + object_hook: Callable[[dict[Any, Any]], Any] | None = ..., parse_float: Callable[[str], Any] | None = ..., parse_int: Callable[[str], Any] | None = ..., parse_constant: Callable[[str], Any] | None = ..., - object_pairs_hook: Callable[[List[Tuple[Any, Any]]], Any] | None = ..., + object_pairs_hook: Callable[[list[Tuple[Any, Any]]], Any] | None = ..., **kwds: Any, ) -> Any: ... def detect_encoding(b: bytes) -> str: ... # undocumented diff --git a/stdlib/json/decoder.pyi b/stdlib/json/decoder.pyi index 3ffd3da65e57..301bfa1dadcc 100644 --- a/stdlib/json/decoder.pyi +++ b/stdlib/json/decoder.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, List, Tuple +from typing import Any, Callable, Tuple class JSONDecodeError(ValueError): msg: str @@ -9,21 +9,21 @@ class JSONDecodeError(ValueError): def __init__(self, msg: str, doc: str, pos: int) -> None: ... class JSONDecoder: - object_hook: Callable[[Dict[str, Any]], Any] + object_hook: Callable[[dict[str, Any]], Any] parse_float: Callable[[str], Any] parse_int: Callable[[str], Any] parse_constant: Callable[[str], Any] = ... strict: bool - object_pairs_hook: Callable[[List[Tuple[str, Any]]], Any] + object_pairs_hook: Callable[[list[Tuple[str, Any]]], Any] def __init__( self, *, - object_hook: Callable[[Dict[str, Any]], Any] | None = ..., + object_hook: Callable[[dict[str, Any]], Any] | None = ..., parse_float: Callable[[str], Any] | None = ..., parse_int: Callable[[str], Any] | None = ..., parse_constant: Callable[[str], Any] | None = ..., strict: bool = ..., - object_pairs_hook: Callable[[List[Tuple[str, Any]]], Any] | None = ..., + object_pairs_hook: Callable[[list[Tuple[str, Any]]], Any] | None = ..., ) -> None: ... def decode(self, s: str, _w: Callable[..., Any] = ...) -> Any: ... # _w is undocumented def raw_decode(self, s: str, idx: int = ...) -> Tuple[Any, int]: ... diff --git a/stdlib/lib2to3/pgen2/grammar.pyi b/stdlib/lib2to3/pgen2/grammar.pyi index fe250cfe7717..48cb4eae916c 100644 --- a/stdlib/lib2to3/pgen2/grammar.pyi +++ b/stdlib/lib2to3/pgen2/grammar.pyi @@ -7,14 +7,14 @@ _DFA = List[List[Tuple[int, int]]] _DFAS = Tuple[_DFA, Dict[int, int]] class Grammar: - symbol2number: Dict[str, int] - number2symbol: Dict[int, str] - states: List[_DFA] - dfas: Dict[int, _DFAS] - labels: List[_Label] - keywords: Dict[str, int] - tokens: Dict[int, int] - symbol2label: Dict[str, int] + symbol2number: dict[str, int] + number2symbol: dict[int, str] + states: list[_DFA] + dfas: dict[int, _DFAS] + labels: list[_Label] + keywords: dict[str, int] + tokens: dict[int, int] + symbol2label: dict[str, int] start: int def __init__(self) -> None: ... def dump(self, filename: StrPath) -> None: ... @@ -23,4 +23,4 @@ class Grammar: def report(self) -> None: ... opmap_raw: str -opmap: Dict[str, str] +opmap: dict[str, str] diff --git a/stdlib/lib2to3/pgen2/literals.pyi b/stdlib/lib2to3/pgen2/literals.pyi index 4c162ecf2747..551ece19abd3 100644 --- a/stdlib/lib2to3/pgen2/literals.pyi +++ b/stdlib/lib2to3/pgen2/literals.pyi @@ -1,6 +1,6 @@ -from typing import Dict, Match +from typing import Match -simple_escapes: Dict[str, str] +simple_escapes: dict[str, str] def escape(m: Match[str]) -> str: ... def evalString(s: str) -> str: ... diff --git a/stdlib/lib2to3/pgen2/parse.pyi b/stdlib/lib2to3/pgen2/parse.pyi index fa8eed3b4f9e..d6e1ec4b72b8 100644 --- a/stdlib/lib2to3/pgen2/parse.pyi +++ b/stdlib/lib2to3/pgen2/parse.pyi @@ -1,6 +1,6 @@ from lib2to3.pgen2.grammar import _DFAS, Grammar from lib2to3.pytree import _NL, _Convert, _RawNode -from typing import Any, List, Sequence, Set, Tuple +from typing import Any, Sequence, Set, Tuple _Context = Sequence[Any] @@ -14,7 +14,7 @@ class ParseError(Exception): class Parser: grammar: Grammar convert: _Convert - stack: List[Tuple[_DFAS, int, _RawNode]] + stack: list[Tuple[_DFAS, int, _RawNode]] rootnode: _NL | None used_names: Set[str] def __init__(self, grammar: Grammar, convert: _Convert | None = ...) -> None: ... diff --git a/stdlib/lib2to3/pgen2/pgen.pyi b/stdlib/lib2to3/pgen2/pgen.pyi index 6050573deb5d..87b4a8aad71b 100644 --- a/stdlib/lib2to3/pgen2/pgen.pyi +++ b/stdlib/lib2to3/pgen2/pgen.pyi @@ -1,7 +1,7 @@ from _typeshed import StrPath from lib2to3.pgen2 import grammar from lib2to3.pgen2.tokenize import _TokenInfo -from typing import IO, Any, Dict, Iterable, Iterator, List, NoReturn, Tuple +from typing import IO, Any, Iterable, Iterator, NoReturn, Tuple class PgenGrammar(grammar.Grammar): ... @@ -9,18 +9,18 @@ class ParserGenerator: filename: StrPath stream: IO[str] generator: Iterator[_TokenInfo] - first: Dict[str, Dict[str, int]] + first: dict[str, dict[str, int]] def __init__(self, filename: StrPath, stream: IO[str] | None = ...) -> None: ... def make_grammar(self) -> PgenGrammar: ... - def make_first(self, c: PgenGrammar, name: str) -> Dict[int, int]: ... + def make_first(self, c: PgenGrammar, name: str) -> dict[int, int]: ... def make_label(self, c: PgenGrammar, label: str) -> int: ... def addfirstsets(self) -> None: ... def calcfirst(self, name: str) -> None: ... - def parse(self) -> Tuple[Dict[str, List[DFAState]], str]: ... - def make_dfa(self, start: NFAState, finish: NFAState) -> List[DFAState]: ... - def dump_nfa(self, name: str, start: NFAState, finish: NFAState) -> List[DFAState]: ... + def parse(self) -> Tuple[dict[str, list[DFAState]], str]: ... + def make_dfa(self, start: NFAState, finish: NFAState) -> list[DFAState]: ... + def dump_nfa(self, name: str, start: NFAState, finish: NFAState) -> list[DFAState]: ... def dump_dfa(self, name: str, dfa: Iterable[DFAState]) -> None: ... - def simplify_dfa(self, dfa: List[DFAState]) -> None: ... + def simplify_dfa(self, dfa: list[DFAState]) -> None: ... def parse_rhs(self) -> Tuple[NFAState, NFAState]: ... def parse_alt(self) -> Tuple[NFAState, NFAState]: ... def parse_item(self) -> Tuple[NFAState, NFAState]: ... @@ -30,15 +30,15 @@ class ParserGenerator: def raise_error(self, msg: str, *args: Any) -> NoReturn: ... class NFAState: - arcs: List[Tuple[str | None, NFAState]] + arcs: list[Tuple[str | None, NFAState]] def __init__(self) -> None: ... def addarc(self, next: NFAState, label: str | None = ...) -> None: ... class DFAState: - nfaset: Dict[NFAState, Any] + nfaset: dict[NFAState, Any] isfinal: bool - arcs: Dict[str, DFAState] - def __init__(self, nfaset: Dict[NFAState, Any], final: NFAState) -> None: ... + arcs: dict[str, DFAState] + def __init__(self, nfaset: dict[NFAState, Any], final: NFAState) -> None: ... def addarc(self, next: DFAState, label: str) -> None: ... def unifystate(self, old: DFAState, new: DFAState) -> None: ... def __eq__(self, other: Any) -> bool: ... diff --git a/stdlib/lib2to3/pgen2/token.pyi b/stdlib/lib2to3/pgen2/token.pyi index 86cafdcbb700..c4ab376eca64 100644 --- a/stdlib/lib2to3/pgen2/token.pyi +++ b/stdlib/lib2to3/pgen2/token.pyi @@ -1,5 +1,3 @@ -from typing import Dict - ENDMARKER: int NAME: int NUMBER: int @@ -61,7 +59,7 @@ ASYNC: int ERRORTOKEN: int N_TOKENS: int NT_OFFSET: int -tok_name: Dict[int, str] +tok_name: dict[int, str] def ISTERMINAL(x: int) -> bool: ... def ISNONTERMINAL(x: int) -> bool: ... diff --git a/stdlib/lib2to3/pgen2/tokenize.pyi b/stdlib/lib2to3/pgen2/tokenize.pyi index 116f77a69fe2..467fb0de25b9 100644 --- a/stdlib/lib2to3/pgen2/tokenize.pyi +++ b/stdlib/lib2to3/pgen2/tokenize.pyi @@ -1,5 +1,5 @@ from lib2to3.pgen2.token import * # noqa -from typing import Callable, Iterable, Iterator, List, Tuple +from typing import Callable, Iterable, Iterator, Tuple _Coord = Tuple[int, int] _TokenEater = Callable[[int, str, _Coord, _Coord, str], None] @@ -11,7 +11,7 @@ class StopTokenizing(Exception): ... def tokenize(readline: Callable[[], str], tokeneater: _TokenEater = ...) -> None: ... class Untokenizer: - tokens: List[str] + tokens: list[str] prev_row: int prev_col: int def __init__(self) -> None: ... diff --git a/stdlib/lib2to3/pytree.pyi b/stdlib/lib2to3/pytree.pyi index f78f2864c59d..f926e6f7f8b3 100644 --- a/stdlib/lib2to3/pytree.pyi +++ b/stdlib/lib2to3/pytree.pyi @@ -16,7 +16,7 @@ class Base: type: int parent: Node | None prefix: str - children: List[_NL] + children: list[_NL] was_changed: bool was_checked: bool def __eq__(self, other: Any) -> bool: ... @@ -24,7 +24,7 @@ class Base: def clone(self: _P) -> _P: ... def post_order(self) -> Iterator[_NL]: ... def pre_order(self) -> Iterator[_NL]: ... - def replace(self, new: _NL | List[_NL]) -> None: ... + def replace(self, new: _NL | list[_NL]) -> None: ... def get_lineno(self) -> int: ... def changed(self) -> None: ... def remove(self) -> int | None: ... @@ -37,14 +37,14 @@ class Base: def get_suffix(self) -> str: ... class Node(Base): - fixers_applied: List[Any] + fixers_applied: list[Any] def __init__( self, type: int, - children: List[_NL], + children: list[_NL], context: Any | None = ..., prefix: str | None = ..., - fixers_applied: List[Any] | None = ..., + fixers_applied: list[Any] | None = ..., ) -> None: ... def set_child(self, i: int, child: _NL) -> None: ... def insert_child(self, i: int, child: _NL) -> None: ... @@ -54,9 +54,9 @@ class Leaf(Base): lineno: int column: int value: str - fixers_applied: List[Any] + fixers_applied: list[Any] def __init__( - self, type: int, value: str, context: _Context | None = ..., prefix: str | None = ..., fixers_applied: List[Any] = ... + self, type: int, value: str, context: _Context | None = ..., prefix: str | None = ..., fixers_applied: list[Any] = ... ) -> None: ... def convert(gr: Grammar, raw_node: _RawNode) -> _NL: ... @@ -67,8 +67,8 @@ class BasePattern: name: str | None def optimize(self) -> BasePattern: ... # sic, subclasses are free to optimize themselves into different patterns def match(self, node: _NL, results: _Results | None = ...) -> bool: ... - def match_seq(self, nodes: List[_NL], results: _Results | None = ...) -> bool: ... - def generate_matches(self, nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ... + def match_seq(self, nodes: list[_NL], results: _Results | None = ...) -> bool: ... + def generate_matches(self, nodes: list[_NL]) -> Iterator[Tuple[int, _Results]]: ... class LeafPattern(BasePattern): def __init__(self, type: int | None = ..., content: str | None = ..., name: str | None = ...) -> None: ... @@ -85,4 +85,4 @@ class WildcardPattern(BasePattern): class NegatedPattern(BasePattern): def __init__(self, content: str | None = ...) -> None: ... -def generate_matches(patterns: List[BasePattern], nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ... +def generate_matches(patterns: list[BasePattern], nodes: list[_NL]) -> Iterator[Tuple[int, _Results]]: ... diff --git a/stdlib/linecache.pyi b/stdlib/linecache.pyi index 1415bafdfb78..a66614bf6b37 100644 --- a/stdlib/linecache.pyi +++ b/stdlib/linecache.pyi @@ -6,11 +6,11 @@ _ModuleMetadata = Tuple[int, float, List[str], str] class _SourceLoader(Protocol): def __call__(self) -> str | None: ... -cache: Dict[str, _SourceLoader | _ModuleMetadata] # undocumented +cache: dict[str, _SourceLoader | _ModuleMetadata] # undocumented def getline(filename: str, lineno: int, module_globals: _ModuleGlobals | None = ...) -> str: ... def clearcache() -> None: ... -def getlines(filename: str, module_globals: _ModuleGlobals | None = ...) -> List[str]: ... +def getlines(filename: str, module_globals: _ModuleGlobals | None = ...) -> list[str]: ... def checkcache(filename: str | None = ...) -> None: ... -def updatecache(filename: str, module_globals: _ModuleGlobals | None = ...) -> List[str]: ... +def updatecache(filename: str, module_globals: _ModuleGlobals | None = ...) -> list[str]: ... def lazycache(filename: str, module_globals: _ModuleGlobals) -> bool: ... diff --git a/stdlib/locale.pyi b/stdlib/locale.pyi index 11bb65347054..da518575ac7c 100644 --- a/stdlib/locale.pyi +++ b/stdlib/locale.pyi @@ -4,7 +4,7 @@ import sys # as a type annotation or type alias. from builtins import str as _str from decimal import Decimal -from typing import Any, Callable, Dict, Iterable, List, Mapping, Sequence, Tuple +from typing import Any, Callable, Iterable, Mapping, Sequence, Tuple CODESET: int D_T_FMT: int @@ -78,7 +78,7 @@ CHAR_MAX: int class Error(Exception): ... def setlocale(category: int, locale: _str | Iterable[_str] | None = ...) -> _str: ... -def localeconv() -> Mapping[_str, int | _str | List[int]]: ... +def localeconv() -> Mapping[_str, int | _str | list[int]]: ... def nl_langinfo(__key: int) -> _str: ... def getdefaultlocale(envvars: Tuple[_str, ...] = ...) -> Tuple[_str | None, _str | None]: ... def getlocale(category: int = ...) -> Sequence[_str]: ... @@ -101,6 +101,6 @@ def atof(string: _str, func: Callable[[_str], float] = ...) -> float: ... def atoi(string: _str) -> int: ... def str(val: float) -> _str: ... -locale_alias: Dict[_str, _str] # undocumented -locale_encoding_alias: Dict[_str, _str] # undocumented -windows_locale: Dict[int, _str] # undocumented +locale_alias: dict[_str, _str] # undocumented +locale_encoding_alias: dict[_str, _str] # undocumented +windows_locale: dict[int, _str] # undocumented diff --git a/stdlib/mailbox.pyi b/stdlib/mailbox.pyi index 543af690c967..544760cc5e8c 100644 --- a/stdlib/mailbox.pyi +++ b/stdlib/mailbox.pyi @@ -7,11 +7,9 @@ from typing import ( Any, AnyStr, Callable, - Dict, Generic, Iterable, Iterator, - List, Mapping, Protocol, Sequence, @@ -61,12 +59,12 @@ class Mailbox(Generic[_MessageT]): # As '_ProxyFile' doesn't implement the full IO spec, and BytesIO is incompatible with it, get_file return is Any here def get_file(self, key: str) -> Any: ... def iterkeys(self) -> Iterator[str]: ... - def keys(self) -> List[str]: ... + def keys(self) -> list[str]: ... def itervalues(self) -> Iterator[_MessageT]: ... def __iter__(self) -> Iterator[_MessageT]: ... - def values(self) -> List[_MessageT]: ... + def values(self) -> list[_MessageT]: ... def iteritems(self) -> Iterator[Tuple[str, _MessageT]]: ... - def items(self) -> List[Tuple[str, _MessageT]]: ... + def items(self) -> list[Tuple[str, _MessageT]]: ... def __contains__(self, key: str) -> bool: ... def __len__(self) -> int: ... def clear(self) -> None: ... @@ -90,7 +88,7 @@ class Maildir(Mailbox[MaildirMessage]): self, dirname: StrOrBytesPath, factory: Callable[[IO[Any]], MaildirMessage] | None = ..., create: bool = ... ) -> None: ... def get_file(self, key: str) -> _ProxyFile[bytes]: ... - def list_folders(self) -> List[str]: ... + def list_folders(self) -> list[str]: ... def get_folder(self, folder: str) -> Maildir: ... def add_folder(self, folder: str) -> Maildir: ... def remove_folder(self, folder: str) -> None: ... @@ -119,11 +117,11 @@ class MH(Mailbox[MHMessage]): self, path: StrOrBytesPath, factory: Callable[[IO[Any]], MHMessage] | None = ..., create: bool = ... ) -> None: ... def get_file(self, key: str) -> _ProxyFile[bytes]: ... - def list_folders(self) -> List[str]: ... + def list_folders(self) -> list[str]: ... def get_folder(self, folder: StrOrBytesPath) -> MH: ... def add_folder(self, folder: StrOrBytesPath) -> MH: ... def remove_folder(self, folder: StrOrBytesPath) -> None: ... - def get_sequences(self) -> Dict[str, List[int]]: ... + def get_sequences(self) -> dict[str, list[int]]: ... def set_sequences(self, sequences: Mapping[str, Sequence[int]]) -> None: ... def pack(self) -> None: ... @@ -132,7 +130,7 @@ class Babyl(_singlefileMailbox[BabylMessage]): self, path: StrOrBytesPath, factory: Callable[[IO[Any]], BabylMessage] | None = ..., create: bool = ... ) -> None: ... def get_file(self, key: str) -> IO[bytes]: ... - def get_labels(self) -> List[str]: ... + def get_labels(self) -> list[str]: ... class Message(email.message.Message): def __init__(self, message: _MessageData | None = ...) -> None: ... @@ -160,13 +158,13 @@ class _mboxMMDFMessage(Message): class mboxMessage(_mboxMMDFMessage): ... class MHMessage(Message): - def get_sequences(self) -> List[str]: ... + def get_sequences(self) -> list[str]: ... def set_sequences(self, sequences: Iterable[str]) -> None: ... def add_sequence(self, sequence: str) -> None: ... def remove_sequence(self, sequence: str) -> None: ... class BabylMessage(Message): - def get_labels(self) -> List[str]: ... + def get_labels(self) -> list[str]: ... def set_labels(self, labels: Iterable[str]) -> None: ... def add_label(self, label: str) -> None: ... def remove_label(self, label: str) -> None: ... @@ -181,7 +179,7 @@ class _ProxyFile(Generic[AnyStr]): def read(self, size: int | None = ...) -> AnyStr: ... def read1(self, size: int | None = ...) -> AnyStr: ... def readline(self, size: int | None = ...) -> AnyStr: ... - def readlines(self, sizehint: int | None = ...) -> List[AnyStr]: ... + def readlines(self, sizehint: int | None = ...) -> list[AnyStr]: ... def __iter__(self) -> Iterator[AnyStr]: ... def tell(self) -> int: ... def seek(self, offset: int, whence: int = ...) -> None: ... diff --git a/stdlib/mailcap.pyi b/stdlib/mailcap.pyi index b29854f3c744..2d4008f48c6c 100644 --- a/stdlib/mailcap.pyi +++ b/stdlib/mailcap.pyi @@ -1,8 +1,8 @@ -from typing import Dict, List, Mapping, Sequence, Tuple, Union +from typing import Dict, Mapping, Sequence, Tuple, Union _Cap = Dict[str, Union[str, int]] def findmatch( - caps: Mapping[str, List[_Cap]], MIMEtype: str, key: str = ..., filename: str = ..., plist: Sequence[str] = ... + caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = ..., filename: str = ..., plist: Sequence[str] = ... ) -> Tuple[str | None, _Cap | None]: ... -def getcaps() -> Dict[str, List[_Cap]]: ... +def getcaps() -> dict[str, list[_Cap]]: ... diff --git a/stdlib/mimetypes.pyi b/stdlib/mimetypes.pyi index f952d42a2015..5a3ec91acbcd 100644 --- a/stdlib/mimetypes.pyi +++ b/stdlib/mimetypes.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import StrPath -from typing import IO, Dict, List, Sequence, Tuple +from typing import IO, Sequence, Tuple if sys.version_info >= (3, 8): def guess_type(url: StrPath, strict: bool = ...) -> Tuple[str | None, str | None]: ... @@ -8,28 +8,28 @@ if sys.version_info >= (3, 8): else: def guess_type(url: str, strict: bool = ...) -> Tuple[str | None, str | None]: ... -def guess_all_extensions(type: str, strict: bool = ...) -> List[str]: ... +def guess_all_extensions(type: str, strict: bool = ...) -> list[str]: ... def guess_extension(type: str, strict: bool = ...) -> str | None: ... def init(files: Sequence[str] | None = ...) -> None: ... -def read_mime_types(file: str) -> Dict[str, str] | None: ... +def read_mime_types(file: str) -> dict[str, str] | None: ... def add_type(type: str, ext: str, strict: bool = ...) -> None: ... inited: bool -knownfiles: List[str] -suffix_map: Dict[str, str] -encodings_map: Dict[str, str] -types_map: Dict[str, str] -common_types: Dict[str, str] +knownfiles: list[str] +suffix_map: dict[str, str] +encodings_map: dict[str, str] +types_map: dict[str, str] +common_types: dict[str, str] class MimeTypes: - suffix_map: Dict[str, str] - encodings_map: Dict[str, str] - types_map: Tuple[Dict[str, str], Dict[str, str]] - types_map_inv: Tuple[Dict[str, str], Dict[str, str]] + suffix_map: dict[str, str] + encodings_map: dict[str, str] + types_map: Tuple[dict[str, str], dict[str, str]] + types_map_inv: Tuple[dict[str, str], dict[str, str]] def __init__(self, filenames: Tuple[str, ...] = ..., strict: bool = ...) -> None: ... def guess_extension(self, type: str, strict: bool = ...) -> str | None: ... def guess_type(self, url: str, strict: bool = ...) -> Tuple[str | None, str | None]: ... - def guess_all_extensions(self, type: str, strict: bool = ...) -> List[str]: ... + def guess_all_extensions(self, type: str, strict: bool = ...) -> list[str]: ... def read(self, filename: str, strict: bool = ...) -> None: ... def readfp(self, fp: IO[str], strict: bool = ...) -> None: ... if sys.platform == "win32": diff --git a/stdlib/modulefinder.pyi b/stdlib/modulefinder.pyi index 1a5a4996d409..89f8bd45f106 100644 --- a/stdlib/modulefinder.pyi +++ b/stdlib/modulefinder.pyi @@ -1,6 +1,6 @@ import sys from types import CodeType -from typing import IO, Any, Container, Dict, Iterable, Iterator, List, Sequence, Tuple +from typing import IO, Any, Container, Iterable, Iterator, Sequence, Tuple LOAD_CONST: int # undocumented IMPORT_NAME: int # undocumented @@ -9,11 +9,11 @@ STORE_GLOBAL: int # undocumented STORE_OPS: Tuple[int, int] # undocumented EXTENDED_ARG: int # undocumented -packagePathMap: Dict[str, List[str]] # undocumented +packagePathMap: dict[str, list[str]] # undocumented def AddPackagePath(packagename: str, path: str) -> None: ... -replacePackageMap: Dict[str, str] # undocumented +replacePackageMap: dict[str, str] # undocumented def ReplacePackage(oldname: str, newname: str) -> None: ... @@ -23,9 +23,9 @@ class Module: # undocumented class ModuleFinder: - modules: Dict[str, Module] - path: List[str] # undocumented - badmodules: Dict[str, Dict[str, int]] # undocumented + modules: dict[str, Module] + path: list[str] # undocumented + badmodules: dict[str, dict[str, int]] # undocumented debug: int # undocumented indent: int # undocumented excludes: Container[str] # undocumented @@ -34,7 +34,7 @@ class ModuleFinder: if sys.version_info >= (3, 8): def __init__( self, - path: List[str] | None = ..., + path: list[str] | None = ..., debug: int = ..., excludes: Container[str] | None = ..., replace_paths: Sequence[Tuple[str, str]] | None = ..., @@ -42,7 +42,7 @@ class ModuleFinder: else: def __init__( self, - path: List[str] | None = ..., + path: list[str] | None = ..., debug: int = ..., excludes: Container[str] = ..., replace_paths: Sequence[Tuple[str, str]] = ..., @@ -53,7 +53,7 @@ class ModuleFinder: def run_script(self, pathname: str) -> None: ... def load_file(self, pathname: str) -> None: ... # undocumented def import_hook( - self, name: str, caller: Module | None = ..., fromlist: List[str] | None = ..., level: int = ... + self, name: str, caller: Module | None = ..., fromlist: list[str] | None = ..., level: int = ... ) -> Module | None: ... # undocumented def determine_parent(self, caller: Module | None, level: int = ...) -> Module | None: ... # undocumented def find_head_package(self, parent: Module, name: str) -> Tuple[Module, str]: ... # undocumented @@ -70,6 +70,6 @@ class ModuleFinder: self, name: str, path: str | None, parent: Module | None = ... ) -> Tuple[IO[Any] | None, str | None, Tuple[str, str, int]]: ... # undocumented def report(self) -> None: ... - def any_missing(self) -> List[str]: ... # undocumented - def any_missing_maybe(self) -> Tuple[List[str], List[str]]: ... # undocumented + def any_missing(self) -> list[str]: ... # undocumented + def any_missing_maybe(self) -> Tuple[list[str], list[str]]: ... # undocumented def replace_paths_in_code(self, co: CodeType) -> CodeType: ... # undocumented diff --git a/stdlib/msilib/__init__.pyi b/stdlib/msilib/__init__.pyi index b0d77b141d4a..ca05ee6f4309 100644 --- a/stdlib/msilib/__init__.pyi +++ b/stdlib/msilib/__init__.pyi @@ -1,6 +1,6 @@ import sys from types import ModuleType -from typing import Any, Container, Dict, Iterable, List, Sequence, Set, Tuple, Type +from typing import Any, Container, Iterable, Sequence, Set, Tuple, Type from typing_extensions import Literal if sys.platform == "win32": @@ -25,7 +25,7 @@ if sys.platform == "win32": class Table: name: str - fields: List[Tuple[int, str, int]] + fields: list[Tuple[int, str, int]] def __init__(self, name: str) -> None: ... def add_field(self, index: int, name: str, type: int) -> None: ... def sql(self) -> str: ... @@ -48,7 +48,7 @@ if sys.platform == "win32": class CAB: name: str - files: List[Tuple[str, str]] + files: list[Tuple[str, str]] filenames: Set[str] index: int def __init__(self, name: str) -> None: ... @@ -66,7 +66,7 @@ if sys.platform == "win32": component: str | None short_names: Set[str] ids: Set[str] - keyfiles: Dict[str, str] + keyfiles: dict[str, str] componentflags: int | None absolute: str def __init__( @@ -89,7 +89,7 @@ if sys.platform == "win32": ) -> None: ... def make_short(self, file: str) -> str: ... def add_file(self, file: str, src: str | None = ..., version: str | None = ..., language: str | None = ...) -> str: ... - def glob(self, pattern: str, exclude: Container[str] | None = ...) -> List[str]: ... + def glob(self, pattern: str, exclude: Container[str] | None = ...) -> list[str]: ... def remove_pyc(self) -> None: ... class Binary: diff --git a/stdlib/msilib/schema.pyi b/stdlib/msilib/schema.pyi index d59e9767c3de..df57ade15a2f 100644 --- a/stdlib/msilib/schema.pyi +++ b/stdlib/msilib/schema.pyi @@ -1,5 +1,5 @@ import sys -from typing import List, Tuple +from typing import Tuple if sys.platform == "win32": from . import Table @@ -90,6 +90,6 @@ if sys.platform == "win32": Upgrade: Table Verb: Table - tables: List[Table] + tables: list[Table] - _Validation_records: List[Tuple[str, str, str, int | None, int | None, str | None, int | None, str | None, str | None, str]] + _Validation_records: list[Tuple[str, str, str, int | None, int | None, str | None, int | None, str | None, str | None, str]] diff --git a/stdlib/msilib/sequence.pyi b/stdlib/msilib/sequence.pyi index e4f400d33233..123d232886f7 100644 --- a/stdlib/msilib/sequence.pyi +++ b/stdlib/msilib/sequence.pyi @@ -11,4 +11,4 @@ if sys.platform == "win32": InstallExecuteSequence: _SequenceType InstallUISequence: _SequenceType - tables: List[str] + tables: list[str] diff --git a/stdlib/msilib/text.pyi b/stdlib/msilib/text.pyi index 4ae8ee68184b..fe2dc23830e0 100644 --- a/stdlib/msilib/text.pyi +++ b/stdlib/msilib/text.pyi @@ -1,9 +1,9 @@ import sys -from typing import List, Tuple +from typing import Tuple if sys.platform == "win32": - ActionText: List[Tuple[str, str, str | None]] - UIText: List[Tuple[str, str | None]] + ActionText: list[Tuple[str, str, str | None]] + UIText: list[Tuple[str, str | None]] - tables: List[str] + tables: list[str] diff --git a/stdlib/multiprocessing/connection.pyi b/stdlib/multiprocessing/connection.pyi index 95d5b5c7c1e7..4f6dc1ba7efa 100644 --- a/stdlib/multiprocessing/connection.pyi +++ b/stdlib/multiprocessing/connection.pyi @@ -2,7 +2,7 @@ import socket import sys import types from _typeshed import Self -from typing import Any, Iterable, List, Tuple, Type, Union +from typing import Any, Iterable, Tuple, Type, Union if sys.version_info >= (3, 8): from typing import SupportsIndex @@ -58,6 +58,6 @@ def deliver_challenge(connection: Connection, authkey: bytes) -> None: ... def answer_challenge(connection: Connection, authkey: bytes) -> None: ... def wait( object_list: Iterable[Connection | socket.socket | int], timeout: float | None = ... -) -> List[Connection | socket.socket | int]: ... +) -> list[Connection | socket.socket | int]: ... def Client(address: _Address, family: str | None = ..., authkey: bytes | None = ...) -> Connection: ... def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ... diff --git a/stdlib/multiprocessing/dummy/__init__.pyi b/stdlib/multiprocessing/dummy/__init__.pyi index 64e0bb61e158..b4d1c8404d8d 100644 --- a/stdlib/multiprocessing/dummy/__init__.pyi +++ b/stdlib/multiprocessing/dummy/__init__.pyi @@ -2,7 +2,7 @@ import array import threading import weakref from queue import Queue as Queue -from typing import Any, Callable, Iterable, List, Mapping, Sequence +from typing import Any, Callable, Iterable, Mapping, Sequence JoinableQueue = Queue Barrier = threading.Barrier @@ -44,7 +44,7 @@ class Value: def Array(typecode: Any, sequence: Sequence[Any], lock: Any = ...) -> array.array[Any]: ... def Manager() -> Any: ... def Pool(processes: int | None = ..., initializer: Callable[..., Any] | None = ..., initargs: Iterable[Any] = ...) -> Any: ... -def active_children() -> List[Any]: ... +def active_children() -> list[Any]: ... def current_process() -> threading.Thread: ... def freeze_support() -> None: ... def shutdown() -> None: ... diff --git a/stdlib/multiprocessing/dummy/connection.pyi b/stdlib/multiprocessing/dummy/connection.pyi index 0d788fd42df8..71e9a50fab21 100644 --- a/stdlib/multiprocessing/dummy/connection.pyi +++ b/stdlib/multiprocessing/dummy/connection.pyi @@ -1,9 +1,9 @@ from _typeshed import Self from queue import Queue from types import TracebackType -from typing import Any, List, Tuple, Type, Union +from typing import Any, Tuple, Type, Union -families: List[None] +families: list[None] _Address = Union[str, Tuple[str, int]] diff --git a/stdlib/multiprocessing/pool.pyi b/stdlib/multiprocessing/pool.pyi index f602a8ccb241..63f8d6d034f5 100644 --- a/stdlib/multiprocessing/pool.pyi +++ b/stdlib/multiprocessing/pool.pyi @@ -53,7 +53,7 @@ class Pool(ContextManager[Pool]): callback: Callable[[_T], None] | None = ..., error_callback: Callable[[BaseException], None] | None = ..., ) -> AsyncResult[_T]: ... - def map(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ...) -> List[_T]: ... + def map(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ...) -> list[_T]: ... def map_async( self, func: Callable[[_S], _T], @@ -66,7 +66,7 @@ class Pool(ContextManager[Pool]): def imap_unordered( self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ... ) -> IMapIterator[_T]: ... - def starmap(self, func: Callable[..., _T], iterable: Iterable[Iterable[Any]], chunksize: int | None = ...) -> List[_T]: ... + def starmap(self, func: Callable[..., _T], iterable: Iterable[Iterable[Any]], chunksize: int | None = ...) -> list[_T]: ... def starmap_async( self, func: Callable[..., _T], @@ -74,7 +74,7 @@ class Pool(ContextManager[Pool]): chunksize: int | None = ..., callback: Callable[[_T], None] | None = ..., error_callback: Callable[[BaseException], None] | None = ..., - ) -> AsyncResult[List[_T]]: ... + ) -> AsyncResult[list[_T]]: ... def close(self) -> None: ... def terminate(self) -> None: ... def join(self) -> None: ... diff --git a/stdlib/multiprocessing/process.pyi b/stdlib/multiprocessing/process.pyi index d5300e79367b..249ff712e05f 100644 --- a/stdlib/multiprocessing/process.pyi +++ b/stdlib/multiprocessing/process.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Callable, List, Mapping, Tuple +from typing import Any, Callable, Mapping, Tuple class BaseProcess: name: str @@ -33,7 +33,7 @@ class BaseProcess: def sentinel(self) -> int: ... def current_process() -> BaseProcess: ... -def active_children() -> List[BaseProcess]: ... +def active_children() -> list[BaseProcess]: ... if sys.version_info >= (3, 8): def parent_process() -> BaseProcess | None: ... diff --git a/stdlib/multiprocessing/spawn.pyi b/stdlib/multiprocessing/spawn.pyi index 4d42f4252b12..34c7322e0d46 100644 --- a/stdlib/multiprocessing/spawn.pyi +++ b/stdlib/multiprocessing/spawn.pyi @@ -1,5 +1,5 @@ from types import ModuleType -from typing import Any, Dict, List, Mapping, Sequence +from typing import Any, Mapping, Sequence WINEXE: bool WINSERVICE: bool @@ -8,14 +8,14 @@ def set_executable(exe: str) -> None: ... def get_executable() -> str: ... def is_forking(argv: Sequence[str]) -> bool: ... def freeze_support() -> None: ... -def get_command_line(**kwds: Any) -> List[str]: ... +def get_command_line(**kwds: Any) -> list[str]: ... def spawn_main(pipe_handle: int, parent_pid: int | None = ..., tracker_fd: int | None = ...) -> None: ... # undocumented def _main(fd: int) -> Any: ... -def get_preparation_data(name: str) -> Dict[str, Any]: ... +def get_preparation_data(name: str) -> dict[str, Any]: ... -old_main_modules: List[ModuleType] +old_main_modules: list[ModuleType] def prepare(data: Mapping[str, Any]) -> None: ... def import_main_path(main_path: str) -> None: ... diff --git a/stdlib/netrc.pyi b/stdlib/netrc.pyi index a0044f02b5e2..b8eac307740a 100644 --- a/stdlib/netrc.pyi +++ b/stdlib/netrc.pyi @@ -1,5 +1,5 @@ from _typeshed import StrOrBytesPath -from typing import Dict, List, Optional, Tuple +from typing import Optional, Tuple class NetrcParseError(Exception): filename: str | None @@ -11,7 +11,7 @@ class NetrcParseError(Exception): _NetrcTuple = Tuple[str, Optional[str], Optional[str]] class netrc: - hosts: Dict[str, _NetrcTuple] - macros: Dict[str, List[str]] + hosts: dict[str, _NetrcTuple] + macros: dict[str, list[str]] def __init__(self, file: StrOrBytesPath | None = ...) -> None: ... def authenticators(self, host: str) -> _NetrcTuple | None: ... diff --git a/stdlib/nis.pyi b/stdlib/nis.pyi index bc6c2bc07256..b762ae46241c 100644 --- a/stdlib/nis.pyi +++ b/stdlib/nis.pyi @@ -1,9 +1,8 @@ import sys -from typing import Dict, List if sys.platform != "win32": - def cat(map: str, domain: str = ...) -> Dict[str, str]: ... + def cat(map: str, domain: str = ...) -> dict[str, str]: ... def get_default_domain() -> str: ... - def maps(domain: str = ...) -> List[str]: ... + def maps(domain: str = ...) -> list[str]: ... def match(key: str, map: str, domain: str = ...) -> str: ... class error(Exception): ... diff --git a/stdlib/opcode.pyi b/stdlib/opcode.pyi index 820b867670be..982ddee43a63 100644 --- a/stdlib/opcode.pyi +++ b/stdlib/opcode.pyi @@ -1,17 +1,17 @@ import sys -from typing import Dict, List, Sequence +from typing import Sequence cmp_op: Sequence[str] -hasconst: List[int] -hasname: List[int] -hasjrel: List[int] -hasjabs: List[int] -haslocal: List[int] -hascompare: List[int] -hasfree: List[int] -opname: List[str] +hasconst: list[int] +hasname: list[int] +hasjrel: list[int] +hasjabs: list[int] +haslocal: list[int] +hascompare: list[int] +hasfree: list[int] +opname: list[str] -opmap: Dict[str, int] +opmap: dict[str, int] HAVE_ARGUMENT: int EXTENDED_ARG: int @@ -21,4 +21,4 @@ if sys.version_info >= (3, 8): else: def stack_effect(__opcode: int, __oparg: int | None = ...) -> int: ... -hasnargs: List[int] +hasnargs: list[int] diff --git a/stdlib/optparse.pyi b/stdlib/optparse.pyi index 18cee61c08ed..38c7746a9ff8 100644 --- a/stdlib/optparse.pyi +++ b/stdlib/optparse.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, AnyStr, Callable, Dict, Iterable, List, Mapping, Sequence, Tuple, Type, overload +from typing import IO, Any, AnyStr, Callable, Iterable, Mapping, Sequence, Tuple, Type, overload NO_DEFAULT: Tuple[str, ...] SUPPRESS_HELP: str @@ -38,7 +38,7 @@ class HelpFormatter: indent_increment: int level: int max_help_position: int - option_strings: Dict[Option, str] + option_strings: dict[Option, str] parser: OptionParser short_first: Any width: int @@ -74,15 +74,15 @@ class TitledHelpFormatter(HelpFormatter): class Option: ACTIONS: Tuple[str, ...] ALWAYS_TYPED_ACTIONS: Tuple[str, ...] - ATTRS: List[str] - CHECK_METHODS: List[Callable[..., Any]] | None + ATTRS: list[str] + CHECK_METHODS: list[Callable[..., Any]] | None CONST_ACTIONS: Tuple[str, ...] STORE_ACTIONS: Tuple[str, ...] TYPED_ACTIONS: Tuple[str, ...] TYPES: Tuple[str, ...] - TYPE_CHECKER: Dict[str, Callable[..., Any]] - _long_opts: List[str] - _short_opts: List[str] + TYPE_CHECKER: dict[str, Callable[..., Any]] + _long_opts: list[str] + _short_opts: list[str] action: str dest: str | None default: Any @@ -90,7 +90,7 @@ class Option: type: Any callback: Callable[..., Any] | None callback_args: Tuple[Any, ...] | None - callback_kwargs: Dict[str, Any] | None + callback_kwargs: dict[str, Any] | None help: str | None metavar: str | None def __init__(self, *opts: str | None, **attrs: Any) -> None: ... @@ -100,9 +100,9 @@ class Option: def _check_const(self) -> None: ... def _check_dest(self) -> None: ... def _check_nargs(self) -> None: ... - def _check_opt_strings(self, opts: Iterable[str | None]) -> List[str]: ... + def _check_opt_strings(self, opts: Iterable[str | None]) -> list[str]: ... def _check_type(self) -> None: ... - def _set_attrs(self, attrs: Dict[str, Any]) -> None: ... + def _set_attrs(self, attrs: dict[str, Any]) -> None: ... def _set_opt_strings(self, opts: Iterable[str]) -> None: ... def check_value(self, opt: str, value: Any) -> Any: ... def convert_value(self, opt: str, value: Any) -> Any: ... @@ -114,10 +114,10 @@ class Option: make_option = Option class OptionContainer: - _long_opt: Dict[str, Option] - _short_opt: Dict[str, Option] + _long_opt: dict[str, Option] + _short_opt: dict[str, Option] conflict_handler: str - defaults: Dict[str, Any] + defaults: dict[str, Any] description: Any option_class: Type[Option] def __init__(self, option_class: Type[Option], conflict_handler: Any, description: Any) -> None: ... @@ -141,7 +141,7 @@ class OptionContainer: def set_description(self, description: Any) -> None: ... class OptionGroup(OptionContainer): - option_list: List[Option] + option_list: list[Option] parser: OptionParser title: str def __init__(self, parser: OptionParser, title: str, description: str | None = ...) -> None: ... @@ -163,13 +163,13 @@ class OptionParser(OptionContainer): allow_interspersed_args: bool epilog: str | None formatter: HelpFormatter - largs: List[str] | None - option_groups: List[OptionGroup] - option_list: List[Option] + largs: list[str] | None + option_groups: list[OptionGroup] + option_list: list[Option] process_default_values: Any prog: str | None - rargs: List[Any] | None - standard_option_list: List[Option] + rargs: list[Any] | None + standard_option_list: list[Option] usage: str | None values: Values | None version: str @@ -189,19 +189,19 @@ class OptionParser(OptionContainer): def _add_help_option(self) -> None: ... def _add_version_option(self) -> None: ... def _create_option_list(self) -> None: ... - def _get_all_options(self) -> List[Option]: ... - def _get_args(self, args: Iterable[Any]) -> List[Any]: ... + def _get_all_options(self) -> list[Option]: ... + def _get_args(self, args: Iterable[Any]) -> list[Any]: ... def _init_parsing_state(self) -> None: ... def _match_long_opt(self, opt: str) -> str: ... def _populate_option_list(self, option_list: Iterable[Option], add_help: bool = ...) -> None: ... - def _process_args(self, largs: List[Any], rargs: List[Any], values: Values) -> None: ... - def _process_long_opt(self, rargs: List[Any], values: Any) -> None: ... - def _process_short_opts(self, rargs: List[Any], values: Any) -> None: ... + def _process_args(self, largs: list[Any], rargs: list[Any], values: Values) -> None: ... + def _process_long_opt(self, rargs: list[Any], values: Any) -> None: ... + def _process_short_opts(self, rargs: list[Any], values: Any) -> None: ... @overload def add_option_group(self, __opt_group: OptionGroup) -> OptionGroup: ... @overload def add_option_group(self, *args: Any, **kwargs: Any) -> OptionGroup: ... - def check_values(self, values: Values, args: List[str]) -> Tuple[Values, List[str]]: ... + def check_values(self, values: Values, args: list[str]) -> Tuple[Values, list[str]]: ... def disable_interspersed_args(self) -> None: ... def enable_interspersed_args(self) -> None: ... def error(self, msg: str) -> None: ... @@ -215,7 +215,7 @@ class OptionParser(OptionContainer): def get_prog_name(self) -> str: ... def get_usage(self) -> str: ... def get_version(self) -> str: ... - def parse_args(self, args: Sequence[AnyStr] | None = ..., values: Values | None = ...) -> Tuple[Values, List[AnyStr]]: ... + def parse_args(self, args: Sequence[AnyStr] | None = ..., values: Values | None = ...) -> Tuple[Values, list[AnyStr]]: ... def print_usage(self, file: IO[str] | None = ...) -> None: ... def print_help(self, file: IO[str] | None = ...) -> None: ... def print_version(self, file: IO[str] | None = ...) -> None: ... diff --git a/stdlib/ossaudiodev.pyi b/stdlib/ossaudiodev.pyi index af3e2c210930..f221c95b8036 100644 --- a/stdlib/ossaudiodev.pyi +++ b/stdlib/ossaudiodev.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, overload +from typing import Any, overload from typing_extensions import Literal AFMT_AC3: int @@ -114,8 +114,8 @@ SOUND_MIXER_TREBLE: int SOUND_MIXER_VIDEO: int SOUND_MIXER_VOLUME: int -control_labels: List[str] -control_names: List[str] +control_labels: list[str] +control_names: list[str] # TODO: oss_audio_device return type @overload diff --git a/stdlib/parser.pyi b/stdlib/parser.pyi index 1ad59da024f2..cefcad5b08f1 100644 --- a/stdlib/parser.pyi +++ b/stdlib/parser.pyi @@ -1,12 +1,12 @@ from _typeshed import StrOrBytesPath from types import CodeType -from typing import Any, List, Sequence, Tuple +from typing import Any, Sequence, Tuple def expr(source: str) -> STType: ... def suite(source: str) -> STType: ... def sequence2st(sequence: Sequence[Any]) -> STType: ... def tuple2st(sequence: Sequence[Any]) -> STType: ... -def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ... +def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> list[Any]: ... def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ... def compilest(st: STType, filename: StrOrBytesPath = ...) -> CodeType: ... def isexpr(st: STType) -> bool: ... @@ -18,5 +18,5 @@ class STType: def compile(self, filename: StrOrBytesPath = ...) -> CodeType: ... def isexpr(self) -> bool: ... def issuite(self) -> bool: ... - def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ... + def tolist(self, line_info: bool = ..., col_info: bool = ...) -> list[Any]: ... def totuple(self, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ... diff --git a/stdlib/pathlib.pyi b/stdlib/pathlib.pyi index 5d454250c9ac..db1dff36bd8c 100644 --- a/stdlib/pathlib.pyi +++ b/stdlib/pathlib.pyi @@ -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, List, Sequence, Tuple, Type, TypeVar, overload +from typing import IO, Any, BinaryIO, Generator, Sequence, Tuple, Type, TypeVar, overload from typing_extensions import Literal if sys.version_info >= (3, 9): @@ -26,7 +26,7 @@ class PurePath(PathLike[str]): anchor: str name: str suffix: str - suffixes: List[str] + suffixes: list[str] stem: str def __new__(cls: Type[_P], *args: StrPath) -> _P: ... def __hash__(self) -> int: ... diff --git a/stdlib/pdb.pyi b/stdlib/pdb.pyi index 265fe2830dd9..0a25786d409f 100644 --- a/stdlib/pdb.pyi +++ b/stdlib/pdb.pyi @@ -4,7 +4,7 @@ from bdb import Bdb from cmd import Cmd from inspect import _SourceObjectType from types import CodeType, FrameType, TracebackType -from typing import IO, Any, Callable, ClassVar, Dict, Iterable, List, Mapping, Sequence, Tuple, TypeVar +from typing import IO, Any, Callable, ClassVar, Iterable, Mapping, Sequence, Tuple, TypeVar _T = TypeVar("_T") @@ -12,9 +12,9 @@ line_prefix: str # undocumented class Restart(Exception): ... -def run(statement: str, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... -def runeval(expression: str, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> Any: ... -def runctx(statement: str, globals: Dict[str, Any], locals: Mapping[str, Any]) -> None: ... +def run(statement: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... +def runeval(expression: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> Any: ... +def runctx(statement: str, globals: dict[str, Any], locals: Mapping[str, Any]) -> None: ... def runcall(func: Callable[..., _T], *args: Any, **kwds: Any) -> _T | None: ... if sys.version_info >= (3, 7): @@ -29,19 +29,19 @@ def pm() -> None: ... class Pdb(Bdb, Cmd): # Everything here is undocumented, except for __init__ - commands_resuming: ClassVar[List[str]] + commands_resuming: ClassVar[list[str]] - aliases: Dict[str, str] + aliases: dict[str, str] mainpyfile: str _wait_for_mainpyfile: bool - rcLines: List[str] - commands: Dict[int, List[str]] - commands_doprompt: Dict[int, bool] - commands_silent: Dict[int, bool] + rcLines: list[str] + commands: dict[int, list[str]] + commands_doprompt: dict[int, bool] + commands_silent: dict[int, bool] commands_defining: bool commands_bnum: int | None lineno: int | None - stack: List[Tuple[FrameType, int]] + stack: list[Tuple[FrameType, int]] curindex: int curframe: FrameType | None curframe_locals: Mapping[str, Any] @@ -136,11 +136,11 @@ class Pdb(Bdb, Cmd): def do_source(self, arg: str) -> bool | None: ... def do_undisplay(self, arg: str) -> bool | None: ... do_ll = do_longlist - def _complete_location(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ... - def _complete_bpnumber(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ... - def _complete_expression(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ... - def complete_undisplay(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ... - def complete_unalias(self, text: str, line: str, begidx: int, endidx: int) -> List[str]: ... + def _complete_location(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... + def _complete_bpnumber(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... + def _complete_expression(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... + def complete_undisplay(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... + def complete_unalias(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... complete_commands = _complete_bpnumber complete_break = _complete_location complete_b = _complete_location @@ -167,7 +167,7 @@ class Pdb(Bdb, Cmd): def find_function(funcname: str, filename: str) -> Tuple[str, str, int] | None: ... def main() -> None: ... def help() -> None: ... -def getsourcelines(obj: _SourceObjectType) -> Tuple[List[str], int]: ... +def getsourcelines(obj: _SourceObjectType) -> Tuple[list[str], int]: ... def lasti2lineno(code: CodeType, lasti: int) -> int: ... class _rstr(str): diff --git a/stdlib/pickletools.pyi b/stdlib/pickletools.pyi index 391ed7b4cac0..0f0fb47da5f9 100644 --- a/stdlib/pickletools.pyi +++ b/stdlib/pickletools.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Callable, Iterator, List, MutableMapping, Tuple, Type +from typing import IO, Any, Callable, Iterator, MutableMapping, Tuple, Type _Reader = Callable[[IO[bytes]], Any] bytes_types: Tuple[Type[Any], ...] @@ -135,8 +135,8 @@ class OpcodeInfo(object): name: str code: str arg: ArgumentDescriptor | None - stack_before: List[StackObject] - stack_after: List[StackObject] + stack_before: list[StackObject] + stack_after: list[StackObject] proto: int doc: str def __init__( @@ -144,13 +144,13 @@ class OpcodeInfo(object): name: str, code: str, arg: ArgumentDescriptor | None, - stack_before: List[StackObject], - stack_after: List[StackObject], + stack_before: list[StackObject], + stack_after: list[StackObject], proto: int, doc: str, ) -> None: ... -opcodes: List[OpcodeInfo] +opcodes: list[OpcodeInfo] def genops(pickle: bytes | IO[bytes]) -> Iterator[Tuple[OpcodeInfo, Any | None, int | None]]: ... def optimize(p: bytes | IO[bytes]) -> bytes: ... diff --git a/stdlib/pkgutil.pyi b/stdlib/pkgutil.pyi index c0a8e8e49782..54e0f22e4915 100644 --- a/stdlib/pkgutil.pyi +++ b/stdlib/pkgutil.pyi @@ -1,14 +1,14 @@ import sys from _typeshed import SupportsRead from importlib.abc import Loader, MetaPathFinder, PathEntryFinder -from typing import IO, Any, Callable, Iterable, Iterator, List, NamedTuple, Tuple +from typing import IO, Any, Callable, Iterable, Iterator, NamedTuple, Tuple class ModuleInfo(NamedTuple): module_finder: MetaPathFinder | PathEntryFinder name: str ispkg: bool -def extend_path(path: List[str], name: str) -> List[str]: ... +def extend_path(path: list[str], name: str) -> list[str]: ... class ImpImporter: def __init__(self, path: str | None = ...) -> None: ... diff --git a/stdlib/posix.pyi b/stdlib/posix.pyi index aad94fd5d196..aef3b54413a4 100644 --- a/stdlib/posix.pyi +++ b/stdlib/posix.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import StrOrBytesPath from os import PathLike, _ExecEnv, _ExecVArgs, stat_result as stat_result -from typing import Any, Dict, Iterable, List, NamedTuple, Sequence, Tuple, overload +from typing import Any, Iterable, NamedTuple, Sequence, Tuple, overload class uname_result(NamedTuple): sysname: str @@ -159,13 +159,13 @@ XATTR_REPLACE: int XATTR_SIZE_MAX: int @overload -def listdir(path: str | None = ...) -> List[str]: ... +def listdir(path: str | None = ...) -> list[str]: ... @overload -def listdir(path: bytes) -> List[bytes]: ... +def listdir(path: bytes) -> list[bytes]: ... @overload -def listdir(path: int) -> List[str]: ... +def listdir(path: int) -> list[str]: ... @overload -def listdir(path: PathLike[str]) -> List[str]: ... +def listdir(path: PathLike[str]) -> list[str]: ... if sys.platform != "win32" and sys.version_info >= (3, 8): def posix_spawn( @@ -196,6 +196,6 @@ if sys.platform != "win32" and sys.version_info >= (3, 8): ) -> int: ... if sys.platform == "win32": - environ: Dict[str, str] + environ: dict[str, str] else: - environ: Dict[bytes, bytes] + environ: dict[bytes, bytes] diff --git a/stdlib/pprint.pyi b/stdlib/pprint.pyi index 688561b43115..dcf3fd6b81da 100644 --- a/stdlib/pprint.pyi +++ b/stdlib/pprint.pyi @@ -1,5 +1,5 @@ import sys -from typing import IO, Any, Dict, Tuple +from typing import IO, Any, Tuple if sys.version_info >= (3, 10): def pformat( @@ -130,4 +130,4 @@ class PrettyPrinter: def pprint(self, object: object) -> None: ... def isreadable(self, object: object) -> bool: ... def isrecursive(self, object: object) -> bool: ... - def format(self, object: object, context: Dict[int, Any], maxlevels: int, level: int) -> Tuple[str, bool, bool]: ... + def format(self, object: object, context: dict[int, Any], maxlevels: int, level: int) -> Tuple[str, bool, bool]: ... diff --git a/stdlib/profile.pyi b/stdlib/profile.pyi index b159c0cc5876..cb0cbf7c9388 100644 --- a/stdlib/profile.pyi +++ b/stdlib/profile.pyi @@ -1,9 +1,9 @@ from _typeshed import StrOrBytesPath -from typing import Any, Callable, Dict, Tuple, TypeVar +from typing import Any, Callable, Tuple, TypeVar def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... def runctx( - statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: str | None = ..., sort: str | int = ... + statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = ..., sort: str | int = ... ) -> None: ... _SelfT = TypeVar("_SelfT", bound=Profile) @@ -22,6 +22,6 @@ class Profile: def create_stats(self) -> None: ... def snapshot_stats(self) -> None: ... def run(self: _SelfT, cmd: str) -> _SelfT: ... - def runctx(self: _SelfT, cmd: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> _SelfT: ... + def runctx(self: _SelfT, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> _SelfT: ... def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... def calibrate(self, m: int, verbose: int = ...) -> float: ... diff --git a/stdlib/pstats.pyi b/stdlib/pstats.pyi index 686c4ef2f958..6811ec94b349 100644 --- a/stdlib/pstats.pyi +++ b/stdlib/pstats.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import StrOrBytesPath from cProfile import Profile as _cProfile from profile import Profile -from typing import IO, Any, Dict, Iterable, List, Tuple, TypeVar, Union, overload +from typing import IO, Any, Iterable, Tuple, TypeVar, Union, overload _Selector = Union[str, float, int] _T = TypeVar("_T", bound=Stats) @@ -21,7 +21,7 @@ if sys.version_info >= (3, 7): TIME: str class Stats: - sort_arg_dict_default: Dict[str, Tuple[Any, str]] + sort_arg_dict_default: dict[str, Tuple[Any, str]] def __init__( self: _T, __arg: None | str | Profile | _cProfile = ..., @@ -33,7 +33,7 @@ class Stats: def get_top_level_stats(self) -> None: ... def add(self: _T, *arg_list: None | str | Profile | _cProfile | _T) -> _T: ... def dump_stats(self, filename: StrOrBytesPath) -> None: ... - def get_sort_arg_defs(self) -> Dict[str, Tuple[Tuple[Tuple[int, int], ...], str]]: ... + def get_sort_arg_defs(self) -> dict[str, Tuple[Tuple[Tuple[int, int], ...], str]]: ... @overload def sort_stats(self: _T, field: int) -> _T: ... @overload @@ -41,12 +41,12 @@ class Stats: def reverse_order(self: _T) -> _T: ... def strip_dirs(self: _T) -> _T: ... def calc_callees(self) -> None: ... - def eval_print_amount(self, sel: _Selector, list: List[str], msg: str) -> Tuple[List[str], str]: ... - def get_print_list(self, sel_list: Iterable[_Selector]) -> Tuple[int, List[str]]: ... + def eval_print_amount(self, sel: _Selector, list: list[str], msg: str) -> Tuple[list[str], str]: ... + def get_print_list(self, sel_list: Iterable[_Selector]) -> Tuple[int, list[str]]: ... def print_stats(self: _T, *amount: _Selector) -> _T: ... def print_callees(self: _T, *amount: _Selector) -> _T: ... def print_callers(self: _T, *amount: _Selector) -> _T: ... def print_call_heading(self, name_size: int, column_title: str) -> None: ... - def print_call_line(self, name_size: int, source: str, call_dict: Dict[str, Any], arrow: str = ...) -> None: ... + def print_call_line(self, name_size: int, source: str, call_dict: dict[str, Any], arrow: str = ...) -> None: ... def print_title(self) -> None: ... def print_line(self, func: str) -> None: ... diff --git a/stdlib/pwd.pyi b/stdlib/pwd.pyi index 3585cc235a58..2b931248edda 100644 --- a/stdlib/pwd.pyi +++ b/stdlib/pwd.pyi @@ -1,4 +1,4 @@ -from typing import ClassVar, List, Tuple +from typing import ClassVar, Tuple class struct_passwd(Tuple[str, str, int, int, str, str, str]): pw_name: str @@ -13,6 +13,6 @@ class struct_passwd(Tuple[str, str, int, int, str, str, str]): n_sequence_fields: ClassVar[int] n_unnamed_fields: ClassVar[int] -def getpwall() -> List[struct_passwd]: ... +def getpwall() -> list[struct_passwd]: ... def getpwuid(__uid: int) -> struct_passwd: ... def getpwnam(__name: str) -> struct_passwd: ... diff --git a/stdlib/py_compile.pyi b/stdlib/py_compile.pyi index e1c0b91f5a9f..d9c56f5c1fed 100644 --- a/stdlib/py_compile.pyi +++ b/stdlib/py_compile.pyi @@ -1,5 +1,5 @@ import sys -from typing import AnyStr, List, Type +from typing import AnyStr, Type class PyCompileError(Exception): exc_type_name: str @@ -42,4 +42,4 @@ else: file: AnyStr, cfile: AnyStr | None = ..., dfile: AnyStr | None = ..., doraise: bool = ..., optimize: int = ... ) -> AnyStr | None: ... -def main(args: List[str] | None = ...) -> int: ... +def main(args: list[str] | None = ...) -> int: ... diff --git a/stdlib/pyclbr.pyi b/stdlib/pyclbr.pyi index 64adc2800d91..10d106b4f511 100644 --- a/stdlib/pyclbr.pyi +++ b/stdlib/pyclbr.pyi @@ -1,20 +1,20 @@ import sys -from typing import Dict, List, Sequence +from typing import Sequence class Class: module: str name: str - super: List[Class | str] | None - methods: Dict[str, int] + super: list[Class | str] | None + methods: dict[str, int] file: int lineno: int if sys.version_info >= (3, 7): def __init__( - self, module: str, name: str, super: List[Class | str] | None, file: str, lineno: int, parent: Class | None = ... + self, module: str, name: str, super: list[Class | str] | None, file: str, lineno: int, parent: Class | None = ... ) -> None: ... else: - def __init__(self, module: str, name: str, super: List[Class | str] | None, file: str, lineno: int) -> None: ... + def __init__(self, module: str, name: str, super: list[Class | str] | None, file: str, lineno: int) -> None: ... class Function: module: str @@ -27,5 +27,5 @@ class Function: else: def __init__(self, module: str, name: str, file: str, lineno: int) -> None: ... -def readmodule(module: str, path: Sequence[str] | None = ...) -> Dict[str, Class]: ... -def readmodule_ex(module: str, path: Sequence[str] | None = ...) -> Dict[str, Class | Function | List[str]]: ... +def readmodule(module: str, path: Sequence[str] | None = ...) -> dict[str, Class]: ... +def readmodule_ex(module: str, path: Sequence[str] | None = ...) -> dict[str, Class | Function | list[str]]: ... diff --git a/stdlib/pydoc_data/topics.pyi b/stdlib/pydoc_data/topics.pyi index 1c48f4022fd6..091d34300106 100644 --- a/stdlib/pydoc_data/topics.pyi +++ b/stdlib/pydoc_data/topics.pyi @@ -1,3 +1 @@ -from typing import Dict - -topics: Dict[str, str] +topics: dict[str, str] diff --git a/stdlib/pyexpat/__init__.pyi b/stdlib/pyexpat/__init__.pyi index cc9bbe13a7c0..95c1f98d5652 100644 --- a/stdlib/pyexpat/__init__.pyi +++ b/stdlib/pyexpat/__init__.pyi @@ -1,12 +1,12 @@ import pyexpat.errors as errors import pyexpat.model as model from _typeshed import SupportsRead -from typing import Any, Callable, Dict, List, Optional, Tuple +from typing import Any, Callable, Optional, Tuple EXPAT_VERSION: str # undocumented version_info: Tuple[int, int, int] # undocumented native_encoding: str # undocumented -features: List[Tuple[str, int]] # undocumented +features: list[Tuple[str, int]] # undocumented class ExpatError(Exception): code: int @@ -48,8 +48,8 @@ class XMLParserType(object): EndDoctypeDeclHandler: Callable[[], Any] | None ElementDeclHandler: Callable[[str, _Model], Any] | None AttlistDeclHandler: Callable[[str, str, str, str | None, bool], Any] | None - StartElementHandler: Callable[[str, Dict[str, str]], Any] | Callable[[str, List[str]], Any] | Callable[ - [str, Dict[str, str], List[str]], Any + StartElementHandler: Callable[[str, dict[str, str]], Any] | Callable[[str, list[str]], Any] | Callable[ + [str, dict[str, str], list[str]], Any ] | None EndElementHandler: Callable[[str], Any] | None ProcessingInstructionHandler: Callable[[str, str], Any] | None @@ -71,5 +71,5 @@ def ErrorString(__code: int) -> str: ... # intern is undocumented def ParserCreate( - encoding: str | None = ..., namespace_separator: str | None = ..., intern: Dict[str, Any] | None = ... + encoding: str | None = ..., namespace_separator: str | None = ..., intern: dict[str, Any] | None = ... ) -> XMLParserType: ... diff --git a/stdlib/pyexpat/errors.pyi b/stdlib/pyexpat/errors.pyi index 7c443917cdd0..61826e12da00 100644 --- a/stdlib/pyexpat/errors.pyi +++ b/stdlib/pyexpat/errors.pyi @@ -1,7 +1,5 @@ -from typing import Dict - -codes: Dict[str, int] -messages: Dict[int, str] +codes: dict[str, int] +messages: dict[int, str] XML_ERROR_ABORTED: str XML_ERROR_ASYNC_ENTITY: str diff --git a/stdlib/re.pyi b/stdlib/re.pyi index df6bba234764..f2869470dfcf 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -1,7 +1,7 @@ import enum import sys from sre_constants import error as error -from typing import Any, AnyStr, Callable, Iterator, List, Tuple, Union, overload +from typing import Any, AnyStr, Callable, Iterator, Tuple, Union, overload # ----- re variables and constants ----- if sys.version_info >= (3, 7): @@ -70,13 +70,13 @@ def fullmatch(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Match @overload def fullmatch(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Match[AnyStr] | None: ... @overload -def split(pattern: AnyStr, string: AnyStr, maxsplit: int = ..., flags: _FlagsType = ...) -> List[AnyStr | Any]: ... +def split(pattern: AnyStr, string: AnyStr, maxsplit: int = ..., flags: _FlagsType = ...) -> list[AnyStr | Any]: ... @overload -def split(pattern: Pattern[AnyStr], string: AnyStr, maxsplit: int = ..., flags: _FlagsType = ...) -> List[AnyStr | Any]: ... +def split(pattern: Pattern[AnyStr], string: AnyStr, maxsplit: int = ..., flags: _FlagsType = ...) -> list[AnyStr | Any]: ... @overload -def findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> List[Any]: ... +def findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> list[Any]: ... @overload -def findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> List[Any]: ... +def findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> list[Any]: ... # Return an iterator yielding match objects over all non-overlapping matches # for the RE pattern in string. The string is scanned left-to-right, and diff --git a/stdlib/reprlib.pyi b/stdlib/reprlib.pyi index 39828ffc9f29..1529220c9bfc 100644 --- a/stdlib/reprlib.pyi +++ b/stdlib/reprlib.pyi @@ -1,5 +1,5 @@ from array import array -from typing import Any, Callable, Deque, Dict, FrozenSet, List, Set, Tuple +from typing import Any, Callable, Deque, FrozenSet, Set, Tuple _ReprFunc = Callable[[Any], str] @@ -21,12 +21,12 @@ class Repr: def repr(self, x: Any) -> str: ... def repr1(self, x: Any, level: int) -> str: ... def repr_tuple(self, x: Tuple[Any, ...], level: int) -> str: ... - def repr_list(self, x: List[Any], level: int) -> str: ... + def repr_list(self, x: list[Any], level: int) -> str: ... def repr_array(self, x: array[Any], level: int) -> str: ... def repr_set(self, x: Set[Any], level: int) -> str: ... def repr_frozenset(self, x: FrozenSet[Any], level: int) -> str: ... def repr_deque(self, x: Deque[Any], level: int) -> str: ... - def repr_dict(self, x: Dict[Any, Any], level: int) -> str: ... + def repr_dict(self, x: dict[Any, Any], level: int) -> str: ... def repr_str(self, x: str, level: int) -> str: ... def repr_int(self, x: int, level: int) -> str: ... def repr_instance(self, x: Any, level: int) -> str: ... diff --git a/stdlib/resource.pyi b/stdlib/resource.pyi index ff17bc1a0e44..742e43814bcc 100644 --- a/stdlib/resource.pyi +++ b/stdlib/resource.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Dict, Tuple, overload +from typing import Any, Tuple, overload RLIMIT_AS: int RLIMIT_CORE: int @@ -26,7 +26,7 @@ if sys.platform == "linux": _Tuple16 = Tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int] class struct_rusage(_Tuple16): - def __new__(cls, sequence: _Tuple16, dict: Dict[str, Any] = ...) -> struct_rusage: ... + def __new__(cls, sequence: _Tuple16, dict: dict[str, Any] = ...) -> struct_rusage: ... ru_utime: float ru_stime: float ru_maxrss: int diff --git a/stdlib/rlcompleter.pyi b/stdlib/rlcompleter.pyi index c217111471a6..f971c424213d 100644 --- a/stdlib/rlcompleter.pyi +++ b/stdlib/rlcompleter.pyi @@ -1,5 +1,5 @@ -from typing import Any, Dict +from typing import Any class Completer: - def __init__(self, namespace: Dict[str, Any] | None = ...) -> None: ... + def __init__(self, namespace: dict[str, Any] | None = ...) -> None: ... def complete(self, text: str, state: int) -> str | None: ... diff --git a/stdlib/runpy.pyi b/stdlib/runpy.pyi index 25e30f9fd487..8f05c622f4d2 100644 --- a/stdlib/runpy.pyi +++ b/stdlib/runpy.pyi @@ -1,6 +1,6 @@ from _typeshed import Self from types import ModuleType -from typing import Any, Dict +from typing import Any class _TempModule: mod_name: str = ... @@ -16,6 +16,6 @@ class _ModifiedArgv0: def __exit__(self, *args: Any) -> None: ... def run_module( - mod_name: str, init_globals: Dict[str, Any] | None = ..., run_name: str | None = ..., alter_sys: bool = ... -) -> Dict[str, Any]: ... -def run_path(path_name: str, init_globals: Dict[str, Any] | None = ..., run_name: str | None = ...) -> Dict[str, Any]: ... + mod_name: str, init_globals: dict[str, Any] | None = ..., run_name: str | None = ..., alter_sys: bool = ... +) -> dict[str, Any]: ... +def run_path(path_name: str, init_globals: dict[str, Any] | None = ..., run_name: str | None = ...) -> dict[str, Any]: ... diff --git a/stdlib/sched.pyi b/stdlib/sched.pyi index 937b68913879..cb96dc2bbf4a 100644 --- a/stdlib/sched.pyi +++ b/stdlib/sched.pyi @@ -1,11 +1,11 @@ -from typing import Any, Callable, Dict, List, NamedTuple, Tuple +from typing import Any, Callable, NamedTuple, Tuple class Event(NamedTuple): time: float priority: Any action: Callable[..., Any] argument: Tuple[Any, ...] - kwargs: Dict[str, Any] + kwargs: dict[str, Any] class scheduler: def __init__(self, timefunc: Callable[[], float] = ..., delayfunc: Callable[[float], None] = ...) -> None: ... @@ -15,7 +15,7 @@ class scheduler: priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...] = ..., - kwargs: Dict[str, Any] = ..., + kwargs: dict[str, Any] = ..., ) -> Event: ... def enter( self, @@ -23,10 +23,10 @@ class scheduler: priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...] = ..., - kwargs: Dict[str, Any] = ..., + kwargs: dict[str, Any] = ..., ) -> Event: ... def run(self, blocking: bool = ...) -> float | None: ... def cancel(self, event: Event) -> None: ... def empty(self) -> bool: ... @property - def queue(self) -> List[Event]: ... + def queue(self) -> list[Event]: ... diff --git a/stdlib/select.pyi b/stdlib/select.pyi index 7fa89c78d55d..fd503dc0033a 100644 --- a/stdlib/select.pyi +++ b/stdlib/select.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import FileDescriptorLike, Self from types import TracebackType -from typing import Any, Iterable, List, Tuple, Type +from typing import Any, Iterable, Tuple, Type if sys.platform != "win32": PIPE_BUF: int @@ -22,11 +22,11 @@ class poll: def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ... def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ...) -> List[Tuple[int, int]]: ... + def poll(self, timeout: float | None = ...) -> list[Tuple[int, int]]: ... def select( __rlist: Iterable[Any], __wlist: Iterable[Any], __xlist: Iterable[Any], __timeout: float | None = ... -) -> Tuple[List[Any], List[Any], List[Any]]: ... +) -> Tuple[list[Any], list[Any], list[Any]]: ... error = OSError @@ -55,7 +55,7 @@ if sys.platform != "linux" and sys.platform != "win32": def close(self) -> None: ... def control( self, __changelist: Iterable[kevent] | None, __maxevents: int, __timeout: float | None = ... - ) -> List[kevent]: ... + ) -> list[kevent]: ... def fileno(self) -> int: ... @classmethod def fromfd(cls, __fd: FileDescriptorLike) -> kqueue: ... @@ -114,7 +114,7 @@ if sys.platform == "linux": def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ... def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ..., maxevents: int = ...) -> List[Tuple[int, int]]: ... + def poll(self, timeout: float | None = ..., maxevents: int = ...) -> list[Tuple[int, int]]: ... @classmethod def fromfd(cls, __fd: FileDescriptorLike) -> epoll: ... EPOLLERR: int @@ -140,4 +140,4 @@ if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... def modify(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ...) -> List[Tuple[int, int]]: ... + def poll(self, timeout: float | None = ...) -> list[Tuple[int, int]]: ... diff --git a/stdlib/selectors.pyi b/stdlib/selectors.pyi index 99c961dc59f0..a28dc1d53899 100644 --- a/stdlib/selectors.pyi +++ b/stdlib/selectors.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import FileDescriptor, FileDescriptorLike, Self from abc import ABCMeta, abstractmethod -from typing import Any, List, Mapping, NamedTuple, Tuple +from typing import Any, Mapping, NamedTuple, Tuple _EventMask = int @@ -21,7 +21,7 @@ class BaseSelector(metaclass=ABCMeta): def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... def modify(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... @abstractmethod - def select(self, timeout: float | None = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... def close(self) -> None: ... def get_key(self, fileobj: FileDescriptorLike) -> SelectorKey: ... @abstractmethod @@ -32,14 +32,14 @@ class BaseSelector(metaclass=ABCMeta): class SelectSelector(BaseSelector): def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... if sys.platform != "win32": class PollSelector(BaseSelector): def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... if sys.platform == "linux": @@ -47,25 +47,25 @@ if sys.platform == "linux": def fileno(self) -> int: ... def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... class DevpollSelector(BaseSelector): def fileno(self) -> int: ... def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... class KqueueSelector(BaseSelector): def fileno(self) -> int: ... def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... class DefaultSelector(BaseSelector): def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = ...) -> list[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... diff --git a/stdlib/shlex.pyi b/stdlib/shlex.pyi index ac04f9ae863f..b517d03daf93 100644 --- a/stdlib/shlex.pyi +++ b/stdlib/shlex.pyi @@ -1,7 +1,7 @@ import sys -from typing import Any, Iterable, List, TextIO, Tuple, TypeVar +from typing import Any, Iterable, TextIO, Tuple, TypeVar -def split(s: str, comments: bool = ..., posix: bool = ...) -> List[str]: ... +def split(s: str, comments: bool = ..., posix: bool = ...) -> list[str]: ... if sys.version_info >= (3, 8): def join(split_command: Iterable[str]) -> str: ... diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index cf5a2c323f8d..cd2f28c59825 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -1,7 +1,7 @@ import os import sys from _typeshed import StrPath, SupportsRead, SupportsWrite -from typing import Any, AnyStr, Callable, Iterable, List, NamedTuple, Sequence, Set, Tuple, TypeVar, Union, overload +from typing import Any, AnyStr, Callable, Iterable, NamedTuple, Sequence, Set, Tuple, TypeVar, Union, overload _PathT = TypeVar("_PathT", str, os.PathLike[str]) # Return value of some functions that may either return a path-like object that was passed in or @@ -21,14 +21,14 @@ def copymode(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None def copystat(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ... def copy(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ... def copy2(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ... -def ignore_patterns(*patterns: StrPath) -> Callable[[Any, List[str]], Set[str]]: ... +def ignore_patterns(*patterns: StrPath) -> Callable[[Any, list[str]], Set[str]]: ... if sys.version_info >= (3, 8): def copytree( src: StrPath, dst: StrPath, symlinks: bool = ..., - ignore: None | Callable[[str, List[str]], Iterable[str]] | Callable[[StrPath, List[str]], Iterable[str]] = ..., + ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = ..., copy_function: Callable[[str, str], None] = ..., ignore_dangling_symlinks: bool = ..., dirs_exist_ok: bool = ..., @@ -39,7 +39,7 @@ else: src: StrPath, dst: StrPath, symlinks: bool = ..., - ignore: None | Callable[[str, List[str]], Iterable[str]] | Callable[[StrPath, List[str]], Iterable[str]] = ..., + ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = ..., copy_function: Callable[[str, str], None] = ..., ignore_dangling_symlinks: bool = ..., ) -> _PathReturn: ... @@ -83,11 +83,11 @@ def make_archive( group: str | None = ..., logger: Any | None = ..., ) -> str: ... -def get_archive_formats() -> List[Tuple[str, str]]: ... +def get_archive_formats() -> list[Tuple[str, str]]: ... def register_archive_format( name: str, function: Callable[..., Any], - extra_args: Sequence[Tuple[str, Any] | List[Any]] | None = ..., + extra_args: Sequence[Tuple[str, Any] | list[Any]] | None = ..., description: str = ..., ) -> None: ... def unregister_archive_format(name: str) -> None: ... @@ -100,8 +100,8 @@ else: def unpack_archive(filename: str, extract_dir: StrPath | None = ..., format: str | None = ...) -> None: ... def register_unpack_format( - name: str, extensions: List[str], function: Any, extra_args: Sequence[Tuple[str, Any]] | None = ..., description: str = ... + name: str, extensions: list[str], function: Any, extra_args: Sequence[Tuple[str, Any]] | None = ..., description: str = ... ) -> None: ... def unregister_unpack_format(name: str) -> None: ... -def get_unpack_formats() -> List[Tuple[str, List[str], str]]: ... +def get_unpack_formats() -> list[Tuple[str, list[str], str]]: ... def get_terminal_size(fallback: Tuple[int, int] = ...) -> os.terminal_size: ... diff --git a/stdlib/site.pyi b/stdlib/site.pyi index c77c9397f612..fc331c113163 100644 --- a/stdlib/site.pyi +++ b/stdlib/site.pyi @@ -1,12 +1,12 @@ -from typing import Iterable, List +from typing import Iterable -PREFIXES: List[str] +PREFIXES: list[str] ENABLE_USER_SITE: bool | None USER_SITE: str | None USER_BASE: str | None def main() -> None: ... def addsitedir(sitedir: str, known_paths: Iterable[str] | None = ...) -> None: ... -def getsitepackages(prefixes: Iterable[str] | None = ...) -> List[str]: ... +def getsitepackages(prefixes: Iterable[str] | None = ...) -> list[str]: ... def getuserbase() -> str: ... def getusersitepackages() -> str: ... diff --git a/stdlib/smtpd.pyi b/stdlib/smtpd.pyi index d34ed7e539be..5d9307300c7e 100644 --- a/stdlib/smtpd.pyi +++ b/stdlib/smtpd.pyi @@ -1,7 +1,7 @@ import asynchat import asyncore import socket -from typing import Any, DefaultDict, List, Tuple, Type +from typing import Any, DefaultDict, Tuple, Type _Address = Tuple[str, int] # (host, port) @@ -13,11 +13,11 @@ class SMTPChannel(asynchat.async_chat): smtp_server: SMTPServer conn: socket.socket addr: Any - received_lines: List[str] + received_lines: list[str] smtp_state: int seen_greeting: str mailfrom: str - rcpttos: List[str] + rcpttos: list[str] received_data: str fqdn: str peer: str @@ -70,17 +70,17 @@ class SMTPServer(asyncore.dispatcher): ) -> None: ... def handle_accepted(self, conn: socket.socket, addr: Any) -> None: ... def process_message( - self, peer: _Address, mailfrom: str, rcpttos: List[str], data: bytes | str, **kwargs: Any + self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str, **kwargs: Any ) -> str | None: ... class DebuggingServer(SMTPServer): ... class PureProxy(SMTPServer): def process_message( # type: ignore - self, peer: _Address, mailfrom: str, rcpttos: List[str], data: bytes | str + self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str ) -> str | None: ... class MailmanProxy(PureProxy): def process_message( # type: ignore - self, peer: _Address, mailfrom: str, rcpttos: List[str], data: bytes | str + self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str ) -> str | None: ... diff --git a/stdlib/smtplib.pyi b/stdlib/smtplib.pyi index c0fdafbcb684..5463559c366f 100644 --- a/stdlib/smtplib.pyi +++ b/stdlib/smtplib.pyi @@ -64,7 +64,7 @@ class SMTP: does_esmtp: bool = ... default_port: int = ... timeout: float - esmtp_features: Dict[str, str] + esmtp_features: dict[str, str] command_encoding: str source_address: _SourceAddress | None local_hostname: str diff --git a/stdlib/spwd.pyi b/stdlib/spwd.pyi index 8a6656194614..0f8d36fee945 100644 --- a/stdlib/spwd.pyi +++ b/stdlib/spwd.pyi @@ -1,4 +1,4 @@ -from typing import List, NamedTuple +from typing import NamedTuple class struct_spwd(NamedTuple): sp_namp: str @@ -11,5 +11,5 @@ class struct_spwd(NamedTuple): sp_expire: int sp_flag: int -def getspall() -> List[struct_spwd]: ... +def getspall() -> list[struct_spwd]: ... def getspnam(__arg: str) -> struct_spwd: ... diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index d6931751801b..abce96305c7b 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -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, List, Protocol, Tuple, Type, TypeVar +from typing import Any, Callable, Generator, Iterable, Iterator, Protocol, Tuple, Type, TypeVar _T = TypeVar("_T") @@ -176,8 +176,8 @@ class Cursor(Iterator[Any]): def execute(self, __sql: str, __parameters: Iterable[Any] = ...) -> Cursor: ... def executemany(self, __sql: str, __seq_of_parameters: Iterable[Iterable[Any]]) -> Cursor: ... def executescript(self, __sql_script: bytes | str) -> Cursor: ... - def fetchall(self) -> List[Any]: ... - def fetchmany(self, size: int | None = ...) -> List[Any]: ... + def fetchall(self) -> list[Any]: ... + def fetchmany(self, size: int | None = ...) -> list[Any]: ... def fetchone(self) -> Any: ... def setinputsizes(self, *args: Any, **kwargs: Any) -> None: ... def setoutputsize(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/stdlib/sre_compile.pyi b/stdlib/sre_compile.pyi index 2a7a62234b8a..aac8c0242764 100644 --- a/stdlib/sre_compile.pyi +++ b/stdlib/sre_compile.pyi @@ -14,10 +14,10 @@ from sre_constants import ( _NamedIntConstant, ) from sre_parse import SubPattern -from typing import Any, List, Pattern +from typing import Any, Pattern MAXCODE: int -def dis(code: List[_NamedIntConstant]) -> None: ... +def dis(code: list[_NamedIntConstant]) -> None: ... def isstring(obj: Any) -> bool: ... def compile(p: str | bytes | SubPattern, flags: int = ...) -> Pattern[Any]: ... diff --git a/stdlib/sre_constants.pyi b/stdlib/sre_constants.pyi index 22e0a6942219..4658d0e4b175 100644 --- a/stdlib/sre_constants.pyi +++ b/stdlib/sre_constants.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Dict, List +from typing import Any MAGIC: int @@ -16,15 +16,15 @@ class _NamedIntConstant(int): def __new__(cls, value: int, name: str) -> _NamedIntConstant: ... MAXREPEAT: _NamedIntConstant -OPCODES: List[_NamedIntConstant] -ATCODES: List[_NamedIntConstant] -CHCODES: List[_NamedIntConstant] -OP_IGNORE: Dict[_NamedIntConstant, _NamedIntConstant] -AT_MULTILINE: Dict[_NamedIntConstant, _NamedIntConstant] -AT_LOCALE: Dict[_NamedIntConstant, _NamedIntConstant] -AT_UNICODE: Dict[_NamedIntConstant, _NamedIntConstant] -CH_LOCALE: Dict[_NamedIntConstant, _NamedIntConstant] -CH_UNICODE: Dict[_NamedIntConstant, _NamedIntConstant] +OPCODES: list[_NamedIntConstant] +ATCODES: list[_NamedIntConstant] +CHCODES: list[_NamedIntConstant] +OP_IGNORE: dict[_NamedIntConstant, _NamedIntConstant] +AT_MULTILINE: dict[_NamedIntConstant, _NamedIntConstant] +AT_LOCALE: dict[_NamedIntConstant, _NamedIntConstant] +AT_UNICODE: dict[_NamedIntConstant, _NamedIntConstant] +CH_LOCALE: dict[_NamedIntConstant, _NamedIntConstant] +CH_UNICODE: dict[_NamedIntConstant, _NamedIntConstant] SRE_FLAG_TEMPLATE: int SRE_FLAG_IGNORECASE: int SRE_FLAG_LOCALE: int diff --git a/stdlib/sre_parse.pyi b/stdlib/sre_parse.pyi index afc3745f06b8..a242ca34afd2 100644 --- a/stdlib/sre_parse.pyi +++ b/stdlib/sre_parse.pyi @@ -1,6 +1,6 @@ import sys from sre_constants import _NamedIntConstant as _NIC, error as _Error -from typing import Any, Dict, FrozenSet, Iterable, List, Match, Optional, Pattern as _Pattern, Tuple, Union, overload +from typing import Any, FrozenSet, Iterable, List, Match, Optional, Pattern as _Pattern, Tuple, Union, overload SPECIAL_CHARS: str REPEAT_CHARS: str @@ -9,17 +9,17 @@ OCTDIGITS: FrozenSet[str] HEXDIGITS: FrozenSet[str] ASCIILETTERS: FrozenSet[str] WHITESPACE: FrozenSet[str] -ESCAPES: Dict[str, Tuple[_NIC, int]] -CATEGORIES: Dict[str, Tuple[_NIC, _NIC] | Tuple[_NIC, List[Tuple[_NIC, _NIC]]]] -FLAGS: Dict[str, int] +ESCAPES: dict[str, Tuple[_NIC, int]] +CATEGORIES: dict[str, Tuple[_NIC, _NIC] | Tuple[_NIC, list[Tuple[_NIC, _NIC]]]] +FLAGS: dict[str, int] GLOBAL_FLAGS: int class Verbose(Exception): ... class _State: flags: int - groupdict: Dict[str, int] - groupwidths: List[int | None] + groupdict: dict[str, int] + groupwidths: list[int | None] lookbehindgroups: int | None def __init__(self) -> None: ... @property @@ -42,15 +42,15 @@ _AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExist _CodeType = Tuple[_NIC, _AvType] class SubPattern: - data: List[_CodeType] + data: list[_CodeType] width: int | None if sys.version_info >= (3, 8): state: State - def __init__(self, state: State, data: List[_CodeType] | None = ...) -> None: ... + def __init__(self, state: State, data: list[_CodeType] | None = ...) -> None: ... else: pattern: Pattern - def __init__(self, pattern: Pattern, data: List[_CodeType] | None = ...) -> None: ... + def __init__(self, pattern: Pattern, data: list[_CodeType] | None = ...) -> None: ... def dump(self, level: int = ...) -> None: ... def __len__(self) -> int: ... def __delitem__(self, index: int | slice) -> None: ... diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index 6bbfd69b89f8..91c0a9c9a2d1 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -206,7 +206,7 @@ HAS_ALPN: bool HAS_ECDH: bool HAS_SNI: bool HAS_NPN: bool -CHANNEL_BINDING_TYPES: List[str] +CHANNEL_BINDING_TYPES: list[str] OPENSSL_VERSION: str OPENSSL_VERSION_INFO: Tuple[int, int, int, int, int] @@ -338,7 +338,7 @@ class SSLSocket(socket.socket): @overload def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ... def cipher(self) -> Tuple[str, str, int] | None: ... - def shared_ciphers(self) -> List[Tuple[str, str, int]] | None: ... + def shared_ciphers(self) -> list[Tuple[str, str, int]] | None: ... def compression(self) -> str | None: ... def get_channel_binding(self, cb_type: str = ...) -> bytes | None: ... def selected_alpn_protocol(self) -> str | None: ... @@ -379,13 +379,13 @@ class SSLContext: post_handshake_auth: bool def __new__(cls, protocol: int = ..., *args: Any, **kwargs: Any) -> SSLContext: ... def __init__(self, protocol: int = ...) -> None: ... - def cert_store_stats(self) -> Dict[str, int]: ... + def cert_store_stats(self) -> dict[str, int]: ... def load_cert_chain(self, certfile: StrPath, keyfile: StrPath | None = ..., password: _PasswordType | None = ...) -> None: ... def load_default_certs(self, purpose: Purpose = ...) -> None: ... def load_verify_locations( self, cafile: StrPath | None = ..., capath: StrPath | None = ..., cadata: str | bytes | None = ... ) -> None: ... - def get_ca_certs(self, binary_form: bool = ...) -> List[_PeerCertRetDictType] | List[bytes]: ... + def get_ca_certs(self, binary_form: bool = ...) -> list[_PeerCertRetDictType] | list[bytes]: ... def get_ciphers(self) -> list[_Cipher]: ... def set_default_verify_paths(self) -> None: ... def set_ciphers(self, __cipherlist: str) -> None: ... @@ -414,7 +414,7 @@ class SSLContext: server_hostname: str | None = ..., session: SSLSession | None = ..., ) -> SSLObject: ... - def session_stats(self) -> Dict[str, int]: ... + def session_stats(self) -> dict[str, int]: ... class SSLObject: context: SSLContext @@ -437,7 +437,7 @@ class SSLObject: def selected_alpn_protocol(self) -> str | None: ... def selected_npn_protocol(self) -> str | None: ... def cipher(self) -> Tuple[str, str, int] | None: ... - def shared_ciphers(self) -> List[Tuple[str, str, int]] | None: ... + def shared_ciphers(self) -> list[Tuple[str, str, int]] | None: ... def compression(self) -> str | None: ... def pending(self) -> int: ... def do_handshake(self) -> None: ... diff --git a/stdlib/statistics.pyi b/stdlib/statistics.pyi index 7c0dd02ab61e..ec3574ab12b1 100644 --- a/stdlib/statistics.pyi +++ b/stdlib/statistics.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import SupportsLessThanT from decimal import Decimal from fractions import Fraction -from typing import Any, Hashable, Iterable, List, NamedTuple, Sequence, SupportsFloat, Type, TypeVar, Union +from typing import Any, Hashable, Iterable, NamedTuple, Sequence, SupportsFloat, Type, TypeVar, Union _T = TypeVar("_T") # Most functions in this module accept homogeneous collections of one of these types @@ -33,13 +33,13 @@ def median_grouped(data: Iterable[_NumberT], interval: _NumberT = ...) -> _Numbe def mode(data: Iterable[_HashableT]) -> _HashableT: ... if sys.version_info >= (3, 8): - def multimode(data: Iterable[_HashableT]) -> List[_HashableT]: ... + def multimode(data: Iterable[_HashableT]) -> list[_HashableT]: ... def pstdev(data: Iterable[_NumberT], mu: _NumberT | None = ...) -> _NumberT: ... def pvariance(data: Iterable[_NumberT], mu: _NumberT | None = ...) -> _NumberT: ... if sys.version_info >= (3, 8): - def quantiles(data: Iterable[_NumberT], *, n: int = ..., method: str = ...) -> List[_NumberT]: ... + def quantiles(data: Iterable[_NumberT], *, n: int = ..., method: str = ...) -> list[_NumberT]: ... def stdev(data: Iterable[_NumberT], xbar: _NumberT | None = ...) -> _NumberT: ... def variance(data: Iterable[_NumberT], xbar: _NumberT | None = ...) -> _NumberT: ... @@ -59,12 +59,12 @@ if sys.version_info >= (3, 8): def variance(self) -> float: ... @classmethod def from_samples(cls: Type[_T], data: Iterable[SupportsFloat]) -> _T: ... - def samples(self, n: int, *, seed: Any | None = ...) -> List[float]: ... + def samples(self, n: int, *, seed: Any | None = ...) -> list[float]: ... def pdf(self, x: float) -> float: ... def cdf(self, x: float) -> float: ... def inv_cdf(self, p: float) -> float: ... def overlap(self, other: NormalDist) -> float: ... - def quantiles(self, n: int = ...) -> List[float]: ... + def quantiles(self, n: int = ...) -> list[float]: ... if sys.version_info >= (3, 9): def zscore(self, x: float) -> float: ... def __add__(self, x2: float | NormalDist) -> NormalDist: ... diff --git a/stdlib/symbol.pyi b/stdlib/symbol.pyi index 6fbe306fabe9..2d3bd83087c7 100644 --- a/stdlib/symbol.pyi +++ b/stdlib/symbol.pyi @@ -1,5 +1,3 @@ -from typing import Dict - single_input: int file_input: int eval_input: int @@ -87,4 +85,4 @@ encoding_decl: int yield_expr: int yield_arg: int -sym_name: Dict[int, str] +sym_name: dict[int, str] diff --git a/stdlib/symtable.pyi b/stdlib/symtable.pyi index 79753ed6acbc..c8d051a647c1 100644 --- a/stdlib/symtable.pyi +++ b/stdlib/symtable.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, List, Sequence, Tuple +from typing import Any, Sequence, Tuple def symtable(code: str, filename: str, compile_type: str) -> SymbolTable: ... @@ -15,8 +15,8 @@ class SymbolTable(object): def has_exec(self) -> bool: ... def get_identifiers(self) -> Sequence[str]: ... def lookup(self, name: str) -> Symbol: ... - def get_symbols(self) -> List[Symbol]: ... - def get_children(self) -> List[SymbolTable]: ... + def get_symbols(self) -> list[Symbol]: ... + def get_children(self) -> list[SymbolTable]: ... class Function(SymbolTable): def get_parameters(self) -> Tuple[str, ...]: ... diff --git a/stdlib/sys.pyi b/stdlib/sys.pyi index 3078b5a000d3..372a3364ca69 100644 --- a/stdlib/sys.pyi +++ b/stdlib/sys.pyi @@ -8,9 +8,7 @@ from typing import ( Any, AsyncGenerator, Callable, - Dict, FrozenSet, - List, NoReturn, Optional, Protocol, @@ -39,7 +37,7 @@ class _MetaPathFinder(Protocol): # ----- sys variables ----- if sys.platform != "win32": abiflags: str -argv: List[str] +argv: list[str] base_exec_prefix: str base_prefix: str byteorder: Literal["little", "big"] @@ -59,13 +57,13 @@ last_value: BaseException | None last_traceback: TracebackType | None maxsize: int maxunicode: int -meta_path: List[_MetaPathFinder] -modules: Dict[str, ModuleType] +meta_path: list[_MetaPathFinder] +modules: dict[str, ModuleType] if sys.version_info >= (3, 10): - orig_argv: List[str] -path: List[str] -path_hooks: List[Any] # TODO precise type; function, path to finder -path_importer_cache: Dict[str, PathEntryFinder | None] + orig_argv: list[str] +path: list[str] +path_hooks: list[Any] # TODO precise type; function, path to finder +path_importer_cache: dict[str, PathEntryFinder | None] platform: str if sys.version_info >= (3, 9): platlibdir: str @@ -90,7 +88,7 @@ warnoptions: Any # lineno) if sys.platform == "win32": winver: str -_xoptions: Dict[Any, Any] +_xoptions: dict[Any, Any] flags: _flags @@ -161,7 +159,7 @@ version_info: _version_info def call_tracing(__func: Callable[..., _T], __args: Any) -> _T: ... def _clear_type_cache() -> None: ... -def _current_frames() -> Dict[int, FrameType]: ... +def _current_frames() -> dict[int, FrameType]: ... def _getframe(__depth: int = ...) -> FrameType: ... def _debugmallocstats() -> None: ... def __displayhook__(value: object) -> None: ... diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index 2bef9e467bc9..ff828d519912 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -1,17 +1,17 @@ -from typing import IO, Any, Dict, List, Tuple, overload +from typing import IO, Any, Tuple, overload def get_config_var(name: str) -> str | None: ... @overload -def get_config_vars() -> Dict[str, Any]: ... +def get_config_vars() -> dict[str, Any]: ... @overload -def get_config_vars(arg: str, *args: str) -> List[Any]: ... +def get_config_vars(arg: str, *args: str) -> list[Any]: ... def get_scheme_names() -> Tuple[str, ...]: ... def get_path_names() -> Tuple[str, ...]: ... -def get_path(name: str, scheme: str = ..., vars: Dict[str, Any] | None = ..., expand: bool = ...) -> str: ... -def get_paths(scheme: str = ..., vars: Dict[str, Any] | None = ..., expand: bool = ...) -> Dict[str, str]: ... +def get_path(name: str, scheme: str = ..., vars: dict[str, Any] | None = ..., expand: bool = ...) -> str: ... +def get_paths(scheme: str = ..., vars: dict[str, Any] | None = ..., expand: bool = ...) -> dict[str, str]: ... def get_python_version() -> str: ... def get_platform() -> str: ... def is_python_build(check_home: bool = ...) -> bool: ... -def parse_config_h(fp: IO[Any], vars: Dict[str, Any] | None = ...) -> Dict[str, Any]: ... +def parse_config_h(fp: IO[Any], vars: dict[str, Any] | None = ...) -> dict[str, Any]: ... def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... diff --git a/stdlib/tempfile.pyi b/stdlib/tempfile.pyi index 8f4b1495ea07..270f506ed594 100644 --- a/stdlib/tempfile.pyi +++ b/stdlib/tempfile.pyi @@ -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, List, Tuple, Type, Union, overload +from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, Tuple, Type, Union, overload from typing_extensions import Literal if sys.version_info >= (3, 9): @@ -304,7 +304,7 @@ class SpooledTemporaryFile(IO[AnyStr]): def isatty(self) -> bool: ... def read(self, n: int = ...) -> AnyStr: ... def readline(self, limit: int = ...) -> AnyStr: ... - def readlines(self, hint: int = ...) -> List[AnyStr]: ... + def readlines(self, hint: int = ...) -> list[AnyStr]: ... def seek(self, offset: int, whence: int = ...) -> int: ... def tell(self) -> int: ... def truncate(self, size: int | None = ...) -> int: ... diff --git a/stdlib/termios.pyi b/stdlib/termios.pyi index 0c627f4b72bd..ed8522dccc51 100644 --- a/stdlib/termios.pyi +++ b/stdlib/termios.pyi @@ -236,7 +236,7 @@ VWERASE: int XCASE: int XTABS: int -def tcgetattr(__fd: FileDescriptorLike) -> List[Any]: ... +def tcgetattr(__fd: FileDescriptorLike) -> list[Any]: ... def tcsetattr(__fd: FileDescriptorLike, __when: int, __attributes: _Attr) -> None: ... def tcsendbreak(__fd: FileDescriptorLike, __duration: int) -> None: ... def tcdrain(__fd: FileDescriptorLike) -> None: ... diff --git a/stdlib/textwrap.pyi b/stdlib/textwrap.pyi index 1cd32c314c01..dda18abc943d 100644 --- a/stdlib/textwrap.pyi +++ b/stdlib/textwrap.pyi @@ -1,4 +1,4 @@ -from typing import Callable, Dict, List, Pattern +from typing import Callable, Pattern class TextWrapper: width: int = ... @@ -19,7 +19,7 @@ class TextWrapper: wordsep_re: Pattern[str] = ... wordsep_simple_re: Pattern[str] = ... whitespace_trans: str = ... - unicode_whitespace_trans: Dict[int, int] = ... + unicode_whitespace_trans: dict[int, int] = ... uspace: int = ... x: str = ... # leaked loop variable def __init__( @@ -40,12 +40,12 @@ class TextWrapper: ) -> None: ... # Private methods *are* part of the documented API for subclasses. def _munge_whitespace(self, text: str) -> str: ... - def _split(self, text: str) -> List[str]: ... - def _fix_sentence_endings(self, chunks: List[str]) -> None: ... - def _handle_long_word(self, reversed_chunks: List[str], cur_line: List[str], cur_len: int, width: int) -> None: ... - def _wrap_chunks(self, chunks: List[str]) -> List[str]: ... - def _split_chunks(self, text: str) -> List[str]: ... - def wrap(self, text: str) -> List[str]: ... + def _split(self, text: str) -> list[str]: ... + def _fix_sentence_endings(self, chunks: list[str]) -> None: ... + def _handle_long_word(self, reversed_chunks: list[str], cur_line: list[str], cur_len: int, width: int) -> None: ... + def _wrap_chunks(self, chunks: list[str]) -> list[str]: ... + def _split_chunks(self, text: str) -> list[str]: ... + def wrap(self, text: str) -> list[str]: ... def fill(self, text: str) -> str: ... def wrap( @@ -63,7 +63,7 @@ def wrap( drop_whitespace: bool = ..., max_lines: int = ..., placeholder: str = ..., -) -> List[str]: ... +) -> list[str]: ... def fill( text: str, width: int = ..., diff --git a/stdlib/this.pyi b/stdlib/this.pyi index 0687a6675cca..8de996b04aec 100644 --- a/stdlib/this.pyi +++ b/stdlib/this.pyi @@ -1,4 +1,2 @@ -from typing import Dict - s: str -d: Dict[str, str] +d: dict[str, str] diff --git a/stdlib/threading.pyi b/stdlib/threading.pyi index 00394d500209..64998d86bf9f 100644 --- a/stdlib/threading.pyi +++ b/stdlib/threading.pyi @@ -1,6 +1,6 @@ import sys from types import FrameType, TracebackType -from typing import Any, Callable, Iterable, List, Mapping, Optional, Type, TypeVar +from typing import Any, Callable, Iterable, Mapping, Optional, Type, TypeVar # TODO recursive type _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] @@ -8,13 +8,13 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] _PF = Callable[[FrameType, str, Any], None] _T = TypeVar("_T") -__all__: List[str] +__all__: list[str] def active_count() -> int: ... def current_thread() -> Thread: ... def currentThread() -> Thread: ... def get_ident() -> int: ... -def enumerate() -> List[Thread]: ... +def enumerate() -> list[Thread]: ... def main_thread() -> Thread: ... if sys.version_info >= (3, 8): diff --git a/stdlib/timeit.pyi b/stdlib/timeit.pyi index 9d36ce6cb696..2a8330d1cee1 100644 --- a/stdlib/timeit.pyi +++ b/stdlib/timeit.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Callable, Dict, List, Sequence, Tuple, Union +from typing import IO, Any, Callable, Sequence, Tuple, Union _Timer = Callable[[], float] _Stmt = Union[str, Callable[[], Any]] @@ -7,15 +7,15 @@ default_timer: _Timer class Timer: def __init__( - self, stmt: _Stmt = ..., setup: _Stmt = ..., timer: _Timer = ..., globals: Dict[str, Any] | None = ... + self, stmt: _Stmt = ..., setup: _Stmt = ..., timer: _Timer = ..., globals: dict[str, Any] | None = ... ) -> None: ... def print_exc(self, file: IO[str] | None = ...) -> None: ... def timeit(self, number: int = ...) -> float: ... - def repeat(self, repeat: int = ..., number: int = ...) -> List[float]: ... + def repeat(self, repeat: int = ..., number: int = ...) -> list[float]: ... def autorange(self, callback: Callable[[int, float], Any] | None = ...) -> Tuple[int, float]: ... def timeit( - stmt: _Stmt = ..., setup: _Stmt = ..., timer: _Timer = ..., number: int = ..., globals: Dict[str, Any] | None = ... + stmt: _Stmt = ..., setup: _Stmt = ..., timer: _Timer = ..., number: int = ..., globals: dict[str, Any] | None = ... ) -> float: ... def repeat( stmt: _Stmt = ..., @@ -23,8 +23,8 @@ def repeat( timer: _Timer = ..., repeat: int = ..., number: int = ..., - globals: Dict[str, Any] | None = ..., -) -> List[float]: ... + globals: dict[str, Any] | None = ..., +) -> list[float]: ... _timerFunc = Callable[[], float] diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 7d98f50e70a9..11433f1e8cce 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -5,22 +5,7 @@ from enum import Enum from tkinter.constants import * # comment this out to find undefined identifier names with flake8 from tkinter.font import _FontDescription from types import TracebackType -from typing import ( - Any, - Callable, - Dict, - Generic, - List, - Mapping, - Optional, - Protocol, - Sequence, - Tuple, - Type, - TypeVar, - Union, - overload, -) +from typing import Any, Callable, Generic, List, Mapping, Optional, Protocol, Sequence, Tuple, Type, TypeVar, Union, overload from typing_extensions import Literal, TypedDict # Using anything from tkinter.font in this file means that 'import tkinter' @@ -200,7 +185,7 @@ class Variable: def get(self) -> Any: ... def trace_add(self, mode: _TraceMode, callback: Callable[[str, str, str], Any]) -> str: ... def trace_remove(self, mode: _TraceMode, cbname: str) -> None: ... - def trace_info(self) -> List[Tuple[Tuple[_TraceMode, ...], str]]: ... + def trace_info(self) -> list[Tuple[Tuple[_TraceMode, ...], str]]: ... def trace_variable(self, mode, callback): ... # deprecated def trace_vdelete(self, mode, cbname): ... # deprecated def trace_vinfo(self): ... # deprecated @@ -240,7 +225,7 @@ def getboolean(s): ... class Misc: master: Misc | None tk: _tkinter.TkappType - children: Dict[str, Widget] + children: dict[str, Widget] def destroy(self) -> None: ... def deletecommand(self, name: str) -> None: ... def tk_strictMotif(self, boolean: Any | None = ...): ... @@ -296,7 +281,7 @@ class Misc: def winfo_atom(self, name: str, displayof: Literal[0] | Misc | None = ...): ... def winfo_atomname(self, id: int, displayof: Literal[0] | Misc | None = ...): ... def winfo_cells(self) -> int: ... - def winfo_children(self) -> List[Widget]: ... # Widget because it can't be Toplevel or Tk + def winfo_children(self) -> list[Widget]: ... # Widget because it can't be Toplevel or Tk def winfo_class(self) -> str: ... def winfo_colormapfull(self) -> bool: ... def winfo_containing(self, rootX: int, rootY: int, displayof: Literal[0] | Misc | None = ...) -> Misc | None: ... @@ -334,7 +319,7 @@ class Misc: def winfo_viewable(self) -> bool: ... def winfo_visual(self) -> str: ... def winfo_visualid(self) -> str: ... - def winfo_visualsavailable(self, includeids: int = ...) -> List[Tuple[str, int]]: ... + def winfo_visualsavailable(self, includeids: int = ...) -> list[Tuple[str, int]]: ... def winfo_vrootheight(self) -> int: ... def winfo_vrootwidth(self) -> int: ... def winfo_vrootx(self) -> int: ... @@ -382,7 +367,7 @@ class Misc: def register( self, func: Callable[..., Any], subst: Callable[..., Sequence[Any]] | None = ..., needcleanup: int = ... ) -> str: ... - def keys(self) -> List[str]: ... + def keys(self) -> list[str]: ... @overload def pack_propagate(self, flag: bool) -> bool | None: ... @overload @@ -411,9 +396,9 @@ class Misc: def grid_size(self) -> Tuple[int, int]: ... size = grid_size # Widget because Toplevel or Tk is never a slave - def pack_slaves(self) -> List[Widget]: ... - def grid_slaves(self, row: int | None = ..., column: int | None = ...) -> List[Widget]: ... - def place_slaves(self) -> List[Widget]: ... + def pack_slaves(self) -> list[Widget]: ... + def grid_slaves(self, row: int | None = ..., column: int | None = ...) -> list[Widget]: ... + def place_slaves(self) -> list[Widget]: ... slaves = pack_slaves def event_add(self, virtual: str, *sequences: str) -> None: ... def event_delete(self, virtual: str, *sequences: str) -> None: ... @@ -494,7 +479,7 @@ class Wm: def wm_client(self, name: str | None = ...) -> str: ... client = wm_client @overload - def wm_colormapwindows(self) -> List[Misc]: ... + def wm_colormapwindows(self) -> list[Misc]: ... @overload def wm_colormapwindows(self, __wlist: _TkinterSequence[Misc]) -> None: ... @overload @@ -604,7 +589,7 @@ class Tk(Misc, Wm): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -622,7 +607,7 @@ class Tk(Misc, Wm): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -841,7 +826,7 @@ class Toplevel(BaseWidget, Wm): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -870,7 +855,7 @@ class Toplevel(BaseWidget, Wm): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -888,7 +873,7 @@ class Toplevel(BaseWidget, Wm): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -897,7 +882,7 @@ class Button(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeforeground: _Color = ..., @@ -945,7 +930,7 @@ class Button(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeforeground: _Color = ..., @@ -983,7 +968,7 @@ class Button(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -994,7 +979,7 @@ class Canvas(Widget, XView, YView): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -1036,7 +1021,7 @@ class Canvas(Widget, XView, YView): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -1068,7 +1053,7 @@ class Canvas(Widget, XView, YView): xscrollincrement: _ScreenUnits = ..., yscrollcommand: _XYScrollCommand = ..., yscrollincrement: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -1485,7 +1470,7 @@ class Checkbutton(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeforeground: _Color = ..., @@ -1518,8 +1503,8 @@ class Checkbutton(Widget): # # I think Checkbutton shouldn't be generic, because then specifying # "any checkbutton regardless of what variable it uses" would be - # difficult, and we might run into issues just like how List[float] - # and List[int] are incompatible. Also, we would need a way to + # difficult, and we might run into issues just like how list[float] + # and list[int] are incompatible. Also, we would need a way to # specify "Checkbutton not associated with any variable", which is # done by setting variable to empty string (the default). offvalue: Any = ..., @@ -1544,7 +1529,7 @@ class Checkbutton(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeforeground: _Color = ..., @@ -1588,7 +1573,7 @@ class Checkbutton(Widget): variable: Variable | Literal[""] = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -1604,7 +1589,7 @@ class Entry(Widget, XView): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -1648,7 +1633,7 @@ class Entry(Widget, XView): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -1687,7 +1672,7 @@ class Entry(Widget, XView): vcmd: _EntryValidateCommand = ..., width: int = ..., xscrollcommand: _XYScrollCommand = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -1715,7 +1700,7 @@ class Frame(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -1741,7 +1726,7 @@ class Frame(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -1758,7 +1743,7 @@ class Frame(Widget): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -1767,7 +1752,7 @@ class Label(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeforeground: _Color = ..., @@ -1805,7 +1790,7 @@ class Label(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeforeground: _Color = ..., @@ -1838,7 +1823,7 @@ class Label(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -1847,7 +1832,7 @@ class Listbox(Widget, XView, YView): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activestyle: Literal["dotbox", "none", "underline"] = ..., background: _Color = ..., @@ -1897,7 +1882,7 @@ class Listbox(Widget, XView, YView): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activestyle: Literal["dotbox", "none", "underline"] = ..., background: _Color = ..., @@ -1928,7 +1913,7 @@ class Listbox(Widget, XView, YView): width: int = ..., xscrollcommand: _XYScrollCommand = ..., yscrollcommand: _XYScrollCommand = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -1962,7 +1947,7 @@ class Menu(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeborderwidth: _ScreenUnits = ..., @@ -1993,7 +1978,7 @@ class Menu(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeborderwidth: _ScreenUnits = ..., @@ -2016,7 +2001,7 @@ class Menu(Widget): tearoffcommand: Callable[[str, str], Any] | str = ..., title: str = ..., type: Literal["menubar", "tearoff", "normal"] = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -2026,7 +2011,7 @@ class Menu(Widget): def insert(self, index, itemType, cnf=..., **kw): ... # docstring says "Internal function." def add_cascade( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., activebackground: _Color = ..., @@ -2047,7 +2032,7 @@ class Menu(Widget): ) -> None: ... def add_checkbutton( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., activebackground: _Color = ..., @@ -2073,7 +2058,7 @@ class Menu(Widget): ) -> None: ... def add_command( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., activebackground: _Color = ..., @@ -2093,7 +2078,7 @@ class Menu(Widget): ) -> None: ... def add_radiobutton( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., activebackground: _Color = ..., @@ -2116,11 +2101,11 @@ class Menu(Widget): value: Any = ..., variable: Variable = ..., ) -> None: ... - def add_separator(self, cnf: Dict[str, Any] | None = ..., *, background: _Color = ...) -> None: ... + def add_separator(self, cnf: dict[str, Any] | None = ..., *, background: _Color = ...) -> None: ... def insert_cascade( self, index: _MenuIndex, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., activebackground: _Color = ..., @@ -2142,7 +2127,7 @@ class Menu(Widget): def insert_checkbutton( self, index: _MenuIndex, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., activebackground: _Color = ..., @@ -2169,7 +2154,7 @@ class Menu(Widget): def insert_command( self, index: _MenuIndex, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., activebackground: _Color = ..., @@ -2190,7 +2175,7 @@ class Menu(Widget): def insert_radiobutton( self, index: _MenuIndex, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, accelerator: str = ..., activebackground: _Color = ..., @@ -2213,7 +2198,7 @@ class Menu(Widget): value: Any = ..., variable: Variable = ..., ) -> None: ... - def insert_separator(self, index: _MenuIndex, cnf: Dict[str, Any] | None = ..., *, background: _Color = ...) -> None: ... + def insert_separator(self, index: _MenuIndex, cnf: dict[str, Any] | None = ..., *, background: _Color = ...) -> None: ... def delete(self, index1: _MenuIndex, index2: _MenuIndex | None = ...) -> None: ... def entrycget(self, index: _MenuIndex, option: str) -> Any: ... def entryconfigure( @@ -2232,7 +2217,7 @@ class Menubutton(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeforeground: _Color = ..., @@ -2273,7 +2258,7 @@ class Menubutton(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeforeground: _Color = ..., @@ -2309,7 +2294,7 @@ class Menubutton(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -2318,7 +2303,7 @@ class Message(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, anchor: _Anchor = ..., aspect: int = ..., @@ -2348,7 +2333,7 @@ class Message(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, anchor: _Anchor = ..., aspect: int = ..., @@ -2372,7 +2357,7 @@ class Message(Widget): text: float | str = ..., textvariable: Variable = ..., width: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -2381,7 +2366,7 @@ class Radiobutton(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeforeground: _Color = ..., @@ -2429,7 +2414,7 @@ class Radiobutton(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activeforeground: _Color = ..., @@ -2472,7 +2457,7 @@ class Radiobutton(Widget): variable: Variable | Literal[""] = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -2485,7 +2470,7 @@ class Scale(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., background: _Color = ..., @@ -2527,7 +2512,7 @@ class Scale(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., background: _Color = ..., @@ -2563,7 +2548,7 @@ class Scale(Widget): troughcolor: _Color = ..., variable: IntVar | DoubleVar = ..., width: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -2576,7 +2561,7 @@ class Scrollbar(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activerelief: _Relief = ..., @@ -2608,7 +2593,7 @@ class Scrollbar(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., activerelief: _Relief = ..., @@ -2631,7 +2616,7 @@ class Scrollbar(Widget): takefocus: _TakeFocusValue = ..., troughcolor: _Color = ..., width: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -2648,7 +2633,7 @@ class Text(Widget, XView, YView): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, autoseparators: bool = ..., background: _Color = ..., @@ -2704,7 +2689,7 @@ class Text(Widget, XView, YView): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, autoseparators: bool = ..., background: _Color = ..., @@ -2751,7 +2736,7 @@ class Text(Widget, XView, YView): wrap: Literal["none", "char", "word"] = ..., xscrollcommand: _XYScrollCommand = ..., yscrollcommand: _XYScrollCommand = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -2777,7 +2762,7 @@ class Text(Widget, XView, YView): tag: bool = ..., text: bool = ..., window: bool = ..., - ) -> List[Tuple[str, str, str]]: ... + ) -> list[Tuple[str, str, str]]: ... @overload def dump( self, @@ -2833,7 +2818,7 @@ class Text(Widget, XView, YView): def mark_next(self, index: _TextIndex) -> str | None: ... def mark_previous(self, index: _TextIndex) -> str | None: ... # **kw of peer_create is same as the kwargs of Text.__init__ - def peer_create(self, newPathName: str | Text, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def peer_create(self, newPathName: str | Text, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def peer_names(self) -> Tuple[_tkinter.Tcl_Obj, ...]: ... def replace(self, index1: _TextIndex, index2: _TextIndex, chars: str, *args: str | _TkinterSequence[str]) -> None: ... def scan_mark(self, x: int, y: int) -> None: ... @@ -2867,7 +2852,7 @@ class Text(Widget, XView, YView): def tag_configure( self, tagName: str, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bgstipple: _Bitmap = ..., @@ -2897,7 +2882,7 @@ class Text(Widget, XView, YView): underline: bool = ..., underlinefg: _Color = ..., wrap: Literal["none", "char", "word"] = ..., # be careful with "none" vs None - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def tag_configure(self, tagName: str, cnf: str) -> Tuple[str, str, str, Any, Any]: ... tag_config = tag_configure @@ -2961,7 +2946,7 @@ class PhotoImage(Image): def __init__( self, name: str | None = ..., - cnf: Dict[str, Any] = ..., + cnf: dict[str, Any] = ..., master: Misc | _tkinter.TkappType | None = ..., *, data: str | bytes = ..., # not same as data argument of put() @@ -3001,7 +2986,7 @@ class BitmapImage(Image): def __init__( self, name: Any | None = ..., - cnf: Dict[str, Any] = ..., + cnf: dict[str, Any] = ..., master: Misc | _tkinter.TkappType | None = ..., *, background: _Color = ..., @@ -3019,7 +3004,7 @@ class Spinbox(Widget, XView): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., background: _Color = ..., @@ -3077,7 +3062,7 @@ class Spinbox(Widget, XView): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, activebackground: _Color = ..., background: _Color = ..., @@ -3129,7 +3114,7 @@ class Spinbox(Widget, XView): width: int = ..., wrap: bool = ..., xscrollcommand: _XYScrollCommand = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -3159,7 +3144,7 @@ class LabelFrame(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -3192,7 +3177,7 @@ class LabelFrame(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -3215,7 +3200,7 @@ class LabelFrame(Widget): takefocus: _TakeFocusValue = ..., text: float | str = ..., width: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -3224,7 +3209,7 @@ class PanedWindow(Widget): def __init__( self, master: Misc | None = ..., - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -3252,7 +3237,7 @@ class PanedWindow(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: _Color = ..., bd: _ScreenUnits = ..., @@ -3275,7 +3260,7 @@ class PanedWindow(Widget): sashwidth: _ScreenUnits = ..., showhandle: bool = ..., width: _ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure diff --git a/stdlib/tkinter/filedialog.pyi b/stdlib/tkinter/filedialog.pyi index b442a3c09fd9..1f12464e70b8 100644 --- a/stdlib/tkinter/filedialog.pyi +++ b/stdlib/tkinter/filedialog.pyi @@ -1,9 +1,9 @@ from _typeshed import StrOrBytesPath from tkinter import Button, Entry, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, _TkinterSequence, commondialog -from typing import IO, Any, ClassVar, Dict, Iterable, Tuple +from typing import IO, Any, ClassVar, Iterable, Tuple from typing_extensions import Literal -dialogstates: Dict[Any, Tuple[Any, Any]] +dialogstates: dict[Any, Tuple[Any, Any]] class FileDialog: title: str = ... diff --git a/stdlib/tkinter/simpledialog.pyi b/stdlib/tkinter/simpledialog.pyi index bdbf600bd498..ec801afaceee 100644 --- a/stdlib/tkinter/simpledialog.pyi +++ b/stdlib/tkinter/simpledialog.pyi @@ -1,5 +1,5 @@ from tkinter import Event, Misc, Toplevel -from typing import Any, List +from typing import Any class Dialog(Toplevel): def __init__(self, parent: Misc | None, title: str | None = ...) -> None: ... @@ -11,7 +11,7 @@ class SimpleDialog: self, master: Misc | None, text: str = ..., - buttons: List[str] = ..., + buttons: list[str] = ..., default: int | None = ..., cancel: int | None = ..., title: str | None = ..., diff --git a/stdlib/tkinter/tix.pyi b/stdlib/tkinter/tix.pyi index a5242bd9fe16..3518802aaa71 100644 --- a/stdlib/tkinter/tix.pyi +++ b/stdlib/tkinter/tix.pyi @@ -1,5 +1,5 @@ import tkinter -from typing import Any, Dict, List, Tuple +from typing import Any, Tuple from typing_extensions import Literal WINDOW: Literal["window"] @@ -37,7 +37,7 @@ TCL_ALL_EVENTS: Literal[0] class tixCommand: def tix_addbitmapdir(self, directory: str) -> None: ... def tix_cget(self, option: str) -> Any: ... - def tix_configure(self, cnf: Dict[str, Any] | None = ..., **kw: Any) -> Any: ... + def tix_configure(self, cnf: dict[str, Any] | None = ..., **kw: Any) -> Any: ... def tix_filedialog(self, dlgclass: str | None = ...) -> str: ... def tix_getbitmap(self, name: str) -> str: ... def tix_getimage(self, name: str) -> str: ... @@ -52,16 +52,16 @@ class TixWidget(tkinter.Widget): self, master: tkinter.Misc | None = ..., widgetName: str | None = ..., - static_options: List[str] | None = ..., - cnf: Dict[str, Any] = ..., - kw: Dict[str, Any] = ..., + static_options: list[str] | None = ..., + cnf: dict[str, Any] = ..., + kw: dict[str, Any] = ..., ) -> None: ... def __getattr__(self, name: str) -> Any: ... def set_silent(self, value: str) -> None: ... def subwidget(self, name: str) -> tkinter.Widget: ... - def subwidgets_all(self) -> List[tkinter.Widget]: ... + def subwidgets_all(self) -> list[tkinter.Widget]: ... def config_all(self, option: Any, value: Any) -> None: ... - def image_create(self, imgtype: str, cnf: Dict[str, Any] = ..., master: tkinter.Widget | None = ..., **kw: Any) -> None: ... + def image_create(self, imgtype: str, cnf: dict[str, Any] = ..., master: tkinter.Widget | None = ..., **kw: Any) -> None: ... def image_delete(self, imgname: str) -> None: ... class TixSubWidget(TixWidget): @@ -70,102 +70,102 @@ class TixSubWidget(TixWidget): ) -> None: ... class DisplayStyle: - def __init__(self, itemtype: str, cnf: Dict[str, Any] = ..., *, master: tkinter.Widget | None = ..., **kw: Any) -> None: ... + def __init__(self, itemtype: str, cnf: dict[str, Any] = ..., *, master: tkinter.Widget | None = ..., **kw: Any) -> None: ... def __getitem__(self, key: str) -> Any: ... def __setitem__(self, key: str, value: Any) -> None: ... def delete(self) -> None: ... - def config(self, cnf: Dict[str, Any] = ..., **kw: Any) -> Any: ... + def config(self, cnf: dict[str, Any] = ..., **kw: Any) -> Any: ... class Balloon(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def bind_widget(self, widget: tkinter.Widget, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def bind_widget(self, widget: tkinter.Widget, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def unbind_widget(self, widget: tkinter.Widget) -> None: ... class ButtonBox(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... def invoke(self, name: str) -> None: ... class ComboBox(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def add_history(self, str: str) -> None: ... def append_history(self, str: str) -> None: ... def insert(self, index: int, str: str) -> None: ... def pick(self, index: int) -> None: ... class Control(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def decrement(self) -> None: ... def increment(self) -> None: ... def invoke(self) -> None: ... class LabelEntry(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... class LabelFrame(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... class Meter(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... class OptionMenu(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def add_command(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def add_separator(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def add_command(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def add_separator(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def delete(self, name: str) -> None: ... def disable(self, name: str) -> None: ... def enable(self, name: str) -> None: ... class PopupMenu(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def bind_widget(self, widget: tkinter.Widget) -> None: ... def unbind_widget(self, widget: tkinter.Widget) -> None: ... def post_widget(self, widget: tkinter.Widget, x: int, y: int) -> None: ... class Select(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... def invoke(self, name: str) -> None: ... class StdButtonBox(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def invoke(self, name: str) -> None: ... class DirList(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def chdir(self, dir: str) -> None: ... class DirTree(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def chdir(self, dir: str) -> None: ... class DirSelectDialog(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def popup(self) -> None: ... def popdown(self) -> None: ... class DirSelectBox(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... class ExFileSelectBox(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def filter(self) -> None: ... def invoke(self) -> None: ... class FileSelectBox(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def apply_filter(self) -> None: ... def invoke(self) -> None: ... class FileEntry(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def invoke(self) -> None: ... def file_dialog(self) -> None: ... class HList(TixWidget, tkinter.XView, tkinter.YView): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... - def add_child(self, parent: str | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def add(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... + def add_child(self, parent: str | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ... def anchor_set(self, entry: str) -> None: ... def anchor_clear(self) -> None: ... # FIXME: Overload, certain combos return, others don't @@ -178,16 +178,16 @@ class HList(TixWidget, tkinter.XView, tkinter.YView): def dragsite_clear(self) -> None: ... def dropsite_set(self, index: int) -> None: ... def dropsite_clear(self) -> None: ... - def header_create(self, col: int, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def header_configure(self, col: int, cnf: Dict[str, Any] = ..., **kw: Any) -> Any | None: ... + def header_create(self, col: int, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def header_configure(self, col: int, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... def header_cget(self, col: int, opt: Any) -> Any: ... def header_exists(self, col: int) -> bool: ... def header_exist(self, col: int) -> bool: ... def header_delete(self, col: int) -> None: ... def header_size(self, col: int) -> int: ... def hide_entry(self, entry: str) -> None: ... - def indicator_create(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def indicator_configure(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> Any | None: ... + def indicator_create(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def indicator_configure(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... def indicator_cget(self, entry: str, opt: Any) -> Any: ... def indicator_exists(self, entry: str) -> bool: ... def indicator_delete(self, entry: str) -> None: ... @@ -205,21 +205,21 @@ class HList(TixWidget, tkinter.XView, tkinter.YView): def info_prev(self, entry: str) -> str: ... def info_selection(self) -> Tuple[str, ...]: ... def item_cget(self, entry: str, col: int, opt: Any) -> Any: ... - def item_configure(self, entry: str, col: int, cnf: Dict[str, Any] = ..., **kw: Any) -> Any | None: ... - def item_create(self, entry: str, col: int, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def item_configure(self, entry: str, col: int, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... + def item_create(self, entry: str, col: int, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def item_exists(self, entry: str, col: int) -> bool: ... def item_delete(self, entry: str, col: int) -> None: ... def entrycget(self, entry: str, opt: Any) -> Any: ... - def entryconfigure(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> Any | None: ... + def entryconfigure(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... def nearest(self, y: int) -> str: ... def see(self, entry: str) -> None: ... - def selection_clear(self, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def selection_clear(self, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def selection_includes(self, entry: str) -> bool: ... def selection_set(self, first: str, last: str | None = ...) -> None: ... def show_entry(self, entry: str) -> None: ... class CheckList(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def autosetmode(self) -> None: ... def close(self, entrypath: str) -> None: ... def getmode(self, entrypath: str) -> str: ... @@ -229,7 +229,7 @@ class CheckList(TixWidget): def setstatus(self, entrypath: str, mode: str = ...) -> None: ... class Tree(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def autosetmode(self) -> None: ... def close(self, entrypath: str) -> None: ... def getmode(self, entrypath: str) -> str: ... @@ -237,7 +237,7 @@ class Tree(TixWidget): def setmode(self, entrypath: str, mode: str = ...) -> None: ... class TList(TixWidget, tkinter.XView, tkinter.YView): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def active_set(self, index: int) -> None: ... def active_clear(self) -> None: ... def anchor_set(self, index: int) -> None: ... @@ -247,7 +247,7 @@ class TList(TixWidget, tkinter.XView, tkinter.YView): def dragsite_clear(self) -> None: ... def dropsite_set(self, index: int) -> None: ... def dropsite_clear(self) -> None: ... - def insert(self, index: int, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def insert(self, index: int, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def info_active(self) -> int: ... def info_anchor(self) -> int: ... def info_down(self, index: int) -> int: ... @@ -258,44 +258,44 @@ class TList(TixWidget, tkinter.XView, tkinter.YView): def info_up(self, index: int) -> int: ... def nearest(self, x: int, y: int) -> int: ... def see(self, index: int) -> None: ... - def selection_clear(self, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def selection_clear(self, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def selection_includes(self, index: int) -> bool: ... def selection_set(self, first: int, last: int | None = ...) -> None: ... class PanedWindow(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def delete(self, name: str) -> None: ... def forget(self, name: str) -> None: ... # type: ignore def panecget(self, entry: str, opt: Any) -> Any: ... - def paneconfigure(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> Any | None: ... - def panes(self) -> List[tkinter.Widget]: ... + def paneconfigure(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... + def panes(self) -> list[tkinter.Widget]: ... class ListNoteBook(TixWidget): - def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def page(self, name: str) -> tkinter.Widget: ... - def pages(self) -> List[tkinter.Widget]: ... + def pages(self) -> list[tkinter.Widget]: ... def raise_page(self, name: str) -> None: ... class NoteBook(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def delete(self, name: str) -> None: ... def page(self, name: str) -> tkinter.Widget: ... - def pages(self) -> List[tkinter.Widget]: ... + def pages(self) -> list[tkinter.Widget]: ... def raise_page(self, name: str) -> None: ... def raised(self) -> bool: ... class InputOnly(TixWidget): - def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def __init__(self, master: tkinter.Widget | None = ..., cnf: dict[str, Any] = ..., **kw: Any) -> None: ... class Form: def __setitem__(self, key: str, value: Any) -> None: ... - def config(self, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def form(self, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... + def config(self, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... + def form(self, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def check(self) -> bool: ... def forget(self) -> None: ... def grid(self, xsize: int = ..., ysize: int = ...) -> Tuple[int, int] | None: ... def info(self, option: str | None = ...) -> Any: ... - def slaves(self) -> List[tkinter.Widget]: ... + def slaves(self) -> list[tkinter.Widget]: ... diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index 6cda54f6d5b2..c2bde4c6a331 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -2,7 +2,7 @@ import _tkinter import sys import tkinter from tkinter.font import _FontDescription -from typing import Any, Callable, Dict, Tuple, Union, overload +from typing import Any, Callable, Tuple, Union, overload from typing_extensions import Literal, TypedDict def tclobjs_to_py(adict): ... @@ -57,7 +57,7 @@ class Button(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, command: tkinter._ButtonCommand = ..., compound: _TtkCompound = ..., @@ -72,7 +72,7 @@ class Button(Widget): textvariable: tkinter.Variable = ..., underline: int = ..., width: int | Literal[""] = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -107,7 +107,7 @@ class Checkbutton(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, command: tkinter._ButtonCommand = ..., compound: _TtkCompound = ..., @@ -124,7 +124,7 @@ class Checkbutton(Widget): underline: int = ..., variable: tkinter.Variable = ..., width: int | Literal[""] = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -158,7 +158,7 @@ class Entry(Widget, tkinter.Entry): @overload # type: ignore def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: tkinter._Color = ..., cursor: tkinter._Cursor = ..., @@ -176,14 +176,14 @@ class Entry(Widget, tkinter.Entry): validatecommand: tkinter._EntryValidateCommand = ..., width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Entry().config is mypy error (don't know why) @overload # type: ignore def config( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: tkinter._Color = ..., cursor: tkinter._Cursor = ..., @@ -201,7 +201,7 @@ class Entry(Widget, tkinter.Entry): validatecommand: tkinter._EntryValidateCommand = ..., width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... def bbox(self, index): ... @@ -238,7 +238,7 @@ class Combobox(Entry): @overload # type: ignore def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: tkinter._Color = ..., cursor: tkinter._Cursor = ..., @@ -259,14 +259,14 @@ class Combobox(Entry): values: tkinter._TkinterSequence[str] = ..., width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Combobox().config is mypy error (don't know why) @overload # type: ignore def config( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: tkinter._Color = ..., cursor: tkinter._Cursor = ..., @@ -287,7 +287,7 @@ class Combobox(Entry): values: tkinter._TkinterSequence[str] = ..., width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... def current(self, newindex: Any | None = ...): ... @@ -313,7 +313,7 @@ class Frame(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, border: tkinter._ScreenUnits = ..., borderwidth: tkinter._ScreenUnits = ..., @@ -324,7 +324,7 @@ class Frame(Widget): style: str = ..., takefocus: tkinter._TakeFocusValue = ..., width: tkinter._ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -360,7 +360,7 @@ class Label(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, anchor: tkinter._Anchor = ..., background: tkinter._Color = ..., @@ -382,7 +382,7 @@ class Label(Widget): underline: int = ..., width: int | Literal[""] = ..., wraplength: tkinter._ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -411,7 +411,7 @@ class Labelframe(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, border: tkinter._ScreenUnits = ..., borderwidth: tkinter._ScreenUnits = ..., @@ -426,7 +426,7 @@ class Labelframe(Widget): text: float | str = ..., underline: int = ..., width: tkinter._ScreenUnits = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -457,7 +457,7 @@ class Menubutton(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., @@ -472,7 +472,7 @@ class Menubutton(Widget): textvariable: tkinter.Variable = ..., underline: int = ..., width: int | Literal[""] = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -494,7 +494,7 @@ class Notebook(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, cursor: tkinter._Cursor = ..., height: int = ..., @@ -502,7 +502,7 @@ class Notebook(Widget): style: str = ..., takefocus: tkinter._TakeFocusValue = ..., width: int = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -535,28 +535,28 @@ class Panedwindow(Widget, tkinter.PanedWindow): @overload # type: ignore def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, cursor: tkinter._Cursor = ..., height: int = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., width: int = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Panedwindow().config is mypy error (don't know why) @overload # type: ignore def config( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, cursor: tkinter._Cursor = ..., height: int = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., width: int = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... forget: Any @@ -587,7 +587,7 @@ class Progressbar(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, cursor: tkinter._Cursor = ..., length: tkinter._ScreenUnits = ..., @@ -599,7 +599,7 @@ class Progressbar(Widget): takefocus: tkinter._TakeFocusValue = ..., value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -632,7 +632,7 @@ class Radiobutton(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, command: tkinter._ButtonCommand = ..., compound: _TtkCompound = ..., @@ -648,7 +648,7 @@ class Radiobutton(Widget): value: Any = ..., variable: tkinter.Variable | Literal[""] = ..., width: int | Literal[""] = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -676,7 +676,7 @@ class Scale(Widget, tkinter.Scale): @overload # type: ignore def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, command: str | Callable[[str], Any] = ..., cursor: tkinter._Cursor = ..., @@ -689,14 +689,14 @@ class Scale(Widget, tkinter.Scale): to: float = ..., value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Scale().config is mypy error (don't know why) @overload # type: ignore def config( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, command: str | Callable[[str], Any] = ..., cursor: tkinter._Cursor = ..., @@ -709,7 +709,7 @@ class Scale(Widget, tkinter.Scale): to: float = ..., value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... def get(self, x: Any | None = ..., y: Any | None = ...): ... @@ -730,28 +730,28 @@ class Scrollbar(Widget, tkinter.Scrollbar): @overload # type: ignore def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, command: Callable[..., Tuple[float, float] | None] | str = ..., cursor: tkinter._Cursor = ..., orient: Literal["horizontal", "vertical"] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Scrollbar().config is mypy error (don't know why) @overload # type: ignore def config( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, command: Callable[..., Tuple[float, float] | None] | str = ..., cursor: tkinter._Cursor = ..., orient: Literal["horizontal", "vertical"] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... @@ -770,13 +770,13 @@ class Separator(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, cursor: tkinter._Cursor = ..., orient: Literal["horizontal", "vertical"] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -795,12 +795,12 @@ class Sizegrip(Widget): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, cursor: tkinter._Cursor = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure @@ -840,7 +840,7 @@ if sys.version_info >= (3, 7): @overload # type: ignore def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, background: tkinter._Color = ..., command: Callable[[], Any] | str | tkinter._TkinterSequence[str] = ..., @@ -865,7 +865,7 @@ if sys.version_info >= (3, 7): width: int = ..., wrap: bool = ..., xscrollcommand: tkinter._XYScrollCommand = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure # type: ignore @@ -927,7 +927,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): @overload def configure( self, - cnf: Dict[str, Any] | None = ..., + cnf: dict[str, Any] | None = ..., *, columns: str | tkinter._TkinterSequence[str] = ..., cursor: tkinter._Cursor = ..., @@ -940,7 +940,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): takefocus: tkinter._TakeFocusValue = ..., xscrollcommand: tkinter._XYScrollCommand = ..., yscrollcommand: tkinter._XYScrollCommand = ..., - ) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ... + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure diff --git a/stdlib/token.pyi b/stdlib/token.pyi index 4833438e4128..90381833511b 100644 --- a/stdlib/token.pyi +++ b/stdlib/token.pyi @@ -1,5 +1,4 @@ import sys -from typing import Dict ENDMARKER: int NAME: int @@ -62,7 +61,7 @@ OP: int ERRORTOKEN: int N_TOKENS: int NT_OFFSET: int -tok_name: Dict[int, str] +tok_name: dict[int, str] if sys.version_info >= (3, 7): COMMENT: int NL: int @@ -71,7 +70,7 @@ if sys.version_info >= (3, 8): TYPE_COMMENT: int TYPE_IGNORE: int COLONEQUAL: int - EXACT_TOKEN_TYPES: Dict[str, int] + EXACT_TOKEN_TYPES: dict[str, int] def ISTERMINAL(x: int) -> bool: ... def ISNONTERMINAL(x: int) -> bool: ... diff --git a/stdlib/tokenize.pyi b/stdlib/tokenize.pyi index e64e64842a17..136dcfcf0a14 100644 --- a/stdlib/tokenize.pyi +++ b/stdlib/tokenize.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import StrOrBytesPath from builtins import open as _builtin_open from token import * # noqa: F403 -from typing import Any, Callable, Dict, Generator, Iterable, List, NamedTuple, Pattern, Sequence, Set, TextIO, Tuple, Union +from typing import Any, Callable, Generator, Iterable, NamedTuple, Pattern, Sequence, Set, TextIO, Tuple, Union if sys.version_info < (3, 7): COMMENT: int @@ -32,7 +32,7 @@ class TokenError(Exception): ... class StopTokenizing(Exception): ... # undocumented class Untokenizer: - tokens: List[str] + tokens: list[str] prev_row: int prev_col: int encoding: str | None @@ -94,7 +94,7 @@ ContStr: str # undocumented PseudoExtras: str # undocumented PseudoToken: str # undocumented -endpats: Dict[str, str] # undocumented +endpats: dict[str, str] # undocumented single_quoted: Set[str] # undocumented triple_quoted: Set[str] # undocumented diff --git a/stdlib/trace.pyi b/stdlib/trace.pyi index 4fef84566e1d..dc2f663d8273 100644 --- a/stdlib/trace.pyi +++ b/stdlib/trace.pyi @@ -1,7 +1,7 @@ import sys import types from _typeshed import StrPath -from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Tuple, TypeVar +from typing import Any, Callable, Mapping, Optional, Sequence, Tuple, TypeVar _T = TypeVar("_T") _localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]] @@ -10,10 +10,10 @@ _fileModuleFunction = Tuple[str, Optional[str], str] class CoverageResults: def __init__( self, - counts: Dict[Tuple[str, int], int] | None = ..., - calledfuncs: Dict[_fileModuleFunction, int] | None = ..., + counts: dict[Tuple[str, int], int] | None = ..., + calledfuncs: dict[_fileModuleFunction, int] | None = ..., infile: StrPath | None = ..., - callers: Dict[Tuple[_fileModuleFunction, _fileModuleFunction], int] | None = ..., + callers: dict[Tuple[_fileModuleFunction, _fileModuleFunction], int] | None = ..., outfile: StrPath | None = ..., ) -> None: ... # undocumented def update(self, other: CoverageResults) -> None: ... diff --git a/stdlib/traceback.pyi b/stdlib/traceback.pyi index 6df54e1b5485..e071a3158816 100644 --- a/stdlib/traceback.pyi +++ b/stdlib/traceback.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import SupportsWrite from types import FrameType, TracebackType -from typing import IO, Any, Dict, Generator, Iterable, Iterator, List, Mapping, Optional, Set, Tuple, Type +from typing import IO, Any, Generator, Iterable, Iterator, List, Mapping, Optional, Set, Tuple, Type _PT = Tuple[str, int, str, Optional[str]] @@ -32,16 +32,16 @@ def print_last(limit: int | None = ..., file: IO[str] | None = ..., chain: bool def print_stack(f: FrameType | None = ..., limit: int | None = ..., file: IO[str] | None = ...) -> None: ... def extract_tb(tb: TracebackType | None, limit: int | None = ...) -> StackSummary: ... def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> StackSummary: ... -def format_list(extracted_list: List[FrameSummary]) -> List[str]: ... +def format_list(extracted_list: list[FrameSummary]) -> list[str]: ... # undocumented -def print_list(extracted_list: List[FrameSummary], file: SupportsWrite[str] | None = ...) -> None: ... +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]: ... if sys.version_info >= (3, 10): def format_exception( @@ -50,7 +50,7 @@ if sys.version_info >= (3, 10): tb: TracebackType | None = ..., limit: int | None = ..., chain: bool = ..., - ) -> List[str]: ... + ) -> list[str]: ... else: def format_exception( @@ -59,11 +59,11 @@ else: tb: TracebackType | None, limit: int | None = ..., chain: bool = ..., - ) -> List[str]: ... + ) -> list[str]: ... def format_exc(limit: int | None = ..., chain: bool = ...) -> str: ... -def format_tb(tb: TracebackType | None, limit: int | None = ...) -> List[str]: ... -def format_stack(f: FrameType | None = ..., limit: int | None = ...) -> List[str]: ... +def format_tb(tb: TracebackType | None, limit: int | None = ...) -> list[str]: ... +def format_stack(f: FrameType | None = ..., limit: int | None = ...) -> list[str]: ... def clear_frames(tb: TracebackType) -> None: ... def walk_stack(f: FrameType | None) -> Iterator[Tuple[FrameType, int]]: ... def walk_tb(tb: TracebackType | None) -> Iterator[Tuple[FrameType, int]]: ... @@ -126,7 +126,7 @@ class FrameSummary(Iterable[Any]): lineno: int name: str line: str - locals: Dict[str, str] | None + locals: dict[str, str] | None def __init__( self, filename: str, @@ -153,5 +153,5 @@ class StackSummary(List[FrameSummary]): capture_locals: bool = ..., ) -> StackSummary: ... @classmethod - def from_list(cls, a_list: List[_PT]) -> StackSummary: ... - def format(self) -> List[str]: ... + def from_list(cls, a_list: list[_PT]) -> StackSummary: ... + def format(self) -> list[str]: ... diff --git a/stdlib/tracemalloc.pyi b/stdlib/tracemalloc.pyi index 04843950ab79..e812b8247332 100644 --- a/stdlib/tracemalloc.pyi +++ b/stdlib/tracemalloc.pyi @@ -1,5 +1,5 @@ import sys -from typing import List, Optional, Sequence, Tuple, Union, overload +from typing import Optional, Sequence, Tuple, Union, overload from _tracemalloc import * @@ -60,9 +60,9 @@ class Traceback(Sequence[Frame]): else: def __init__(self, frames: Sequence[_FrameTupleT]) -> None: ... if sys.version_info >= (3, 7): - def format(self, limit: int | None = ..., most_recent_first: bool = ...) -> List[str]: ... + def format(self, limit: int | None = ..., most_recent_first: bool = ...) -> list[str]: ... else: - def format(self, limit: int | None = ...) -> List[str]: ... + def format(self, limit: int | None = ...) -> list[str]: ... @overload def __getitem__(self, i: int) -> Frame: ... @overload @@ -71,11 +71,11 @@ class Traceback(Sequence[Frame]): class Snapshot: def __init__(self, traces: Sequence[_TraceTupleT], traceback_limit: int) -> None: ... - def compare_to(self, old_snapshot: Snapshot, key_type: str, cumulative: bool = ...) -> List[StatisticDiff]: ... + def compare_to(self, old_snapshot: Snapshot, key_type: str, cumulative: bool = ...) -> list[StatisticDiff]: ... def dump(self, filename: str) -> None: ... def filter_traces(self, filters: Sequence[DomainFilter | Filter]) -> Snapshot: ... @staticmethod def load(filename: str) -> Snapshot: ... - def statistics(self, key_type: str, cumulative: bool = ...) -> List[Statistic]: ... + def statistics(self, key_type: str, cumulative: bool = ...) -> list[Statistic]: ... traceback_limit: int traces: Sequence[Trace] diff --git a/stdlib/turtle.pyi b/stdlib/turtle.pyi index ced5607271d7..68fd84ed9420 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -1,5 +1,5 @@ from tkinter import Canvas, PhotoImage -from typing import Any, Callable, Dict, List, Sequence, Tuple, TypeVar, Union, overload +from typing import Any, Callable, Dict, Sequence, Tuple, TypeVar, Union, overload # Note: '_Color' is the alias we use for arguments and _AnyColor is the # alias we use for return types. Really, these two aliases should be the @@ -52,7 +52,7 @@ class TurtleScreen(TurtleScreenBase): @overload def colormode(self, cmode: float) -> None: ... def reset(self) -> None: ... - def turtles(self) -> List[Turtle]: ... + def turtles(self) -> list[Turtle]: ... @overload def bgcolor(self) -> _AnyColor: ... @overload @@ -71,7 +71,7 @@ class TurtleScreen(TurtleScreenBase): def window_width(self) -> int: ... def window_height(self) -> int: ... def getcanvas(self) -> Canvas: ... - def getshapes(self) -> List[str]: ... + def getshapes(self) -> list[str]: ... def onclick(self, fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... def onkey(self, fun: Callable[[], Any], key: str) -> None: ... def listen(self, xdummy: float | None = ..., ydummy: float | None = ...) -> None: ... @@ -93,7 +93,7 @@ class TurtleScreen(TurtleScreenBase): onkeyrelease = onkey class TNavigator(object): - START_ORIENTATION: Dict[str, Vec2D] = ... + START_ORIENTATION: dict[str, Vec2D] = ... DEFAULT_MODE: str = ... DEFAULT_ANGLEOFFSET: int = ... DEFAULT_ANGLEORIENT: int = ... @@ -317,7 +317,7 @@ def colormode(cmode: None = ...) -> float: ... @overload def colormode(cmode: float) -> None: ... def reset() -> None: ... -def turtles() -> List[Turtle]: ... +def turtles() -> list[Turtle]: ... @overload def bgcolor() -> _AnyColor: ... @overload @@ -336,7 +336,7 @@ def update() -> None: ... def window_width() -> int: ... def window_height() -> int: ... def getcanvas() -> Canvas: ... -def getshapes() -> List[str]: ... +def getshapes() -> list[str]: ... def onclick(fun: Callable[[float, float], Any], btn: int = ..., add: Any | None = ...) -> None: ... def onkey(fun: Callable[[], Any], key: str) -> None: ... def listen(xdummy: float | None = ..., ydummy: float | None = ...) -> None: ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index 6f26474d2dea..7cd99a429461 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -6,7 +6,6 @@ from typing import ( AsyncGenerator, Awaitable, Callable, - Dict, Generator, Generic, ItemsView, @@ -43,16 +42,16 @@ class FunctionType: __closure__: Tuple[_Cell, ...] | None __code__: CodeType __defaults__: Tuple[Any, ...] | None - __dict__: Dict[str, Any] - __globals__: Dict[str, Any] + __dict__: dict[str, Any] + __globals__: dict[str, Any] __name__: str __qualname__: str - __annotations__: Dict[str, Any] - __kwdefaults__: Dict[str, Any] + __annotations__: dict[str, Any] + __kwdefaults__: dict[str, Any] def __init__( self, code: CodeType, - globals: Dict[str, Any], + globals: dict[str, Any], name: str | None = ..., argdefs: Tuple[object, ...] | None = ..., closure: Tuple[_Cell, ...] | None = ..., @@ -151,7 +150,7 @@ class MappingProxyType(Mapping[_KT, _VT_co], Generic[_KT, _VT_co]): def __getitem__(self, k: _KT) -> _VT_co: ... def __iter__(self) -> Iterator[_KT]: ... def __len__(self) -> int: ... - def copy(self) -> Dict[_KT, _VT_co]: ... + def copy(self) -> dict[_KT, _VT_co]: ... def keys(self) -> KeysView[_KT]: ... def values(self) -> ValuesView[_VT_co]: ... def items(self) -> ItemsView[_KT, _VT_co]: ... @@ -171,7 +170,7 @@ class SimpleNamespace: class ModuleType: __name__: str __file__: str - __dict__: Dict[str, Any] + __dict__: dict[str, Any] __loader__: _LoaderProtocol | None __package__: str | None __spec__: ModuleSpec | None @@ -311,12 +310,12 @@ class TracebackType: @final class FrameType: f_back: FrameType | None - f_builtins: Dict[str, Any] + f_builtins: dict[str, Any] f_code: CodeType - f_globals: Dict[str, Any] + f_globals: dict[str, Any] f_lasti: int f_lineno: int - f_locals: Dict[str, Any] + f_locals: dict[str, Any] f_trace: Callable[[FrameType, str, Any], Any] | None if sys.version_info >= (3, 7): f_trace_lines: bool @@ -343,8 +342,8 @@ if sys.version_info >= (3, 7): def new_class( name: str, bases: Iterable[object] = ..., - kwds: Dict[str, Any] | None = ..., - exec_body: Callable[[Dict[str, Any]], None] | None = ..., + kwds: dict[str, Any] | None = ..., + exec_body: Callable[[dict[str, Any]], None] | None = ..., ) -> type: ... def resolve_bases(bases: Iterable[object]) -> Tuple[Any, ...]: ... @@ -352,13 +351,13 @@ else: def new_class( name: str, bases: Tuple[type, ...] = ..., - kwds: Dict[str, Any] | None = ..., - exec_body: Callable[[Dict[str, Any]], None] | None = ..., + kwds: dict[str, Any] | None = ..., + exec_body: Callable[[dict[str, Any]], None] | None = ..., ) -> type: ... def prepare_class( - name: str, bases: Tuple[type, ...] = ..., kwds: Dict[str, Any] | None = ... -) -> Tuple[type, Dict[str, Any], Dict[str, Any]]: ... + name: str, bases: Tuple[type, ...] = ..., kwds: dict[str, Any] | None = ... +) -> Tuple[type, dict[str, Any], dict[str, Any]]: ... # Actually a different type, but `property` is special and we want that too. DynamicClassAttribute = property diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index ff1958e439f8..c2306d683cca 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -637,15 +637,15 @@ else: if sys.version_info >= (3, 9): def get_type_hints( obj: _get_type_hints_obj_allowed_types, - globalns: Dict[str, Any] | None = ..., - localns: Dict[str, Any] | None = ..., + globalns: dict[str, Any] | None = ..., + localns: dict[str, Any] | None = ..., include_extras: bool = ..., - ) -> Dict[str, Any]: ... + ) -> dict[str, Any]: ... else: def get_type_hints( - obj: _get_type_hints_obj_allowed_types, globalns: Dict[str, Any] | None = ..., localns: Dict[str, Any] | None = ... - ) -> Dict[str, Any]: ... + obj: _get_type_hints_obj_allowed_types, globalns: dict[str, Any] | None = ..., localns: dict[str, Any] | None = ... + ) -> dict[str, Any]: ... if sys.version_info >= (3, 8): def get_origin(tp: Any) -> Any | None: ... @@ -663,14 +663,14 @@ def cast(typ: object, val: Any) -> Any: ... # NamedTuple is special-cased in the type checker class NamedTuple(Tuple[Any, ...]): _field_types: collections.OrderedDict[str, Type[Any]] - _field_defaults: Dict[str, Any] = ... + _field_defaults: dict[str, Any] = ... _fields: Tuple[str, ...] _source: str def __init__(self, typename: str, fields: Iterable[Tuple[str, Any]] = ..., **kwargs: Any) -> None: ... @classmethod def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ... if sys.version_info >= (3, 8): - def _asdict(self) -> Dict[str, Any]: ... + def _asdict(self) -> dict[str, Any]: ... else: def _asdict(self) -> collections.OrderedDict[str, Any]: ... def _replace(self: _T, **kwargs: Any) -> _T: ... @@ -707,7 +707,7 @@ if sys.version_info >= (3, 7): def __init__(self, arg: str, is_argument: bool = ..., module: Any | None = ...) -> None: ... else: def __init__(self, arg: str, is_argument: bool = ...) -> None: ... - def _evaluate(self, globalns: Dict[str, Any] | None, localns: Dict[str, Any] | None) -> Any | None: ... + def _evaluate(self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None) -> Any | None: ... def __eq__(self, other: Any) -> bool: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index 1ea3545b165d..59fe3df390d2 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -16,7 +16,6 @@ from typing import ( Counter as Counter, DefaultDict as DefaultDict, Deque as Deque, - Dict, ItemsView, KeysView, Mapping, @@ -72,10 +71,10 @@ OrderedDict = _Alias() def get_type_hints( obj: Callable[..., Any], - globalns: Dict[str, Any] | None = ..., - localns: Dict[str, Any] | None = ..., + globalns: dict[str, Any] | None = ..., + localns: dict[str, Any] | None = ..., include_extras: bool = ..., -) -> Dict[str, Any]: ... +) -> dict[str, Any]: ... if sys.version_info >= (3, 7): def get_args(tp: Any) -> Tuple[Any, ...]: ... diff --git a/stdlib/unittest/case.pyi b/stdlib/unittest/case.pyi index 37dc44bd4338..ebb1f2457e68 100644 --- a/stdlib/unittest/case.pyi +++ b/stdlib/unittest/case.pyi @@ -13,7 +13,6 @@ from typing import ( ContextManager, Generic, Iterable, - List, Mapping, NamedTuple, NoReturn, @@ -166,7 +165,7 @@ class TestCase: def assertSequenceEqual( 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 assertListEqual(self, list1: list[Any], list2: list[Any], msg: Any = ...) -> None: ... def assertTupleEqual(self, tuple1: Tuple[Any, ...], tuple2: Tuple[Any, ...], msg: Any = ...) -> None: ... def assertSetEqual(self, set1: Set[object], set2: Set[object], msg: Any = ...) -> None: ... def assertDictEqual(self, d1: Mapping[Any, object], d2: Mapping[Any, object], msg: Any = ...) -> None: ... @@ -242,8 +241,8 @@ class FunctionTestCase(TestCase): def runTest(self) -> None: ... class _LoggingWatcher(NamedTuple): - records: List[logging.LogRecord] - output: List[str] + records: list[logging.LogRecord] + output: list[str] class _AssertRaisesContext(Generic[_E]): exception: _E @@ -258,7 +257,7 @@ class _AssertWarnsContext: warning: WarningMessage filename: str lineno: int - warnings: List[WarningMessage] + warnings: list[WarningMessage] def __enter__(self: Self) -> Self: ... def __exit__( self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None @@ -266,8 +265,8 @@ class _AssertWarnsContext: class _AssertLogsContext: LOGGING_FORMAT: str - records: List[logging.LogRecord] - output: List[str] + records: list[logging.LogRecord] + output: list[str] def __init__(self, test_case: TestCase, logger_name: str, level: int) -> None: ... if sys.version_info >= (3, 10): def __enter__(self) -> _LoggingWatcher | None: ... diff --git a/stdlib/unittest/loader.pyi b/stdlib/unittest/loader.pyi index a71f0d8d91ea..d3cb4cef733b 100644 --- a/stdlib/unittest/loader.pyi +++ b/stdlib/unittest/loader.pyi @@ -9,12 +9,12 @@ _SortComparisonMethod = Callable[[str, str], int] _SuiteClass = Callable[[List[unittest.case.TestCase]], unittest.suite.TestSuite] class TestLoader: - errors: List[Type[BaseException]] + errors: list[Type[BaseException]] testMethodPrefix: str sortTestMethodsUsing: _SortComparisonMethod if sys.version_info >= (3, 7): - testNamePatterns: List[str] | None + testNamePatterns: list[str] | None suiteClass: _SuiteClass def loadTestsFromTestCase(self, testCaseClass: Type[unittest.case.TestCase]) -> unittest.suite.TestSuite: ... @@ -31,7 +31,7 @@ if sys.version_info >= (3, 7): testCaseClass: Type[unittest.case.TestCase], prefix: str, sortUsing: _SortComparisonMethod = ..., - testNamePatterns: List[str] | None = ..., + testNamePatterns: list[str] | None = ..., ) -> Sequence[str]: ... else: diff --git a/stdlib/unittest/main.pyi b/stdlib/unittest/main.pyi index 8588ae03431d..cd887cec27d0 100644 --- a/stdlib/unittest/main.pyi +++ b/stdlib/unittest/main.pyi @@ -4,7 +4,7 @@ import unittest.loader import unittest.result import unittest.suite from types import ModuleType -from typing import Any, Iterable, List, Protocol, Type +from typing import Any, Iterable, Protocol, Type class _TestRunner(Protocol): def run(self, test: unittest.suite.TestSuite | unittest.case.TestCase) -> unittest.result.TestResult: ... @@ -21,12 +21,12 @@ class TestProgram: warnings: str | None if sys.version_info >= (3, 7): - testNamePatterns: List[str] | None + testNamePatterns: list[str] | None def __init__( self, module: None | str | ModuleType = ..., defaultTest: str | Iterable[str] | None = ..., - argv: List[str] | None = ..., + argv: list[str] | None = ..., testRunner: Type[_TestRunner] | _TestRunner | None = ..., testLoader: unittest.loader.TestLoader = ..., exit: bool = ..., @@ -39,7 +39,7 @@ class TestProgram: tb_locals: bool = ..., ) -> None: ... def usageExit(self, msg: Any = ...) -> None: ... - def parseArgs(self, argv: List[str]) -> None: ... + def parseArgs(self, argv: list[str]) -> None: ... if sys.version_info >= (3, 7): def createTests(self, from_discovery: bool = ..., Loader: unittest.loader.TestLoader | None = ...) -> None: ... else: diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 1d1185af6939..7ccaf3acaeb5 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -76,10 +76,10 @@ class NonCallableMock(Base, Any): # type: ignore 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 = ..., diff --git a/stdlib/unittest/result.pyi b/stdlib/unittest/result.pyi index f31d8ca4922c..676c0cd4aeda 100644 --- a/stdlib/unittest/result.pyi +++ b/stdlib/unittest/result.pyi @@ -1,6 +1,6 @@ import unittest.case from types import TracebackType -from typing import Any, Callable, List, TextIO, Tuple, Type, TypeVar, Union +from typing import Any, Callable, TextIO, Tuple, Type, TypeVar, Union _SysExcInfoType = Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]] @@ -10,11 +10,11 @@ _F = TypeVar("_F", bound=Callable[..., Any]) def failfast(method: _F) -> _F: ... class TestResult: - errors: List[Tuple[unittest.case.TestCase, str]] - failures: List[Tuple[unittest.case.TestCase, str]] - skipped: List[Tuple[unittest.case.TestCase, str]] - expectedFailures: List[Tuple[unittest.case.TestCase, str]] - unexpectedSuccesses: List[unittest.case.TestCase] + errors: list[Tuple[unittest.case.TestCase, str]] + failures: list[Tuple[unittest.case.TestCase, str]] + skipped: list[Tuple[unittest.case.TestCase, str]] + expectedFailures: list[Tuple[unittest.case.TestCase, str]] + unexpectedSuccesses: list[unittest.case.TestCase] shouldStop: bool testsRun: int buffer: bool diff --git a/stdlib/unittest/suite.pyi b/stdlib/unittest/suite.pyi index 62869d2305d6..396b46eadf5a 100644 --- a/stdlib/unittest/suite.pyi +++ b/stdlib/unittest/suite.pyi @@ -1,11 +1,11 @@ import unittest.case import unittest.result -from typing import Iterable, Iterator, List, Union +from typing import Iterable, Iterator, Union _TestType = Union[unittest.case.TestCase, TestSuite] class BaseTestSuite(Iterable[_TestType]): - _tests: List[unittest.case.TestCase] + _tests: list[unittest.case.TestCase] _removed_tests: int def __init__(self, tests: Iterable[_TestType] = ...) -> None: ... def __call__(self, result: unittest.result.TestResult) -> unittest.result.TestResult: ... diff --git a/stdlib/unittest/util.pyi b/stdlib/unittest/util.pyi index 8b0e8ad28adc..ffce5d52677c 100644 --- a/stdlib/unittest/util.pyi +++ b/stdlib/unittest/util.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Sequence, Tuple, TypeVar +from typing import Any, Sequence, Tuple, TypeVar _T = TypeVar("_T") _Mismatch = Tuple[_T, _T, int] @@ -14,8 +14,8 @@ def _shorten(s: str, prefixlen: int, suffixlen: int) -> str: ... def _common_shorten_repr(*args: str) -> Tuple[str]: ... def safe_repr(obj: object, short: bool = ...) -> str: ... def strclass(cls: type) -> str: ... -def sorted_list_difference(expected: Sequence[_T], actual: Sequence[_T]) -> Tuple[List[_T], List[_T]]: ... -def unorderable_list_difference(expected: Sequence[_T], actual: Sequence[_T]) -> Tuple[List[_T], List[_T]]: ... +def sorted_list_difference(expected: Sequence[_T], actual: Sequence[_T]) -> Tuple[list[_T], list[_T]]: ... +def unorderable_list_difference(expected: Sequence[_T], actual: Sequence[_T]) -> Tuple[list[_T], list[_T]]: ... def three_way_cmp(x: Any, y: Any) -> int: ... -def _count_diff_all_purpose(actual: Sequence[_T], expected: Sequence[_T]) -> List[_Mismatch[_T]]: ... -def _count_diff_hashable(actual: Sequence[_T], expected: Sequence[_T]) -> List[_Mismatch[_T]]: ... +def _count_diff_all_purpose(actual: Sequence[_T], expected: Sequence[_T]) -> list[_Mismatch[_T]]: ... +def _count_diff_hashable(actual: Sequence[_T], expected: Sequence[_T]) -> list[_Mismatch[_T]]: ... diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index 2ac8a3175db9..49a3dd1cedf4 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -1,17 +1,17 @@ import sys -from typing import Any, AnyStr, Callable, Dict, Generic, List, Mapping, NamedTuple, Sequence, Tuple, Union, overload +from typing import Any, AnyStr, Callable, Generic, Mapping, NamedTuple, Sequence, Tuple, Union, overload if sys.version_info >= (3, 9): from types import GenericAlias _Str = Union[bytes, str] -uses_relative: List[str] -uses_netloc: List[str] -uses_params: List[str] -non_hierarchical: List[str] -uses_query: List[str] -uses_fragment: List[str] +uses_relative: list[str] +uses_netloc: list[str] +uses_params: list[str] +non_hierarchical: list[str] +uses_query: list[str] +uses_fragment: list[str] scheme_chars: str MAX_CACHE_SIZE: int @@ -87,7 +87,7 @@ def parse_qs( errors: str = ..., max_num_fields: int | None = ..., separator: str = ..., -) -> Dict[AnyStr, List[AnyStr]]: ... +) -> dict[AnyStr, list[AnyStr]]: ... def parse_qsl( qs: AnyStr | None, keep_blank_values: bool = ..., @@ -96,7 +96,7 @@ def parse_qsl( errors: str = ..., max_num_fields: int | None = ..., separator: str = ..., -) -> List[Tuple[AnyStr, AnyStr]]: ... +) -> list[Tuple[AnyStr, AnyStr]]: ... @overload def quote(string: str, safe: _Str = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload diff --git a/stdlib/urllib/request.pyi b/stdlib/urllib/request.pyi index 7c97b8f20652..9ac320c680db 100644 --- a/stdlib/urllib/request.pyi +++ b/stdlib/urllib/request.pyi @@ -4,7 +4,7 @@ from _typeshed import StrOrBytesPath from email.message import Message from http.client import HTTPMessage, HTTPResponse, _HTTPConnectionProtocol from http.cookiejar import CookieJar -from typing import IO, Any, Callable, ClassVar, Dict, List, Mapping, NoReturn, Pattern, Sequence, Tuple, TypeVar, overload +from typing import IO, Any, Callable, ClassVar, Mapping, NoReturn, Pattern, Sequence, Tuple, TypeVar, overload from urllib.error import HTTPError from urllib.response import addclosehook, addinfourl @@ -30,9 +30,9 @@ else: def url2pathname(pathname: str) -> str: ... def pathname2url(pathname: str) -> str: ... -def getproxies() -> Dict[str, str]: ... -def parse_http_list(s: str) -> List[str]: ... -def parse_keqv_list(l: List[str]) -> Dict[str, str]: ... +def getproxies() -> dict[str, str]: ... +def parse_http_list(s: str) -> list[str]: ... +def parse_keqv_list(l: list[str]) -> dict[str, str]: ... if sys.platform == "win32" or sys.platform == "darwin": def proxy_bypass(host: str) -> Any: ... # undocumented @@ -52,8 +52,8 @@ class Request: origin_req_host: str selector: str data: bytes | None - headers: Dict[str, str] - unredirected_hdrs: Dict[str, str] + headers: dict[str, str] + unredirected_hdrs: dict[str, str] unverifiable: bool method: str | None timeout: float | None # Undocumented, only set after __init__() by OpenerDirector.open() @@ -61,7 +61,7 @@ class Request: self, url: str, data: bytes | None = ..., - headers: Dict[str, str] = ..., + headers: dict[str, str] = ..., origin_req_host: str | None = ..., unverifiable: bool = ..., method: str | None = ..., @@ -77,11 +77,11 @@ class Request: def get_header(self, header_name: str) -> str | None: ... @overload def get_header(self, header_name: str, default: _T) -> str | _T: ... - def header_items(self) -> List[Tuple[str, str]]: ... + def header_items(self) -> list[Tuple[str, str]]: ... def has_proxy(self) -> bool: ... class OpenerDirector: - addheaders: List[Tuple[str, str]] + addheaders: list[Tuple[str, str]] def add_handler(self, handler: BaseHandler) -> None: ... def open(self, fullurl: str | Request, data: bytes | None = ..., timeout: float | None = ...) -> _UrlopenRet: ... def error(self, proto: str, *args: Any) -> _UrlopenRet: ... @@ -119,7 +119,7 @@ class HTTPCookieProcessor(BaseHandler): def https_response(self, request: Request, response: HTTPResponse) -> HTTPResponse: ... # undocumented class ProxyHandler(BaseHandler): - def __init__(self, proxies: Dict[str, str] | None = ...) -> None: ... + def __init__(self, proxies: dict[str, str] | None = ...) -> None: ... def proxy_open(self, req: Request, proxy: str, type: str) -> _UrlopenRet | None: ... # undocumented # TODO add a method for every (common) proxy protocol @@ -247,7 +247,7 @@ def urlcleanup() -> None: ... class URLopener: version: ClassVar[str] - def __init__(self, proxies: Dict[str, str] | None = ..., **x509: str) -> None: ... + def __init__(self, proxies: dict[str, str] | None = ..., **x509: str) -> None: ... def open(self, fullurl: str, data: bytes | None = ...) -> _UrlopenRet: ... def open_unknown(self, fullurl: str, data: bytes | None = ...) -> _UrlopenRet: ... def retrieve( diff --git a/stdlib/urllib/response.pyi b/stdlib/urllib/response.pyi index fef25068ed33..dd8a80833ba3 100644 --- a/stdlib/urllib/response.pyi +++ b/stdlib/urllib/response.pyi @@ -1,7 +1,7 @@ from _typeshed import Self from email.message import Message from types import TracebackType -from typing import IO, Any, BinaryIO, Callable, Iterable, List, Tuple, Type, TypeVar +from typing import IO, Any, BinaryIO, Callable, Iterable, Tuple, Type, TypeVar _AIUT = TypeVar("_AIUT", bound=addbase) @@ -25,7 +25,7 @@ class addbase(BinaryIO): def read(self, n: int = ...) -> bytes: ... def readable(self) -> bool: ... def readline(self, limit: int = ...) -> bytes: ... - def readlines(self, hint: int = ...) -> List[bytes]: ... + def readlines(self, hint: int = ...) -> list[bytes]: ... def seek(self, offset: int, whence: int = ...) -> int: ... def seekable(self) -> bool: ... def tell(self) -> int: ... diff --git a/stdlib/urllib/robotparser.pyi b/stdlib/urllib/robotparser.pyi index 1dcf5f6fc933..361126327993 100644 --- a/stdlib/urllib/robotparser.pyi +++ b/stdlib/urllib/robotparser.pyi @@ -1,5 +1,5 @@ import sys -from typing import Iterable, List, NamedTuple +from typing import Iterable, NamedTuple class _RequestRate(NamedTuple): requests: int @@ -16,4 +16,4 @@ class RobotFileParser: def crawl_delay(self, useragent: str) -> str | None: ... def request_rate(self, useragent: str) -> _RequestRate | None: ... if sys.version_info >= (3, 8): - def site_maps(self) -> List[str] | None: ... + def site_maps(self) -> list[str] | None: ... diff --git a/stdlib/warnings.pyi b/stdlib/warnings.pyi index a612146b1399..514bea3a225d 100644 --- a/stdlib/warnings.pyi +++ b/stdlib/warnings.pyi @@ -1,5 +1,5 @@ from types import ModuleType, TracebackType -from typing import Any, List, TextIO, Type, overload +from typing import Any, TextIO, Type, overload from typing_extensions import Literal from _warnings import warn as warn, warn_explicit as warn_explicit @@ -42,7 +42,7 @@ class catch_warnings: def __new__(cls, *, record: Literal[True], module: ModuleType | None = ...) -> _catch_warnings_with_records: ... @overload def __new__(cls, *, record: bool, module: ModuleType | None = ...) -> catch_warnings: ... - def __enter__(self) -> List[WarningMessage] | None: ... + def __enter__(self) -> list[WarningMessage] | None: ... def __exit__( self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... @@ -51,4 +51,4 @@ class _catch_warnings_without_records(catch_warnings): def __enter__(self) -> None: ... class _catch_warnings_with_records(catch_warnings): - def __enter__(self) -> List[WarningMessage]: ... + def __enter__(self) -> list[WarningMessage]: ... diff --git a/stdlib/weakref.pyi b/stdlib/weakref.pyi index f2458c484dc2..12158ee6c8f4 100644 --- a/stdlib/weakref.pyi +++ b/stdlib/weakref.pyi @@ -1,6 +1,6 @@ import types from _weakrefset import WeakSet as WeakSet -from typing import Any, Callable, Dict, Generic, Iterable, Iterator, List, Mapping, MutableMapping, Tuple, Type, TypeVar, overload +from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, MutableMapping, Tuple, Type, TypeVar, overload from _weakref import ( CallableProxyType as CallableProxyType, @@ -41,7 +41,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): def values(self) -> Iterator[_VT]: ... # type: ignore def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ... - def valuerefs(self) -> List[KeyedRef[_KT, _VT]]: ... + def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: ... class KeyedRef(ref[_T], Generic[_KT, _T]): key: _KT @@ -66,12 +66,12 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): def keys(self) -> Iterator[_KT]: ... # type: ignore def values(self) -> Iterator[_VT]: ... # type: ignore def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore - def keyrefs(self) -> List[ref[_KT]]: ... + def keyrefs(self) -> list[ref[_KT]]: ... class finalize: def __init__(self, __obj: object, __func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... def __call__(self, _: Any = ...) -> Any | None: ... - def detach(self) -> Tuple[Any, Any, Tuple[Any, ...], Dict[str, Any]] | None: ... - def peek(self) -> Tuple[Any, Any, Tuple[Any, ...], Dict[str, Any]] | None: ... + def detach(self) -> Tuple[Any, Any, Tuple[Any, ...], dict[str, Any]] | None: ... + def peek(self) -> Tuple[Any, Any, Tuple[Any, ...], dict[str, Any]] | None: ... alive: bool atexit: bool diff --git a/stdlib/webbrowser.pyi b/stdlib/webbrowser.pyi index 8ef1c042b2a0..c85288cc562f 100644 --- a/stdlib/webbrowser.pyi +++ b/stdlib/webbrowser.pyi @@ -1,5 +1,5 @@ import sys -from typing import Callable, List, Sequence +from typing import Callable, Sequence class Error(Exception): ... @@ -19,7 +19,7 @@ def open_new(url: str) -> bool: ... def open_new_tab(url: str) -> bool: ... class BaseBrowser: - args: List[str] + args: list[str] name: str basename: str def __init__(self, name: str = ...) -> None: ... @@ -28,7 +28,7 @@ class BaseBrowser: def open_new_tab(self, url: str) -> bool: ... class GenericBrowser(BaseBrowser): - args: List[str] + args: list[str] name: str basename: str def __init__(self, name: str | Sequence[str]) -> None: ... @@ -38,45 +38,45 @@ class BackgroundBrowser(GenericBrowser): def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... class UnixBrowser(BaseBrowser): - raise_opts: List[str] | None + raise_opts: list[str] | None background: bool redirect_stdout: bool - remote_args: List[str] + remote_args: list[str] remote_action: str remote_action_newwin: str remote_action_newtab: str def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... class Mozilla(UnixBrowser): - remote_args: List[str] + remote_args: list[str] remote_action: str remote_action_newwin: str remote_action_newtab: str background: bool class Galeon(UnixBrowser): - raise_opts: List[str] - remote_args: List[str] + raise_opts: list[str] + remote_args: list[str] remote_action: str remote_action_newwin: str background: bool class Chrome(UnixBrowser): - remote_args: List[str] + remote_args: list[str] remote_action: str remote_action_newwin: str remote_action_newtab: str background: bool class Opera(UnixBrowser): - remote_args: List[str] + remote_args: list[str] remote_action: str remote_action_newwin: str remote_action_newtab: str background: bool class Elinks(UnixBrowser): - remote_args: List[str] + remote_args: list[str] remote_action: str remote_action_newwin: str remote_action_newtab: str diff --git a/stdlib/wsgiref/handlers.pyi b/stdlib/wsgiref/handlers.pyi index e05af4709148..b9899389cd3b 100644 --- a/stdlib/wsgiref/handlers.pyi +++ b/stdlib/wsgiref/handlers.pyi @@ -1,6 +1,6 @@ from abc import abstractmethod from types import TracebackType -from typing import IO, Callable, Dict, List, MutableMapping, Optional, Tuple, Type +from typing import IO, Callable, MutableMapping, Optional, Tuple, Type from .headers import Headers from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment @@ -9,7 +9,7 @@ from .util import FileWrapper _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]: ... +def read_environ() -> dict[str, str]: ... class BaseHandler: wsgi_version: Tuple[int, int] # undocumented @@ -28,7 +28,7 @@ class BaseHandler: traceback_limit: int | None error_status: str - error_headers: List[Tuple[str, str]] + error_headers: list[Tuple[str, str]] error_body: bytes def run(self, application: WSGIApplication) -> None: ... def setup_environ(self) -> None: ... @@ -37,7 +37,7 @@ class BaseHandler: def set_content_length(self) -> None: ... def cleanup_headers(self) -> None: ... def start_response( - self, status: str, headers: List[Tuple[str, str]], exc_info: _exc_info | None = ... + self, status: str, headers: list[Tuple[str, str]], exc_info: _exc_info | None = ... ) -> Callable[[bytes], None]: ... def send_preamble(self) -> None: ... def write(self, data: bytes) -> None: ... @@ -49,7 +49,7 @@ class BaseHandler: def client_is_modern(self) -> bool: ... def log_exception(self, exc_info: _exc_info) -> None: ... def handle_error(self) -> None: ... - def error_output(self, environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ... + def error_output(self, environ: WSGIEnvironment, start_response: StartResponse) -> list[bytes]: ... @abstractmethod def _write(self, data: bytes) -> None: ... @abstractmethod diff --git a/stdlib/wsgiref/headers.pyi b/stdlib/wsgiref/headers.pyi index 43404488b8dc..531a521d3824 100644 --- a/stdlib/wsgiref/headers.pyi +++ b/stdlib/wsgiref/headers.pyi @@ -11,13 +11,13 @@ class Headers: def __delitem__(self, name: str) -> None: ... def __getitem__(self, name: str) -> str | None: ... def __contains__(self, name: str) -> bool: ... - def get_all(self, name: str) -> List[str]: ... + def get_all(self, name: str) -> list[str]: ... @overload def get(self, name: str, default: str) -> str: ... @overload def get(self, name: str, default: str | None = ...) -> str | None: ... - def keys(self) -> List[str]: ... - def values(self) -> List[str]: ... + def keys(self) -> list[str]: ... + def values(self) -> list[str]: ... def items(self) -> _HeaderList: ... def __bytes__(self) -> bytes: ... def setdefault(self, name: str, value: str) -> str: ... diff --git a/stdlib/wsgiref/simple_server.pyi b/stdlib/wsgiref/simple_server.pyi index 3849f6d4987b..76d0b269793d 100644 --- a/stdlib/wsgiref/simple_server.pyi +++ b/stdlib/wsgiref/simple_server.pyi @@ -1,5 +1,5 @@ from http.server import BaseHTTPRequestHandler, HTTPServer -from typing import List, Type, TypeVar, overload +from typing import Type, TypeVar, overload from .handlers import SimpleHandler from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment @@ -25,7 +25,7 @@ class WSGIRequestHandler(BaseHTTPRequestHandler): def get_stderr(self) -> ErrorStream: ... def handle(self) -> None: ... -def demo_app(environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ... +def demo_app(environ: WSGIEnvironment, start_response: StartResponse) -> list[bytes]: ... _S = TypeVar("_S", bound=WSGIServer) diff --git a/stdlib/xdrlib.pyi b/stdlib/xdrlib.pyi index 378504c37227..f59843f8ee9d 100644 --- a/stdlib/xdrlib.pyi +++ b/stdlib/xdrlib.pyi @@ -1,4 +1,4 @@ -from typing import Callable, List, Sequence, TypeVar +from typing import Callable, Sequence, TypeVar _T = TypeVar("_T") @@ -50,6 +50,6 @@ class Unpacker: def unpack_string(self) -> bytes: ... def unpack_opaque(self) -> bytes: ... def unpack_bytes(self) -> bytes: ... - def unpack_list(self, unpack_item: Callable[[], _T]) -> List[_T]: ... - def unpack_farray(self, n: int, unpack_item: Callable[[], _T]) -> List[_T]: ... - def unpack_array(self, unpack_item: Callable[[], _T]) -> List[_T]: ... + def unpack_list(self, unpack_item: Callable[[], _T]) -> list[_T]: ... + def unpack_farray(self, n: int, unpack_item: Callable[[], _T]) -> list[_T]: ... + def unpack_array(self, unpack_item: Callable[[], _T]) -> list[_T]: ... diff --git a/stdlib/xml/dom/domreg.pyi b/stdlib/xml/dom/domreg.pyi index 2496b3884ea1..64c18ae80f0c 100644 --- a/stdlib/xml/dom/domreg.pyi +++ b/stdlib/xml/dom/domreg.pyi @@ -1,8 +1,8 @@ from _typeshed.xml import DOMImplementation -from typing import Callable, Dict, Iterable, Tuple +from typing import Callable, Iterable, Tuple -well_known_implementations: Dict[str, str] -registered: Dict[str, Callable[[], DOMImplementation]] +well_known_implementations: dict[str, str] +registered: dict[str, Callable[[], DOMImplementation]] def registerDOMImplementation(name: str, factory: Callable[[], DOMImplementation]) -> None: ... def getDOMImplementation(name: str | None = ..., features: str | Iterable[Tuple[str, str | None]] = ...) -> DOMImplementation: ... diff --git a/stdlib/xml/etree/ElementPath.pyi b/stdlib/xml/etree/ElementPath.pyi index 02fe84567543..db4bd6a4e958 100644 --- a/stdlib/xml/etree/ElementPath.pyi +++ b/stdlib/xml/etree/ElementPath.pyi @@ -1,4 +1,4 @@ -from typing import Callable, Dict, Generator, List, Pattern, Tuple, TypeVar +from typing import Callable, Generator, List, Pattern, Tuple, TypeVar from xml.etree.ElementTree import Element xpath_tokenizer_re: Pattern[str] @@ -7,8 +7,8 @@ _token = Tuple[str, str] _next = Callable[[], _token] _callback = Callable[[_SelectorContext, List[Element]], Generator[Element, None, None]] -def xpath_tokenizer(pattern: str, namespaces: Dict[str, str] | None = ...) -> Generator[_token, None, None]: ... -def get_parent_map(context: _SelectorContext) -> Dict[Element, Element]: ... +def xpath_tokenizer(pattern: str, namespaces: dict[str, str] | None = ...) -> Generator[_token, None, None]: ... +def get_parent_map(context: _SelectorContext) -> dict[Element, Element]: ... def prepare_child(next: _next, token: _token) -> _callback: ... def prepare_star(next: _next, token: _token) -> _callback: ... def prepare_self(next: _next, token: _token) -> _callback: ... @@ -16,16 +16,16 @@ def prepare_descendant(next: _next, token: _token) -> _callback: ... def prepare_parent(next: _next, token: _token) -> _callback: ... def prepare_predicate(next: _next, token: _token) -> _callback: ... -ops: Dict[str, Callable[[_next, _token], _callback]] +ops: dict[str, Callable[[_next, _token], _callback]] class _SelectorContext: - parent_map: Dict[Element, Element] | None + parent_map: dict[Element, Element] | None root: Element def __init__(self, root: Element) -> None: ... _T = TypeVar("_T") -def iterfind(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> Generator[Element, None, None]: ... -def find(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> Element | None: ... -def findall(elem: Element, path: str, namespaces: Dict[str, str] | None = ...) -> List[Element]: ... -def findtext(elem: Element, path: str, default: _T | None = ..., namespaces: Dict[str, str] | None = ...) -> _T | str: ... +def iterfind(elem: Element, path: str, namespaces: dict[str, str] | None = ...) -> Generator[Element, None, None]: ... +def find(elem: Element, path: str, namespaces: dict[str, str] | None = ...) -> Element | None: ... +def findall(elem: Element, path: str, namespaces: dict[str, str] | None = ...) -> list[Element]: ... +def findtext(elem: Element, path: str, default: _T | None = ..., namespaces: dict[str, str] | None = ...) -> _T | str: ... diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index d863e38d3aca..b9ecf52edf58 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -10,7 +10,6 @@ from typing import ( Iterable, Iterator, KeysView, - List, MutableSequence, Sequence, Tuple, @@ -63,19 +62,19 @@ if sys.version_info >= (3, 8): class Element(MutableSequence[Element]): tag: str - attrib: Dict[str, str] + attrib: dict[str, str] text: str | None tail: str | None - def __init__(self, tag: str | Callable[..., Element], attrib: Dict[str, str] = ..., **extra: str) -> None: ... + def __init__(self, tag: str | Callable[..., Element], attrib: dict[str, str] = ..., **extra: str) -> None: ... def append(self, __subelement: Element) -> None: ... def clear(self) -> None: ... def extend(self, __elements: Iterable[Element]) -> None: ... - def find(self, path: str, namespaces: Dict[str, str] | None = ...) -> Element | None: ... - def findall(self, path: str, namespaces: Dict[str, str] | None = ...) -> List[Element]: ... + def find(self, path: str, namespaces: dict[str, str] | None = ...) -> Element | None: ... + def findall(self, path: str, namespaces: dict[str, str] | None = ...) -> list[Element]: ... @overload - def findtext(self, path: str, default: None = ..., namespaces: Dict[str, str] | None = ...) -> str | None: ... + def findtext(self, path: str, default: None = ..., namespaces: dict[str, str] | None = ...) -> str | None: ... @overload - def findtext(self, path: str, default: _T, namespaces: Dict[str, str] | None = ...) -> _T | str: ... + def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = ...) -> _T | str: ... @overload def get(self, key: str, default: None = ...) -> str | None: ... @overload @@ -83,10 +82,10 @@ class Element(MutableSequence[Element]): def insert(self, __index: int, __subelement: Element) -> None: ... def items(self) -> ItemsView[str, str]: ... def iter(self, tag: str | None = ...) -> Generator[Element, None, None]: ... - def iterfind(self, path: str, namespaces: Dict[str, str] | None = ...) -> Generator[Element, None, None]: ... + def iterfind(self, path: str, namespaces: dict[str, str] | None = ...) -> Generator[Element, None, None]: ... def itertext(self) -> Generator[str, None, None]: ... def keys(self) -> KeysView[str]: ... - def makeelement(self, __tag: str, __attrib: Dict[str, str]) -> Element: ... + def makeelement(self, __tag: str, __attrib: dict[str, str]) -> Element: ... def remove(self, __subelement: Element) -> None: ... def set(self, __key: str, __value: str) -> None: ... def __delitem__(self, i: int | slice) -> None: ... @@ -100,10 +99,10 @@ class Element(MutableSequence[Element]): @overload def __setitem__(self, s: slice, o: Iterable[Element]) -> None: ... if sys.version_info < (3, 9): - def getchildren(self) -> List[Element]: ... - def getiterator(self, tag: str | None = ...) -> List[Element]: ... + def getchildren(self) -> list[Element]: ... + def getiterator(self, tag: str | None = ...) -> list[Element]: ... -def SubElement(parent: Element, tag: str, attrib: Dict[str, str] = ..., **extra: str) -> Element: ... +def SubElement(parent: Element, tag: str, attrib: dict[str, str] = ..., **extra: str) -> Element: ... def Comment(text: str | None = ...) -> Element: ... def ProcessingInstruction(target: str, text: str | None = ...) -> Element: ... @@ -119,14 +118,14 @@ class ElementTree: def parse(self, source: _File, parser: XMLParser | None = ...) -> Element: ... def iter(self, tag: str | None = ...) -> Generator[Element, None, None]: ... if sys.version_info < (3, 9): - def getiterator(self, tag: str | None = ...) -> List[Element]: ... - def find(self, path: str, namespaces: Dict[str, str] | None = ...) -> Element | None: ... + def getiterator(self, tag: str | None = ...) -> list[Element]: ... + def find(self, path: str, namespaces: dict[str, str] | None = ...) -> Element | None: ... @overload - def findtext(self, path: str, default: None = ..., namespaces: Dict[str, str] | None = ...) -> str | None: ... + def findtext(self, path: str, default: None = ..., namespaces: dict[str, str] | None = ...) -> str | None: ... @overload - def findtext(self, path: str, default: _T, namespaces: Dict[str, str] | None = ...) -> _T | str: ... - def findall(self, path: str, namespaces: Dict[str, str] | None = ...) -> List[Element]: ... - def iterfind(self, path: str, namespaces: Dict[str, str] | None = ...) -> Generator[Element, None, None]: ... + def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = ...) -> _T | str: ... + def findall(self, path: str, namespaces: dict[str, str] | None = ...) -> list[Element]: ... + def iterfind(self, path: str, namespaces: dict[str, str] | None = ...) -> Generator[Element, None, None]: ... def write( self, file_or_filename: _File, @@ -181,7 +180,7 @@ if sys.version_info >= (3, 8): xml_declaration: bool | None = ..., default_namespace: str | None = ..., short_empty_elements: bool = ..., - ) -> List[bytes]: ... + ) -> list[bytes]: ... @overload def tostringlist( element: Element, @@ -191,7 +190,7 @@ if sys.version_info >= (3, 8): xml_declaration: bool | None = ..., default_namespace: str | None = ..., short_empty_elements: bool = ..., - ) -> List[str]: ... + ) -> list[str]: ... @overload def tostringlist( element: Element, @@ -201,7 +200,7 @@ if sys.version_info >= (3, 8): xml_declaration: bool | None = ..., default_namespace: str | None = ..., short_empty_elements: bool = ..., - ) -> List[Any]: ... + ) -> list[Any]: ... else: @overload @@ -217,15 +216,15 @@ else: @overload def tostringlist( element: Element, encoding: None = ..., method: str | None = ..., *, short_empty_elements: bool = ... - ) -> List[bytes]: ... + ) -> list[bytes]: ... @overload def tostringlist( element: Element, encoding: Literal["unicode"], method: str | None = ..., *, short_empty_elements: bool = ... - ) -> List[str]: ... + ) -> list[str]: ... @overload def tostringlist( element: Element, encoding: str, method: str | None = ..., *, short_empty_elements: bool = ... - ) -> List[Any]: ... + ) -> list[Any]: ... def dump(elem: Element) -> None: ... @@ -242,7 +241,7 @@ class XMLPullParser: def read_events(self) -> Iterator[Tuple[str, Element]]: ... def XML(text: str | bytes, parser: XMLParser | None = ...) -> Element: ... -def XMLID(text: str | bytes, parser: XMLParser | None = ...) -> Tuple[Element, Dict[str, Element]]: ... +def XMLID(text: str | bytes, parser: XMLParser | None = ...) -> Tuple[Element, dict[str, Element]]: ... # This is aliased to XML in the source. fromstring = XML @@ -264,7 +263,7 @@ class TreeBuilder: def __init__(self, element_factory: _ElementFactory | None = ...) -> None: ... def close(self) -> Element: ... def data(self, __data: str | bytes) -> None: ... - def start(self, __tag: str | bytes, __attrs: Dict[str | bytes, str | bytes]) -> Element: ... + def start(self, __tag: str | bytes, __attrs: dict[str | bytes, str | bytes]) -> Element: ... def end(self, __tag: str | bytes) -> Element: ... if sys.version_info >= (3, 8): diff --git a/stdlib/xml/sax/__init__.pyi b/stdlib/xml/sax/__init__.pyi index 8d3a17d64842..a123e7e894e2 100644 --- a/stdlib/xml/sax/__init__.pyi +++ b/stdlib/xml/sax/__init__.pyi @@ -1,5 +1,5 @@ import sys -from typing import IO, Any, Iterable, List, NoReturn +from typing import IO, Any, Iterable, NoReturn from xml.sax.handler import ContentHandler, ErrorHandler from xml.sax.xmlreader import Locator, XMLReader @@ -20,13 +20,13 @@ class SAXNotRecognizedException(SAXException): ... class SAXNotSupportedException(SAXException): ... class SAXReaderNotAvailable(SAXNotSupportedException): ... -default_parser_list: List[str] +default_parser_list: list[str] if sys.version_info >= (3, 8): def make_parser(parser_list: Iterable[str] = ...) -> XMLReader: ... else: - def make_parser(parser_list: List[str] = ...) -> XMLReader: ... + def make_parser(parser_list: list[str] = ...) -> XMLReader: ... def parse(source: str | IO[str] | IO[bytes], handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ... def parseString(string: bytes | str, handler: ContentHandler, errorHandler: ErrorHandler | None = ...) -> None: ... diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index 7d0f2f9782ee..1ed68c71b9a6 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -43,8 +43,8 @@ class ProtocolError(Error): url: str errcode: int errmsg: str - headers: Dict[str, str] - def __init__(self, url: str, errcode: int, errmsg: str, headers: Dict[str, str]) -> None: ... + headers: dict[str, str] + def __init__(self, url: str, errcode: int, errmsg: str, headers: dict[str, str]) -> None: ... class ResponseError(Error): ... @@ -95,11 +95,11 @@ class ExpatParser: # undocumented class Marshaller: - dispatch: Dict[ + dispatch: dict[ Type[Any], Callable[[Marshaller, Any, Callable[[str], Any]], None] ] = ... # TODO: Replace 'Any' with some kind of binding - memo: Dict[Any, None] + memo: dict[Any, None] data: None encoding: str | None allow_none: bool @@ -122,12 +122,12 @@ class Marshaller: class Unmarshaller: - dispatch: Dict[str, Callable[[Unmarshaller, str], None]] = ... + dispatch: dict[str, Callable[[Unmarshaller, str], None]] = ... _type: str | None - _stack: List[_Marshallable] - _marks: List[int] - _data: List[str] + _stack: list[_Marshallable] + _marks: list[int] + _data: list[str] _value: bool _methodname: str | None _encoding: str @@ -138,7 +138,7 @@ class Unmarshaller: def close(self) -> Tuple[_Marshallable, ...]: ... def getmethodname(self) -> str | None: ... def xml(self, encoding: str, standalone: Any) -> None: ... # Standalone is ignored - def start(self, tag: str, attrs: Dict[str, str]) -> None: ... + def start(self, tag: str, attrs: dict[str, str]) -> None: ... def data(self, text: str) -> None: ... def end(self, tag: str) -> None: ... def end_dispatch(self, tag: str, data: str) -> None: ... @@ -159,22 +159,22 @@ class Unmarshaller: class _MultiCallMethod: # undocumented - __call_list: List[Tuple[str, Tuple[_Marshallable, ...]]] + __call_list: list[Tuple[str, Tuple[_Marshallable, ...]]] __name: str - def __init__(self, call_list: List[Tuple[str, _Marshallable]], name: str) -> None: ... + def __init__(self, call_list: list[Tuple[str, _Marshallable]], name: str) -> None: ... def __getattr__(self, name: str) -> _MultiCallMethod: ... def __call__(self, *args: _Marshallable) -> None: ... class MultiCallIterator: # undocumented - results: List[List[_Marshallable]] - def __init__(self, results: List[List[_Marshallable]]) -> None: ... + results: list[list[_Marshallable]] + def __init__(self, results: list[list[_Marshallable]]) -> None: ... def __getitem__(self, i: int) -> _Marshallable: ... class MultiCall: __server: ServerProxy - __call_list: List[Tuple[str, Tuple[_Marshallable, ...]]] + __call_list: list[Tuple[str, Tuple[_Marshallable, ...]]] def __init__(self, server: ServerProxy) -> None: ... def __getattr__(self, item: str) -> _MultiCallMethod: ... def __call__(self) -> MultiCallIterator: ... @@ -219,8 +219,8 @@ class Transport: _use_datetime: bool _use_builtin_types: bool _connection: Tuple[_HostType | None, http.client.HTTPConnection | None] - _headers: List[Tuple[str, str]] - _extra_headers: List[Tuple[str, str]] + _headers: list[Tuple[str, str]] + _extra_headers: list[Tuple[str, str]] if sys.version_info >= (3, 8): def __init__( @@ -233,11 +233,11 @@ class Transport: self, host: _HostType, handler: str, request_body: bytes, verbose: bool = ... ) -> Tuple[_Marshallable, ...]: ... def getparser(self) -> Tuple[ExpatParser, Unmarshaller]: ... - def get_host_info(self, host: _HostType) -> Tuple[str, List[Tuple[str, str]], Dict[str, str]]: ... + def get_host_info(self, host: _HostType) -> Tuple[str, list[Tuple[str, str]], dict[str, str]]: ... def make_connection(self, host: _HostType) -> http.client.HTTPConnection: ... def close(self) -> None: ... def send_request(self, host: _HostType, handler: str, request_body: bytes, debug: bool) -> http.client.HTTPConnection: ... - def send_headers(self, connection: http.client.HTTPConnection, headers: List[Tuple[str, str]]) -> None: ... + def send_headers(self, connection: http.client.HTTPConnection, headers: list[Tuple[str, str]]) -> None: ... def send_content(self, connection: http.client.HTTPConnection, request_body: bytes) -> None: ... def parse_response(self, response: http.client.HTTPResponse) -> Tuple[_Marshallable, ...]: ... diff --git a/stdlib/zipfile.pyi b/stdlib/zipfile.pyi index 42bd4ed45f0a..db71dcbefcd2 100644 --- a/stdlib/zipfile.pyi +++ b/stdlib/zipfile.pyi @@ -2,7 +2,7 @@ import io import sys from _typeshed import Self, StrPath from types import TracebackType -from typing import IO, Callable, Dict, Iterable, Iterator, List, Protocol, Sequence, Tuple, Type, overload +from typing import IO, Callable, Iterable, Iterator, Protocol, Sequence, Tuple, Type, overload from typing_extensions import Literal _DateTuple = Tuple[int, int, int, int, int, int] @@ -32,7 +32,7 @@ class ZipExtFile(io.BufferedIOBase): if sys.version_info >= (3, 7): MAX_SEEK_READ: int = ... - newlines: List[bytes] | None + newlines: list[bytes] | None mode: str name: str if sys.version_info >= (3, 7): @@ -96,9 +96,9 @@ class ZipFile: filename: str | None debug: int comment: bytes - filelist: List[ZipInfo] + filelist: list[ZipInfo] fp: IO[bytes] | None - NameToInfo: Dict[str, ZipInfo] + NameToInfo: dict[str, ZipInfo] start_dir: int # undocumented compression: int # undocumented compresslevel: int | None # undocumented @@ -134,8 +134,8 @@ class ZipFile: ) -> None: ... def close(self) -> None: ... def getinfo(self, name: str) -> ZipInfo: ... - def infolist(self) -> List[ZipInfo]: ... - def namelist(self) -> List[str]: ... + def infolist(self) -> list[ZipInfo]: ... + def namelist(self) -> list[str]: ... def open( self, name: str | ZipInfo, mode: Literal["r", "w"] = ..., pwd: bytes | None = ..., *, force_zip64: bool = ... ) -> IO[bytes]: ... diff --git a/stdlib/zipimport.pyi b/stdlib/zipimport.pyi index a83a8793ccac..8ca97bf69845 100644 --- a/stdlib/zipimport.pyi +++ b/stdlib/zipimport.pyi @@ -1,7 +1,7 @@ import os import sys from types import CodeType, ModuleType -from typing import Any, List, Tuple +from typing import Any, Tuple if sys.version_info >= (3, 7): from importlib.abc import ResourceReader @@ -12,7 +12,7 @@ class zipimporter(object): archive: str prefix: str def __init__(self, path: str | bytes | os.PathLike[Any]) -> None: ... - def find_loader(self, fullname: str, path: str | None = ...) -> Tuple[zipimporter | None, List[str]]: ... # undocumented + def find_loader(self, fullname: str, path: str | None = ...) -> Tuple[zipimporter | None, list[str]]: ... # undocumented def find_module(self, fullname: str, path: str | None = ...) -> zipimporter | None: ... def get_code(self, fullname: str) -> CodeType: ... def get_data(self, pathname: str) -> str: ... diff --git a/stubs/Flask/flask/app.pyi b/stubs/Flask/flask/app.pyi index e6ffec0cec83..9469bbbb981e 100644 --- a/stubs/Flask/flask/app.pyi +++ b/stubs/Flask/flask/app.pyi @@ -71,11 +71,11 @@ class Flask(_PackageBoundObject): view_functions: Any = ... error_handler_spec: Any = ... url_build_error_handlers: Any = ... - before_request_funcs: Dict[str | None, List[Callable[[], Any]]] = ... - before_first_request_funcs: List[Callable[[], None]] = ... - after_request_funcs: Dict[str | None, List[Callable[[Response], Response]]] = ... - teardown_request_funcs: Dict[str | None, List[Callable[[Exception | None], Any]]] = ... - teardown_appcontext_funcs: List[Callable[[Exception | None], Any]] = ... + before_request_funcs: dict[str | None, list[Callable[[], Any]]] = ... + before_first_request_funcs: list[Callable[[], None]] = ... + after_request_funcs: dict[str | None, list[Callable[[Response], Response]]] = ... + teardown_request_funcs: dict[str | None, list[Callable[[Exception | None], Any]]] = ... + teardown_appcontext_funcs: list[Callable[[Exception | None], Any]] = ... url_value_preprocessors: Any = ... url_default_functions: Any = ... template_context_processors: Any = ... diff --git a/stubs/Flask/flask/wrappers.pyi b/stubs/Flask/flask/wrappers.pyi index 67a64910f03d..e5a428655647 100644 --- a/stubs/Flask/flask/wrappers.pyi +++ b/stubs/Flask/flask/wrappers.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict +from typing import Any from werkzeug.exceptions import HTTPException from werkzeug.routing import Rule @@ -14,7 +14,7 @@ class JSONMixin: class Request(RequestBase, JSONMixin): url_rule: Rule | None = ... - view_args: Dict[str, Any] = ... + view_args: dict[str, Any] = ... routing_exception: HTTPException | None = ... # Request is making the max_content_length readonly, where it was not the # case in its supertype. diff --git a/stubs/JACK-Client/jack/__init__.pyi b/stubs/JACK-Client/jack/__init__.pyi index 020d48dfef7f..7ce4d21b61c3 100644 --- a/stubs/JACK-Client/jack/__init__.pyi +++ b/stubs/JACK-Client/jack/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Generator, Iterable, Iterator, List, Sequence, Tuple, overload +from typing import Any, Callable, Generator, Iterable, Iterator, Sequence, Tuple, overload _NDArray = Any # FIXME: no typings for numpy arrays @@ -94,7 +94,7 @@ class Client: @transport_frame.setter def transport_frame(self, frame: int) -> None: ... def transport_locate(self, frame: int) -> None: ... - def transport_query(self) -> Tuple[TransportState, Dict[str, Any]]: ... + def transport_query(self) -> Tuple[TransportState, dict[str, Any]]: ... def transport_query_struct(self) -> Tuple[TransportState, _JackPositionT]: ... def transport_reposition_struct(self, position: _JackPositionT) -> None: ... # TODO def set_sync_timeout(self, timeout: int) -> None: ... @@ -125,7 +125,7 @@ class Client: def get_uuid_for_client_name(self, name: str) -> str: ... def get_client_name_by_uuid(self, uuid: str) -> str: ... def get_port_by_name(self, name: str) -> Port: ... - def get_all_connections(self, port: Port) -> List[Port]: ... + def get_all_connections(self, port: Port) -> list[Port]: ... def get_ports( self, name_pattern: str = ..., @@ -136,7 +136,7 @@ class Client: is_physical: bool = ..., can_monitor: bool = ..., is_terminal: bool = ..., - ) -> List[Port]: ... + ) -> list[Port]: ... def set_property(self, subject: int | str, key: str, value: str | bytes, type: str = ...) -> None: ... def remove_property(self, subject: int | str, key: str) -> None: ... def remove_properties(self, subject: int | str) -> int: ... @@ -153,7 +153,7 @@ class Port: @shortname.setter def shortname(self, shortname: str) -> None: ... @property - def aliases(self) -> List[str]: ... + def aliases(self) -> list[str]: ... def set_alias(self, alias: str) -> None: ... def unset_alias(self, alias: str) -> None: ... @property @@ -180,7 +180,7 @@ class OwnPort(Port): @property def number_of_connections(self) -> int: ... @property - def connections(self) -> List[Port]: ... + def connections(self) -> list[Port]: ... def is_connected_to(self, port: str | Port) -> bool: ... def connect(self, port: str | Port) -> None: ... def disconnect(self, other: str | Port | None = ...) -> None: ... @@ -266,9 +266,9 @@ class TransportState: class CallbackExit(Exception): ... def get_property(subject: int | str, key: str) -> Tuple[bytes, str] | None: ... -def get_properties(subject: int | str) -> Dict[str, Tuple[bytes, str]]: ... -def get_all_properties() -> Dict[str, Dict[str, Tuple[bytes, str]]]: ... -def position2dict(pos: _JackPositionT) -> Dict[str, Any]: ... +def get_properties(subject: int | str) -> dict[str, Tuple[bytes, str]]: ... +def get_all_properties() -> dict[str, dict[str, Tuple[bytes, str]]]: ... +def position2dict(pos: _JackPositionT) -> dict[str, Any]: ... def version() -> Tuple[int, int, int, int]: ... def version_string() -> str: ... def client_name_size() -> int: ... diff --git a/stubs/Jinja2/jinja2/defaults.pyi b/stubs/Jinja2/jinja2/defaults.pyi index 052744024729..8ab2a32429a7 100644 --- a/stubs/Jinja2/jinja2/defaults.pyi +++ b/stubs/Jinja2/jinja2/defaults.pyi @@ -18,5 +18,5 @@ TRIM_BLOCKS: bool LSTRIP_BLOCKS: bool NEWLINE_SEQUENCE: str KEEP_TRAILING_NEWLINE: bool -DEFAULT_NAMESPACE: Dict[str, Any] +DEFAULT_NAMESPACE: dict[str, Any] DEFAULT_POLICIES = Dict[str, Any] diff --git a/stubs/Jinja2/jinja2/environment.pyi b/stubs/Jinja2/jinja2/environment.pyi index 3276a028d948..6633375b3c0d 100644 --- a/stubs/Jinja2/jinja2/environment.pyi +++ b/stubs/Jinja2/jinja2/environment.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Callable, Dict, Iterator, List, Sequence, Text, Type +from typing import Any, Callable, Iterator, Sequence, Text, Type from .bccache import BytecodeCache from .loaders import BaseLoader @@ -40,12 +40,12 @@ class Environment: autoescape: Any filters: Any tests: Any - globals: Dict[str, Any] + globals: dict[str, Any] loader: BaseLoader cache: Any bytecode_cache: BytecodeCache auto_reload: bool - extensions: List[Any] + extensions: list[Any] def __init__( self, block_start_string: Text = ..., @@ -60,7 +60,7 @@ class Environment: lstrip_blocks: bool = ..., newline_sequence: Text = ..., keep_trailing_newline: bool = ..., - extensions: List[Any] = ..., + extensions: list[Any] = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Callable[..., Any] | None = ..., @@ -85,7 +85,7 @@ class Environment: line_comment_prefix: Text = ..., trim_blocks: bool = ..., lstrip_blocks: bool = ..., - extensions: List[Any] = ..., + extensions: list[Any] = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Callable[..., Any] = ..., @@ -123,18 +123,18 @@ class Environment: def join_path(self, template: Template | Text, parent: Text) -> Text: ... def get_template(self, name: Template | Text, parent: Text | None = ..., globals: Any | None = ...) -> Template: ... def select_template( - self, names: Sequence[Template | Text], parent: Text | None = ..., globals: Dict[str, Any] | None = ... + self, names: Sequence[Template | Text], parent: Text | None = ..., globals: dict[str, Any] | None = ... ) -> Template: ... def get_or_select_template( self, template_name_or_list: Template | Text | Sequence[Template | Text], parent: Text | None = ..., - globals: Dict[str, Any] | None = ..., + globals: dict[str, Any] | None = ..., ) -> Template: ... def from_string( - self, source: Text, globals: Dict[str, Any] | None = ..., template_class: Type[Template] | None = ... + self, source: Text, globals: dict[str, Any] | None = ..., template_class: Type[Template] | None = ... ) -> Template: ... - def make_globals(self, d: Dict[str, Any] | None) -> Dict[str, Any]: ... + def make_globals(self, d: dict[str, Any] | None) -> dict[str, Any]: ... # Frequently added extensions are included here: # from InternationalizationExtension: def install_gettext_translations(self, translations: Any, newstyle: bool | None = ...): ... @@ -179,10 +179,10 @@ class Template: def stream(self, *args, **kwargs) -> TemplateStream: ... def generate(self, *args, **kwargs) -> Iterator[Text]: ... def new_context( - self, vars: Dict[str, Any] | None = ..., shared: bool = ..., locals: Dict[str, Any] | None = ... + self, vars: dict[str, Any] | None = ..., shared: bool = ..., locals: dict[str, Any] | None = ... ) -> Context: ... def make_module( - self, vars: Dict[str, Any] | None = ..., shared: bool = ..., locals: Dict[str, Any] | None = ... + self, vars: dict[str, Any] | None = ..., shared: bool = ..., locals: dict[str, Any] | None = ... ) -> Context: ... @property def module(self) -> Any: ... diff --git a/stubs/Jinja2/jinja2/loaders.pyi b/stubs/Jinja2/jinja2/loaders.pyi index 6c7cec4cb0d2..f707c6b3d1c6 100644 --- a/stubs/Jinja2/jinja2/loaders.pyi +++ b/stubs/Jinja2/jinja2/loaders.pyi @@ -1,6 +1,6 @@ import sys from types import ModuleType -from typing import Any, Callable, Iterable, List, Text, Tuple, Union +from typing import Any, Callable, Iterable, Text, Tuple, Union from .environment import Environment @@ -11,7 +11,7 @@ if sys.version_info >= (3, 7): else: _SearchPath = Union[Text, Iterable[Text]] -def split_template_path(template: Text) -> List[Text]: ... +def split_template_path(template: Text) -> list[Text]: ... class BaseLoader: has_source_access: bool diff --git a/stubs/Jinja2/jinja2/runtime.pyi b/stubs/Jinja2/jinja2/runtime.pyi index 782fd8c970f8..d97f2c289d11 100644 --- a/stubs/Jinja2/jinja2/runtime.pyi +++ b/stubs/Jinja2/jinja2/runtime.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Text +from typing import Any, Text from jinja2.environment import Environment from jinja2.exceptions import TemplateNotFound as TemplateNotFound, TemplateRuntimeError as TemplateRuntimeError @@ -15,15 +15,15 @@ class TemplateReference: def __getitem__(self, name): ... class Context: - parent: Context | Dict[str, Any] - vars: Dict[str, Any] + parent: Context | dict[str, Any] + vars: dict[str, Any] environment: Environment eval_ctx: Any exported_vars: Any name: Text - blocks: Dict[str, Any] + blocks: dict[str, Any] def __init__( - self, environment: Environment, parent: Context | Dict[str, Any], name: Text, blocks: Dict[str, Any] + self, environment: Environment, parent: Context | dict[str, Any], name: Text, blocks: dict[str, Any] ) -> None: ... def super(self, name, current): ... def get(self, key, default: Any | None = ...): ... diff --git a/stubs/Markdown/markdown/core.pyi b/stubs/Markdown/markdown/core.pyi index 76e45116a6a3..e43df00dfdb1 100644 --- a/stubs/Markdown/markdown/core.pyi +++ b/stubs/Markdown/markdown/core.pyi @@ -1,4 +1,4 @@ -from typing import Any, BinaryIO, Callable, ClassVar, Dict, List, Mapping, Sequence, Text, TextIO +from typing import Any, BinaryIO, Callable, ClassVar, Mapping, Sequence, Text, TextIO from typing_extensions import Literal from xml.etree.ElementTree import Element @@ -13,11 +13,11 @@ class Markdown: postprocessors: Registry parser: BlockParser htmlStash: HtmlStash - output_formats: ClassVar[Dict[Literal["xhtml", "html"], Callable[[Element], Text]]] + output_formats: ClassVar[dict[Literal["xhtml", "html"], Callable[[Element], Text]]] output_format: Literal["xhtml", "html"] serializer: Callable[[Element], Text] tab_length: int - block_level_elements: List[str] + block_level_elements: list[str] def __init__( self, *, diff --git a/stubs/Markdown/markdown/extensions/__init__.pyi b/stubs/Markdown/markdown/extensions/__init__.pyi index 11d3b305205b..88842b59b36e 100644 --- a/stubs/Markdown/markdown/extensions/__init__.pyi +++ b/stubs/Markdown/markdown/extensions/__init__.pyi @@ -1,13 +1,13 @@ -from typing import Any, Dict, List, Mapping, Tuple +from typing import Any, Mapping, Tuple from markdown.core import Markdown class Extension: - config: Mapping[str, List[Any]] = ... + config: Mapping[str, list[Any]] = ... def __init__(self, **kwargs: Any) -> None: ... def getConfig(self, key: str, default: Any = ...) -> Any: ... - def getConfigs(self) -> Dict[str, Any]: ... - def getConfigInfo(self) -> List[Tuple[str, str]]: ... + def getConfigs(self) -> dict[str, Any]: ... + def getConfigInfo(self) -> list[Tuple[str, str]]: ... def setConfig(self, key: str, value: Any) -> None: ... def setConfigs(self, items: Mapping[str, Any]) -> None: ... def extendMarkdown(self, md: Markdown) -> None: ... diff --git a/stubs/Markdown/markdown/extensions/codehilite.pyi b/stubs/Markdown/markdown/extensions/codehilite.pyi index 1f99ea3dc53d..b5a59106212f 100644 --- a/stubs/Markdown/markdown/extensions/codehilite.pyi +++ b/stubs/Markdown/markdown/extensions/codehilite.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict +from typing import Any from markdown.extensions import Extension from markdown.treeprocessors import Treeprocessor @@ -18,7 +18,7 @@ class CodeHilite: tab_length: Any hl_lines: Any use_pygments: Any - options: Dict[str, Any] + options: dict[str, Any] def __init__( self, src: Any | None = ..., diff --git a/stubs/Markdown/markdown/preprocessors.pyi b/stubs/Markdown/markdown/preprocessors.pyi index 35ff4e48e24e..e0ebac0bf684 100644 --- a/stubs/Markdown/markdown/preprocessors.pyi +++ b/stubs/Markdown/markdown/preprocessors.pyi @@ -1,11 +1,11 @@ -from typing import Any, List, Pattern +from typing import Any, Pattern from . import util def build_preprocessors(md, **kwargs): ... class Preprocessor(util.Processor): - def run(self, lines: List[str]) -> List[str]: ... + def run(self, lines: list[str]) -> list[str]: ... class NormalizeWhitespace(Preprocessor): ... diff --git a/stubs/MarkupSafe/markupsafe/_constants.pyi b/stubs/MarkupSafe/markupsafe/_constants.pyi index cd051158d7a1..81dc05effa1a 100644 --- a/stubs/MarkupSafe/markupsafe/_constants.pyi +++ b/stubs/MarkupSafe/markupsafe/_constants.pyi @@ -1,3 +1,3 @@ -from typing import Dict, Text +from typing import Text -HTML_ENTITIES: Dict[Text, int] +HTML_ENTITIES: dict[Text, int] diff --git a/stubs/PyMySQL/pymysql/err.pyi b/stubs/PyMySQL/pymysql/err.pyi index 1ef626361957..2a13b1d893df 100644 --- a/stubs/PyMySQL/pymysql/err.pyi +++ b/stubs/PyMySQL/pymysql/err.pyi @@ -1,5 +1,5 @@ import builtins -from typing import Dict, NoReturn, Type +from typing import NoReturn, Type from .constants import ER as ER @@ -15,6 +15,6 @@ class InternalError(DatabaseError): ... class ProgrammingError(DatabaseError): ... class NotSupportedError(DatabaseError): ... -error_map: Dict[int, Type[DatabaseError]] +error_map: dict[int, Type[DatabaseError]] def raise_mysql_exception(data) -> NoReturn: ... diff --git a/stubs/PyYAML/yaml/composer.pyi b/stubs/PyYAML/yaml/composer.pyi index 1d30f2417419..7bc87357c3e1 100644 --- a/stubs/PyYAML/yaml/composer.pyi +++ b/stubs/PyYAML/yaml/composer.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict +from typing import Any from yaml.error import MarkedYAMLError from yaml.nodes import MappingNode, Node, ScalarNode, SequenceNode @@ -6,13 +6,13 @@ from yaml.nodes import MappingNode, Node, ScalarNode, SequenceNode class ComposerError(MarkedYAMLError): ... class Composer: - anchors: Dict[Any, Node] + anchors: dict[Any, Node] def __init__(self) -> None: ... def check_node(self) -> bool: ... def get_node(self) -> Node | None: ... def get_single_node(self) -> Node | None: ... def compose_document(self) -> Node | None: ... def compose_node(self, parent: Node | None, index: int) -> Node | None: ... - def compose_scalar_node(self, anchor: Dict[Any, Node]) -> ScalarNode: ... - def compose_sequence_node(self, anchor: Dict[Any, Node]) -> SequenceNode: ... - def compose_mapping_node(self, anchor: Dict[Any, Node]) -> MappingNode: ... + def compose_scalar_node(self, anchor: dict[Any, Node]) -> ScalarNode: ... + def compose_sequence_node(self, anchor: dict[Any, Node]) -> SequenceNode: ... + def compose_mapping_node(self, anchor: dict[Any, Node]) -> MappingNode: ... diff --git a/stubs/Werkzeug/werkzeug/contrib/fixers.pyi b/stubs/Werkzeug/werkzeug/contrib/fixers.pyi index 9656028a6244..37097f471c9b 100644 --- a/stubs/Werkzeug/werkzeug/contrib/fixers.pyi +++ b/stubs/Werkzeug/werkzeug/contrib/fixers.pyi @@ -1,5 +1,5 @@ from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import Any, Iterable, List, Mapping, Set, Text +from typing import Any, Iterable, Mapping, Set, Text from ..middleware.proxy_fix import ProxyFix as ProxyFix @@ -19,7 +19,7 @@ class PathInfoFromRequestUriFix(object): class HeaderRewriterFix(object): app: WSGIApplication remove_headers: Set[Text] - add_headers: List[Text] + add_headers: list[Text] def __init__( self, app: WSGIApplication, remove_headers: Iterable[Text] | None = ..., add_headers: Iterable[Text] | None = ... ) -> None: ... diff --git a/stubs/Werkzeug/werkzeug/datastructures.pyi b/stubs/Werkzeug/werkzeug/datastructures.pyi index 39231ce89c88..bd35c652ec11 100644 --- a/stubs/Werkzeug/werkzeug/datastructures.pyi +++ b/stubs/Werkzeug/werkzeug/datastructures.pyi @@ -36,7 +36,7 @@ def native_itermethods(names): ... class ImmutableListMixin(Generic[_V]): def __hash__(self) -> int: ... - def __reduce_ex__(self: _D, protocol) -> Tuple[Type[_D], List[_V]]: ... + def __reduce_ex__(self: _D, protocol) -> Tuple[Type[_D], list[_V]]: ... def __delitem__(self, key: _V) -> NoReturn: ... def __iadd__(self, other: Any) -> NoReturn: ... def __imul__(self, other: Any) -> NoReturn: ... @@ -284,7 +284,7 @@ class Accept(ImmutableList[Tuple[str, float]]): @overload def __getitem__(self, key: SupportsIndex) -> Tuple[str, float]: ... @overload - def __getitem__(self, s: slice) -> List[Tuple[str, float]]: ... + def __getitem__(self, s: slice) -> list[Tuple[str, float]]: ... @overload def __getitem__(self, key: str) -> float: ... def quality(self, key: str) -> float: ... @@ -465,7 +465,7 @@ class FileStorage(object): @property def mimetype(self) -> str: ... @property - def mimetype_params(self) -> Dict[str, str]: ... + def mimetype_params(self) -> dict[str, str]: ... def save(self, dst: Text | SupportsWrite[bytes], buffer_size: int = ...): ... def close(self) -> None: ... def __nonzero__(self) -> bool: ... diff --git a/stubs/Werkzeug/werkzeug/exceptions.pyi b/stubs/Werkzeug/werkzeug/exceptions.pyi index 2ff1739538a2..53b0a0c05626 100644 --- a/stubs/Werkzeug/werkzeug/exceptions.pyi +++ b/stubs/Werkzeug/werkzeug/exceptions.pyi @@ -1,6 +1,6 @@ import datetime from _typeshed.wsgi import StartResponse, WSGIEnvironment -from typing import Any, Dict, Iterable, List, NoReturn, Protocol, Text, Tuple, Type +from typing import Any, Iterable, NoReturn, Protocol, Text, Tuple, Type from werkzeug.wrappers import Response @@ -19,11 +19,11 @@ class HTTPException(Exception): def name(self) -> str: ... def get_description(self, environ: WSGIEnvironment | None = ...) -> Text: ... def get_body(self, environ: WSGIEnvironment | None = ...) -> Text: ... - def get_headers(self, environ: WSGIEnvironment | None = ...) -> List[Tuple[str, str]]: ... + def get_headers(self, environ: WSGIEnvironment | None = ...) -> list[Tuple[str, str]]: ... def get_response(self, environ: WSGIEnvironment | _EnvironContainer | None = ...) -> Response: ... def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... -default_exceptions: Dict[int, Type[HTTPException]] +default_exceptions: dict[int, Type[HTTPException]] class BadRequest(HTTPException): code: int @@ -41,7 +41,7 @@ class Unauthorized(HTTPException): self, description: Text | None = ..., response: Response | None = ..., - www_authenticate: None | Tuple[object, ...] | List[object] | object = ..., + www_authenticate: None | Tuple[object, ...] | list[object] | object = ..., ) -> None: ... class Forbidden(HTTPException): diff --git a/stubs/Werkzeug/werkzeug/formparser.pyi b/stubs/Werkzeug/werkzeug/formparser.pyi index 42460805f2ea..1820a1213323 100644 --- a/stubs/Werkzeug/werkzeug/formparser.pyi +++ b/stubs/Werkzeug/werkzeug/formparser.pyi @@ -1,5 +1,5 @@ from _typeshed.wsgi import WSGIEnvironment -from typing import IO, Any, Callable, Dict, Generator, Iterable, Mapping, NoReturn, Optional, Protocol, Text, Tuple, TypeVar +from typing import IO, Any, Callable, Generator, Iterable, Mapping, NoReturn, Optional, Protocol, Text, Tuple, TypeVar from .datastructures import Headers @@ -51,7 +51,7 @@ class FormDataParser(object): def parse( self, stream: IO[bytes], mimetype: Text, content_length: int | None, options: Mapping[str, str] | None = ... ) -> Tuple[IO[bytes], _Dict, _Dict]: ... - parse_functions: Dict[Text, _ParseFunc] + parse_functions: dict[Text, _ParseFunc] def is_valid_multipart_boundary(boundary: str) -> bool: ... def parse_multipart_headers(iterable: Iterable[Text | bytes]) -> Headers: ... diff --git a/stubs/Werkzeug/werkzeug/middleware/http_proxy.pyi b/stubs/Werkzeug/werkzeug/middleware/http_proxy.pyi index 6b4fd56e3d7b..0285b67401e1 100644 --- a/stubs/Werkzeug/werkzeug/middleware/http_proxy.pyi +++ b/stubs/Werkzeug/werkzeug/middleware/http_proxy.pyi @@ -1,12 +1,12 @@ from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import Any, Dict, Iterable, Mapping, MutableMapping, Text +from typing import Any, Iterable, Mapping, MutableMapping, Text _Opts = Mapping[Text, Any] _MutableOpts = MutableMapping[Text, Any] class ProxyMiddleware(object): app: WSGIApplication - targets: Dict[Text, _MutableOpts] + targets: dict[Text, _MutableOpts] def __init__( self, app: WSGIApplication, targets: Mapping[Text, _MutableOpts], chunk_size: int = ..., timeout: int = ... ) -> None: ... diff --git a/stubs/Werkzeug/werkzeug/middleware/lint.pyi b/stubs/Werkzeug/werkzeug/middleware/lint.pyi index 7eb90ca3cc00..f308b2fdf4a1 100644 --- a/stubs/Werkzeug/werkzeug/middleware/lint.pyi +++ b/stubs/Werkzeug/werkzeug/middleware/lint.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import SupportsWrite from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import Any, Iterable, Iterator, List, Mapping, Protocol, Tuple +from typing import Any, Iterable, Iterator, Mapping, Protocol, Tuple from ..datastructures import Headers @@ -36,14 +36,14 @@ class ErrorStream(object): def close(self) -> None: ... class GuardedWrite(object): - def __init__(self, write: SupportsWrite[str], chunks: List[int]) -> None: ... + def __init__(self, write: SupportsWrite[str], chunks: list[int]) -> None: ... def __call__(self, s: str) -> None: ... class GuardedIterator(object): closed: bool headers_set: bool - chunks: List[int] - def __init__(self, iterator: Iterable[str], headers_set: bool, chunks: List[int]) -> None: ... + chunks: list[int] + def __init__(self, iterator: Iterable[str], headers_set: bool, chunks: list[int]) -> None: ... def __iter__(self) -> GuardedIterator: ... if sys.version_info >= (3, 0): def __next__(self) -> str: ... @@ -55,7 +55,7 @@ class LintMiddleware(object): def __init__(self, app: WSGIApplication) -> None: ... def check_environ(self, environ: WSGIEnvironment) -> None: ... def check_start_response( - self, status: str, headers: List[Tuple[str, str]], exc_info: Tuple[Any, ...] | None + self, status: str, headers: list[Tuple[str, str]], exc_info: Tuple[Any, ...] | None ) -> Tuple[int, Headers]: ... def check_headers(self, headers: Mapping[str, str]) -> None: ... def check_iterator(self, app_iter: Iterable[bytes]) -> None: ... diff --git a/stubs/Werkzeug/werkzeug/middleware/profiler.pyi b/stubs/Werkzeug/werkzeug/middleware/profiler.pyi index 61c30b4366e8..10b073dd1a83 100644 --- a/stubs/Werkzeug/werkzeug/middleware/profiler.pyi +++ b/stubs/Werkzeug/werkzeug/middleware/profiler.pyi @@ -1,5 +1,5 @@ from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import IO, Iterable, List, Text, Tuple +from typing import IO, Iterable, Text, Tuple class ProfilerMiddleware(object): def __init__( @@ -11,4 +11,4 @@ class ProfilerMiddleware(object): profile_dir: Text | None = ..., filename_format: Text = ..., ) -> None: ... - def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ... + def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> list[bytes]: ... diff --git a/stubs/Werkzeug/werkzeug/middleware/shared_data.pyi b/stubs/Werkzeug/werkzeug/middleware/shared_data.pyi index d08f6cd0f446..46ad68782dc8 100644 --- a/stubs/Werkzeug/werkzeug/middleware/shared_data.pyi +++ b/stubs/Werkzeug/werkzeug/middleware/shared_data.pyi @@ -1,6 +1,6 @@ import datetime from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment -from typing import IO, Callable, Iterable, List, Mapping, Optional, Text, Tuple, Union +from typing import IO, Callable, Iterable, Mapping, Optional, Text, Tuple, Union _V = Union[Tuple[Text, Text], Text] @@ -9,7 +9,7 @@ _Loader = Callable[[Optional[Text]], Union[Tuple[None, None], Tuple[Text, _Opene class SharedDataMiddleware(object): app: WSGIApplication - exports: List[Tuple[Text, _Loader]] + exports: list[Tuple[Text, _Loader]] cache: bool cache_timeout: float def __init__( diff --git a/stubs/aiofiles/aiofiles/threadpool/binary.pyi b/stubs/aiofiles/aiofiles/threadpool/binary.pyi index b1a1e65b9e2a..27bfd7c8516b 100644 --- a/stubs/aiofiles/aiofiles/threadpool/binary.pyi +++ b/stubs/aiofiles/aiofiles/threadpool/binary.pyi @@ -1,6 +1,6 @@ from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer from io import FileIO -from typing import Iterable, List +from typing import Iterable from ..base import AsyncBase @@ -11,7 +11,7 @@ class _UnknownAsyncBinaryIO(AsyncBase[bytes]): async def read(self, __size: int = ...) -> bytes: ... async def readinto(self, __buffer: WriteableBuffer) -> int | None: ... async def readline(self, __size: int | None = ...) -> bytes: ... - async def readlines(self, __hint: int = ...) -> List[bytes]: ... + async def readlines(self, __hint: int = ...) -> list[bytes]: ... async def seek(self, __offset: int, __whence: int = ...) -> int: ... async def seekable(self) -> bool: ... async def tell(self) -> int: ... diff --git a/stubs/aiofiles/aiofiles/threadpool/text.pyi b/stubs/aiofiles/aiofiles/threadpool/text.pyi index 0cd89a4699eb..fd2a90122e2a 100644 --- a/stubs/aiofiles/aiofiles/threadpool/text.pyi +++ b/stubs/aiofiles/aiofiles/threadpool/text.pyi @@ -1,5 +1,5 @@ from _typeshed import StrOrBytesPath -from typing import BinaryIO, Iterable, List, Tuple +from typing import BinaryIO, Iterable, Tuple from ..base import AsyncBase @@ -9,7 +9,7 @@ class AsyncTextIOWrapper(AsyncBase[str]): async def isatty(self) -> bool: ... async def read(self, __size: int | None = ...) -> str: ... async def readline(self, __size: int = ...) -> str: ... - async def readlines(self, __hint: int = ...) -> List[str]: ... + async def readlines(self, __hint: int = ...) -> list[str]: ... async def seek(self, __offset: int, __whence: int = ...) -> int: ... async def seekable(self) -> bool: ... async def tell(self) -> int: ... diff --git a/stubs/beautifulsoup4/bs4/__init__.pyi b/stubs/beautifulsoup4/bs4/__init__.pyi index d920674a977b..d975dfc8f061 100644 --- a/stubs/beautifulsoup4/bs4/__init__.pyi +++ b/stubs/beautifulsoup4/bs4/__init__.pyi @@ -1,5 +1,5 @@ from _typeshed import Self, SupportsRead -from typing import Any, List, Sequence, Type +from typing import Any, Sequence, Type from .builder import TreeBuilder from .element import PageElement, SoupStrainer, Tag @@ -10,7 +10,7 @@ class MarkupResemblesLocatorWarning(UserWarning): ... class BeautifulSoup(Tag): ROOT_TAG_NAME: str - DEFAULT_BUILDER_FEATURES: List[str] + DEFAULT_BUILDER_FEATURES: list[str] ASCII_SPACES: str NO_PARSER_SPECIFIED_WARNING: str element_classes: Any diff --git a/stubs/bleach/bleach/html5lib_shim.pyi b/stubs/bleach/bleach/html5lib_shim.pyi index 0f17263ec4c8..941d1cb02399 100644 --- a/stubs/bleach/bleach/html5lib_shim.pyi +++ b/stubs/bleach/bleach/html5lib_shim.pyi @@ -1,4 +1,4 @@ -from typing import Any, Generator, Iterable, List, Text +from typing import Any, Generator, Iterable, Text class HTMLParser(object): # actually html5lib.HTMLParser def __getattr__(self, __name: Text) -> Any: ... # incomplete @@ -13,7 +13,7 @@ class HTMLSerializer(object): # actually html5lib.serializer.HTMLSerializer def __getattr__(self, __name: Text) -> Any: ... # incomplete class BleachHTMLParser(HTMLParser): - tags: List[Text] | None + tags: list[Text] | None strip: bool consume_entities: bool def __init__(self, tags: Iterable[Text] | None, strip: bool, consume_entities: bool, **kwargs) -> None: ... diff --git a/stubs/bleach/bleach/linkifier.pyi b/stubs/bleach/bleach/linkifier.pyi index 2586978f16e5..dfd8bd1d9208 100644 --- a/stubs/bleach/bleach/linkifier.pyi +++ b/stubs/bleach/bleach/linkifier.pyi @@ -1,4 +1,4 @@ -from typing import Any, Container, Iterable, List, MutableMapping, Pattern, Protocol, Text +from typing import Any, Container, Iterable, MutableMapping, Pattern, Protocol, Text from .html5lib_shim import Filter @@ -7,9 +7,9 @@ _Attrs = MutableMapping[Any, Text] class _Callback(Protocol): def __call__(self, attrs: _Attrs, new: bool = ...) -> _Attrs: ... -DEFAULT_CALLBACKS: List[_Callback] +DEFAULT_CALLBACKS: list[_Callback] -TLDS: List[Text] +TLDS: list[Text] def build_url_re(tlds: Iterable[Text] = ..., protocols: Iterable[Text] = ...) -> Pattern[Text]: ... diff --git a/stubs/bleach/bleach/sanitizer.pyi b/stubs/bleach/bleach/sanitizer.pyi index ac9a127d7d45..5821cdedbf88 100644 --- a/stubs/bleach/bleach/sanitizer.pyi +++ b/stubs/bleach/bleach/sanitizer.pyi @@ -2,10 +2,10 @@ from typing import Any, Callable, Container, Dict, Iterable, List, Pattern, Text from .html5lib_shim import BleachHTMLParser, BleachHTMLSerializer, SanitizerFilter -ALLOWED_TAGS: List[Text] -ALLOWED_ATTRIBUTES: Dict[Text, List[Text]] -ALLOWED_STYLES: List[Text] -ALLOWED_PROTOCOLS: List[Text] +ALLOWED_TAGS: list[Text] +ALLOWED_ATTRIBUTES: dict[Text, list[Text]] +ALLOWED_STYLES: list[Text] +ALLOWED_PROTOCOLS: list[Text] INVISIBLE_CHARACTERS: Text INVISIBLE_CHARACTERS_RE: Pattern[Text] diff --git a/stubs/boto/boto/kms/__init__.pyi b/stubs/boto/boto/kms/__init__.pyi index ec5dfacb7f5b..9fc301120e0e 100644 --- a/stubs/boto/boto/kms/__init__.pyi +++ b/stubs/boto/boto/kms/__init__.pyi @@ -1,6 +1,4 @@ -from typing import List - import boto.regioninfo -def regions() -> List[boto.regioninfo.RegionInfo]: ... +def regions() -> list[boto.regioninfo.RegionInfo]: ... def connect_to_region(region_name, **kw_params): ... diff --git a/stubs/boto/boto/kms/layer1.pyi b/stubs/boto/boto/kms/layer1.pyi index b639b94199b4..e2755233678d 100644 --- a/stubs/boto/boto/kms/layer1.pyi +++ b/stubs/boto/boto/kms/layer1.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Mapping, Type +from typing import Any, Mapping, Type from boto.connection import AWSQueryConnection @@ -11,67 +11,67 @@ class KMSConnection(AWSQueryConnection): ResponseError: Type[Exception] region: Any def __init__(self, **kwargs) -> None: ... - def create_alias(self, alias_name: str, target_key_id: str) -> Dict[str, Any] | None: ... + def create_alias(self, alias_name: str, target_key_id: str) -> dict[str, Any] | None: ... def create_grant( self, key_id: str, grantee_principal: str, retiring_principal: str | None = ..., - operations: List[str] | None = ..., - constraints: Dict[str, Dict[str, str]] | None = ..., - grant_tokens: List[str] | None = ..., - ) -> Dict[str, Any] | None: ... + operations: list[str] | None = ..., + constraints: dict[str, dict[str, str]] | None = ..., + grant_tokens: list[str] | None = ..., + ) -> dict[str, Any] | None: ... def create_key( self, policy: str | None = ..., description: str | None = ..., key_usage: str | None = ... - ) -> Dict[str, Any] | None: ... + ) -> dict[str, Any] | None: ... def decrypt( - self, ciphertext_blob: bytes, encryption_context: Mapping[str, Any] | None = ..., grant_tokens: List[str] | None = ... - ) -> Dict[str, Any] | None: ... - def delete_alias(self, alias_name: str) -> Dict[str, Any] | None: ... - def describe_key(self, key_id: str) -> Dict[str, Any] | None: ... - def disable_key(self, key_id: str) -> Dict[str, Any] | None: ... - def disable_key_rotation(self, key_id: str) -> Dict[str, Any] | None: ... - def enable_key(self, key_id: str) -> Dict[str, Any] | None: ... - def enable_key_rotation(self, key_id: str) -> Dict[str, Any] | None: ... + self, ciphertext_blob: bytes, encryption_context: Mapping[str, Any] | None = ..., grant_tokens: list[str] | None = ... + ) -> dict[str, Any] | None: ... + def delete_alias(self, alias_name: str) -> dict[str, Any] | None: ... + def describe_key(self, key_id: str) -> dict[str, Any] | None: ... + def disable_key(self, key_id: str) -> dict[str, Any] | None: ... + def disable_key_rotation(self, key_id: str) -> dict[str, Any] | None: ... + def enable_key(self, key_id: str) -> dict[str, Any] | None: ... + def enable_key_rotation(self, key_id: str) -> dict[str, Any] | None: ... def encrypt( self, key_id: str, plaintext: bytes, encryption_context: Mapping[str, Any] | None = ..., - grant_tokens: List[str] | None = ..., - ) -> Dict[str, Any] | None: ... + grant_tokens: list[str] | None = ..., + ) -> dict[str, Any] | None: ... def generate_data_key( self, key_id: str, encryption_context: Mapping[str, Any] | None = ..., number_of_bytes: int | None = ..., key_spec: str | None = ..., - grant_tokens: List[str] | None = ..., - ) -> Dict[str, Any] | None: ... + grant_tokens: list[str] | None = ..., + ) -> dict[str, Any] | None: ... def generate_data_key_without_plaintext( self, key_id: str, encryption_context: Mapping[str, Any] | None = ..., key_spec: str | None = ..., number_of_bytes: int | None = ..., - grant_tokens: List[str] | None = ..., - ) -> Dict[str, Any] | None: ... - def generate_random(self, number_of_bytes: int | None = ...) -> Dict[str, Any] | None: ... - def get_key_policy(self, key_id: str, policy_name: str) -> Dict[str, Any] | None: ... - def get_key_rotation_status(self, key_id: str) -> Dict[str, Any] | None: ... - def list_aliases(self, limit: int | None = ..., marker: str | None = ...) -> Dict[str, Any] | None: ... - def list_grants(self, key_id: str, limit: int | None = ..., marker: str | None = ...) -> Dict[str, Any] | None: ... - def list_key_policies(self, key_id: str, limit: int | None = ..., marker: str | None = ...) -> Dict[str, Any] | None: ... - def list_keys(self, limit: int | None = ..., marker: str | None = ...) -> Dict[str, Any] | None: ... - def put_key_policy(self, key_id: str, policy_name: str, policy: str) -> Dict[str, Any] | None: ... + grant_tokens: list[str] | None = ..., + ) -> dict[str, Any] | None: ... + def generate_random(self, number_of_bytes: int | None = ...) -> dict[str, Any] | None: ... + def get_key_policy(self, key_id: str, policy_name: str) -> dict[str, Any] | None: ... + def get_key_rotation_status(self, key_id: str) -> dict[str, Any] | None: ... + def list_aliases(self, limit: int | None = ..., marker: str | None = ...) -> dict[str, Any] | None: ... + def list_grants(self, key_id: str, limit: int | None = ..., marker: str | None = ...) -> dict[str, Any] | None: ... + def list_key_policies(self, key_id: str, limit: int | None = ..., marker: str | None = ...) -> dict[str, Any] | None: ... + def list_keys(self, limit: int | None = ..., marker: str | None = ...) -> dict[str, Any] | None: ... + def put_key_policy(self, key_id: str, policy_name: str, policy: str) -> dict[str, Any] | None: ... def re_encrypt( self, ciphertext_blob: bytes, destination_key_id: str, source_encryption_context: Mapping[str, Any] | None = ..., destination_encryption_context: Mapping[str, Any] | None = ..., - grant_tokens: List[str] | None = ..., - ) -> Dict[str, Any] | None: ... - def retire_grant(self, grant_token: str) -> Dict[str, Any] | None: ... - def revoke_grant(self, key_id: str, grant_id: str) -> Dict[str, Any] | None: ... - def update_key_description(self, key_id: str, description: str) -> Dict[str, Any] | None: ... + grant_tokens: list[str] | None = ..., + ) -> dict[str, Any] | None: ... + def retire_grant(self, grant_token: str) -> dict[str, Any] | None: ... + def revoke_grant(self, key_id: str, grant_id: str) -> dict[str, Any] | None: ... + def update_key_description(self, key_id: str, description: str) -> dict[str, Any] | None: ... diff --git a/stubs/boto/boto/s3/__init__.pyi b/stubs/boto/boto/s3/__init__.pyi index 0d30c85c401e..fa747956ebbe 100644 --- a/stubs/boto/boto/s3/__init__.pyi +++ b/stubs/boto/boto/s3/__init__.pyi @@ -1,4 +1,4 @@ -from typing import List, Text, Type +from typing import Text, Type from boto.connection import AWSAuthConnection from boto.regioninfo import RegionInfo @@ -14,5 +14,5 @@ class S3RegionInfo(RegionInfo): **kw_params, ) -> S3Connection: ... -def regions() -> List[S3RegionInfo]: ... +def regions() -> list[S3RegionInfo]: ... def connect_to_region(region_name: Text, **kw_params): ... diff --git a/stubs/boto/boto/s3/acl.pyi b/stubs/boto/boto/s3/acl.pyi index 2a4d315c8814..55966a1fb1aa 100644 --- a/stubs/boto/boto/s3/acl.pyi +++ b/stubs/boto/boto/s3/acl.pyi @@ -1,9 +1,9 @@ -from typing import Any, Dict, List, Text +from typing import Any, Text from .connection import S3Connection from .user import User -CannedACLStrings: List[str] +CannedACLStrings: list[str] class Policy: parent: Any @@ -11,13 +11,13 @@ class Policy: acl: ACL def __init__(self, parent: Any | None = ...) -> None: ... owner: User - def startElement(self, name: Text, attrs: Dict[str, Any], connection: S3Connection) -> None | User | ACL: ... + def startElement(self, name: Text, attrs: dict[str, Any], connection: S3Connection) -> None | User | ACL: ... def endElement(self, name: Text, value: Any, connection: S3Connection) -> None: ... def to_xml(self) -> str: ... class ACL: policy: Policy - grants: List[Grant] + grants: list[Grant] def __init__(self, policy: Policy | None = ...) -> None: ... def add_grant(self, grant: Grant) -> None: ... def add_email_grant(self, permission: Text, email_address: Text) -> None: ... diff --git a/stubs/boto/boto/s3/bucket.pyi b/stubs/boto/boto/s3/bucket.pyi index cc51b8cf0e12..741772ff3817 100644 --- a/stubs/boto/boto/s3/bucket.pyi +++ b/stubs/boto/boto/s3/bucket.pyi @@ -1,15 +1,15 @@ -from typing import Any, Dict, List, Text, Type +from typing import Any, Text, Type from .bucketlistresultset import BucketListResultSet from .connection import S3Connection from .key import Key class S3WebsiteEndpointTranslate: - trans_region: Dict[str, str] + trans_region: dict[str, str] @classmethod def translate_region(cls, reg: Text) -> str: ... -S3Permissions: List[str] +S3Permissions: list[str] class Bucket: LoggingGroup: str @@ -27,13 +27,13 @@ class Bucket: creation_date: Any def endElement(self, name, value, connection): ... def set_key_class(self, key_class): ... - def lookup(self, key_name, headers: Dict[Text, Text] | None = ...): ... + def lookup(self, key_name, headers: dict[Text, Text] | None = ...): ... def get_key( self, key_name, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., version_id: Any | None = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., validate: bool = ..., ) -> Key: ... def list( @@ -41,7 +41,7 @@ class Bucket: prefix: Text = ..., delimiter: Text = ..., marker: Text = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., encoding_type: Any | None = ..., ) -> BucketListResultSet: ... def list_versions( @@ -50,34 +50,34 @@ class Bucket: delimiter: str = ..., key_marker: str = ..., version_id_marker: str = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., encoding_type: Text | None = ..., ) -> BucketListResultSet: ... def list_multipart_uploads( self, key_marker: str = ..., upload_id_marker: str = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., encoding_type: Any | None = ..., ): ... def validate_kwarg_names(self, kwargs, names): ... - def get_all_keys(self, headers: Dict[Text, Text] | None = ..., **params): ... - def get_all_versions(self, headers: Dict[Text, Text] | None = ..., **params): ... + def get_all_keys(self, headers: dict[Text, Text] | None = ..., **params): ... + def get_all_versions(self, headers: dict[Text, Text] | None = ..., **params): ... def validate_get_all_versions_params(self, params): ... - def get_all_multipart_uploads(self, headers: Dict[Text, Text] | None = ..., **params): ... + def get_all_multipart_uploads(self, headers: dict[Text, Text] | None = ..., **params): ... def new_key(self, key_name: Any | None = ...): ... def generate_url( self, expires_in, method: str = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., force_http: bool = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., expires_in_absolute: bool = ..., ): ... - def delete_keys(self, keys, quiet: bool = ..., mfa_token: Any | None = ..., headers: Dict[Text, Text] | None = ...): ... + def delete_keys(self, keys, quiet: bool = ..., mfa_token: Any | None = ..., headers: dict[Text, Text] | None = ...): ... def delete_key( - self, key_name, headers: Dict[Text, Text] | None = ..., version_id: Any | None = ..., mfa_token: Any | None = ... + self, key_name, headers: dict[Text, Text] | None = ..., version_id: Any | None = ..., mfa_token: Any | None = ... ): ... def copy_key( self, @@ -89,90 +89,90 @@ class Bucket: storage_class: str = ..., preserve_acl: bool = ..., encrypt_key: bool = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., query_args: Any | None = ..., ): ... def set_canned_acl( - self, acl_str, key_name: str = ..., headers: Dict[Text, Text] | None = ..., version_id: Any | None = ... + self, acl_str, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ... ): ... - def get_xml_acl(self, key_name: str = ..., headers: Dict[Text, Text] | None = ..., version_id: Any | None = ...): ... + def get_xml_acl(self, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ...): ... def set_xml_acl( self, acl_str, key_name: str = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., version_id: Any | None = ..., query_args: str = ..., ): ... - def set_acl(self, acl_or_str, key_name: str = ..., headers: Dict[Text, Text] | None = ..., version_id: Any | None = ...): ... - def get_acl(self, key_name: str = ..., headers: Dict[Text, Text] | None = ..., version_id: Any | None = ...): ... + def set_acl(self, acl_or_str, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ...): ... + def get_acl(self, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ...): ... def set_subresource( - self, subresource, value, key_name: str = ..., headers: Dict[Text, Text] | None = ..., version_id: Any | None = ... + self, subresource, value, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ... ): ... def get_subresource( - self, subresource, key_name: str = ..., headers: Dict[Text, Text] | None = ..., version_id: Any | None = ... + self, subresource, key_name: str = ..., headers: dict[Text, Text] | None = ..., version_id: Any | None = ... ): ... - def make_public(self, recursive: bool = ..., headers: Dict[Text, Text] | None = ...): ... - def add_email_grant(self, permission, email_address, recursive: bool = ..., headers: Dict[Text, Text] | None = ...): ... + def make_public(self, recursive: bool = ..., headers: dict[Text, Text] | None = ...): ... + def add_email_grant(self, permission, email_address, recursive: bool = ..., headers: dict[Text, Text] | None = ...): ... def add_user_grant( - self, permission, user_id, recursive: bool = ..., headers: Dict[Text, Text] | None = ..., display_name: Any | None = ... + self, permission, user_id, recursive: bool = ..., headers: dict[Text, Text] | None = ..., display_name: Any | None = ... ): ... - def list_grants(self, headers: Dict[Text, Text] | None = ...): ... + def list_grants(self, headers: dict[Text, Text] | None = ...): ... def get_location(self): ... - def set_xml_logging(self, logging_str, headers: Dict[Text, Text] | None = ...): ... + def set_xml_logging(self, logging_str, headers: dict[Text, Text] | None = ...): ... def enable_logging( - self, target_bucket, target_prefix: str = ..., grants: Any | None = ..., headers: Dict[Text, Text] | None = ... + self, target_bucket, target_prefix: str = ..., grants: Any | None = ..., headers: dict[Text, Text] | None = ... ): ... - def disable_logging(self, headers: Dict[Text, Text] | None = ...): ... - def get_logging_status(self, headers: Dict[Text, Text] | None = ...): ... - def set_as_logging_target(self, headers: Dict[Text, Text] | None = ...): ... - def get_request_payment(self, headers: Dict[Text, Text] | None = ...): ... - def set_request_payment(self, payer: str = ..., headers: Dict[Text, Text] | None = ...): ... + def disable_logging(self, headers: dict[Text, Text] | None = ...): ... + def get_logging_status(self, headers: dict[Text, Text] | None = ...): ... + def set_as_logging_target(self, headers: dict[Text, Text] | None = ...): ... + def get_request_payment(self, headers: dict[Text, Text] | None = ...): ... + def set_request_payment(self, payer: str = ..., headers: dict[Text, Text] | None = ...): ... def configure_versioning( - self, versioning, mfa_delete: bool = ..., mfa_token: Any | None = ..., headers: Dict[Text, Text] | None = ... + self, versioning, mfa_delete: bool = ..., mfa_token: Any | None = ..., headers: dict[Text, Text] | None = ... ): ... - def get_versioning_status(self, headers: Dict[Text, Text] | None = ...): ... - def configure_lifecycle(self, lifecycle_config, headers: Dict[Text, Text] | None = ...): ... - def get_lifecycle_config(self, headers: Dict[Text, Text] | None = ...): ... - def delete_lifecycle_configuration(self, headers: Dict[Text, Text] | None = ...): ... + def get_versioning_status(self, headers: dict[Text, Text] | None = ...): ... + def configure_lifecycle(self, lifecycle_config, headers: dict[Text, Text] | None = ...): ... + def get_lifecycle_config(self, headers: dict[Text, Text] | None = ...): ... + def delete_lifecycle_configuration(self, headers: dict[Text, Text] | None = ...): ... def configure_website( self, suffix: Any | None = ..., error_key: Any | None = ..., redirect_all_requests_to: Any | None = ..., routing_rules: Any | None = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., ): ... - def set_website_configuration(self, config, headers: Dict[Text, Text] | None = ...): ... - def set_website_configuration_xml(self, xml, headers: Dict[Text, Text] | None = ...): ... - def get_website_configuration(self, headers: Dict[Text, Text] | None = ...): ... - def get_website_configuration_obj(self, headers: Dict[Text, Text] | None = ...): ... - def get_website_configuration_with_xml(self, headers: Dict[Text, Text] | None = ...): ... - def get_website_configuration_xml(self, headers: Dict[Text, Text] | None = ...): ... - def delete_website_configuration(self, headers: Dict[Text, Text] | None = ...): ... + def set_website_configuration(self, config, headers: dict[Text, Text] | None = ...): ... + def set_website_configuration_xml(self, xml, headers: dict[Text, Text] | None = ...): ... + def get_website_configuration(self, headers: dict[Text, Text] | None = ...): ... + def get_website_configuration_obj(self, headers: dict[Text, Text] | None = ...): ... + def get_website_configuration_with_xml(self, headers: dict[Text, Text] | None = ...): ... + def get_website_configuration_xml(self, headers: dict[Text, Text] | None = ...): ... + def delete_website_configuration(self, headers: dict[Text, Text] | None = ...): ... def get_website_endpoint(self): ... - def get_policy(self, headers: Dict[Text, Text] | None = ...): ... - def set_policy(self, policy, headers: Dict[Text, Text] | None = ...): ... - def delete_policy(self, headers: Dict[Text, Text] | None = ...): ... - def set_cors_xml(self, cors_xml, headers: Dict[Text, Text] | None = ...): ... - def set_cors(self, cors_config, headers: Dict[Text, Text] | None = ...): ... - def get_cors_xml(self, headers: Dict[Text, Text] | None = ...): ... - def get_cors(self, headers: Dict[Text, Text] | None = ...): ... - def delete_cors(self, headers: Dict[Text, Text] | None = ...): ... + def get_policy(self, headers: dict[Text, Text] | None = ...): ... + def set_policy(self, policy, headers: dict[Text, Text] | None = ...): ... + def delete_policy(self, headers: dict[Text, Text] | None = ...): ... + def set_cors_xml(self, cors_xml, headers: dict[Text, Text] | None = ...): ... + def set_cors(self, cors_config, headers: dict[Text, Text] | None = ...): ... + def get_cors_xml(self, headers: dict[Text, Text] | None = ...): ... + def get_cors(self, headers: dict[Text, Text] | None = ...): ... + def delete_cors(self, headers: dict[Text, Text] | None = ...): ... def initiate_multipart_upload( self, key_name, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., reduced_redundancy: bool = ..., metadata: Any | None = ..., encrypt_key: bool = ..., policy: Any | None = ..., ): ... - def complete_multipart_upload(self, key_name, upload_id, xml_body, headers: Dict[Text, Text] | None = ...): ... - def cancel_multipart_upload(self, key_name, upload_id, headers: Dict[Text, Text] | None = ...): ... - def delete(self, headers: Dict[Text, Text] | None = ...): ... + def complete_multipart_upload(self, key_name, upload_id, xml_body, headers: dict[Text, Text] | None = ...): ... + def cancel_multipart_upload(self, key_name, upload_id, headers: dict[Text, Text] | None = ...): ... + def delete(self, headers: dict[Text, Text] | None = ...): ... def get_tags(self): ... def get_xml_tags(self): ... - def set_xml_tags(self, tag_str, headers: Dict[Text, Text] | None = ..., query_args: str = ...): ... - def set_tags(self, tags, headers: Dict[Text, Text] | None = ...): ... - def delete_tags(self, headers: Dict[Text, Text] | None = ...): ... + def set_xml_tags(self, tag_str, headers: dict[Text, Text] | None = ..., query_args: str = ...): ... + def set_tags(self, tags, headers: dict[Text, Text] | None = ...): ... + def delete_tags(self, headers: dict[Text, Text] | None = ...): ... diff --git a/stubs/boto/boto/s3/connection.pyi b/stubs/boto/boto/s3/connection.pyi index 8a42dc35d5ef..96b8d0de134c 100644 --- a/stubs/boto/boto/s3/connection.pyi +++ b/stubs/boto/boto/s3/connection.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Text, Type +from typing import Any, Text, Type from boto.connection import AWSAuthConnection from boto.exception import BotoClientError @@ -97,9 +97,9 @@ class S3Connection(AWSAuthConnection): method, bucket: str = ..., key: str = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., force_http: bool = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., version_id: Any | None = ..., iso_date: Any | None = ..., ): ... @@ -109,20 +109,20 @@ class S3Connection(AWSAuthConnection): method, bucket: str = ..., key: str = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., query_auth: bool = ..., force_http: bool = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., expires_in_absolute: bool = ..., version_id: Any | None = ..., ): ... - def get_all_buckets(self, headers: Dict[Text, Text] | None = ...): ... - def get_canonical_user_id(self, headers: Dict[Text, Text] | None = ...): ... - def get_bucket(self, bucket_name: Text, validate: bool = ..., headers: Dict[Text, Text] | None = ...) -> Bucket: ... - def head_bucket(self, bucket_name, headers: Dict[Text, Text] | None = ...): ... - def lookup(self, bucket_name, validate: bool = ..., headers: Dict[Text, Text] | None = ...): ... + def get_all_buckets(self, headers: dict[Text, Text] | None = ...): ... + def get_canonical_user_id(self, headers: dict[Text, Text] | None = ...): ... + def get_bucket(self, bucket_name: Text, validate: bool = ..., headers: dict[Text, Text] | None = ...) -> Bucket: ... + def head_bucket(self, bucket_name, headers: dict[Text, Text] | None = ...): ... + def lookup(self, bucket_name, validate: bool = ..., headers: dict[Text, Text] | None = ...): ... def create_bucket( - self, bucket_name, headers: Dict[Text, Text] | None = ..., location: Any = ..., policy: Any | None = ... + self, bucket_name, headers: dict[Text, Text] | None = ..., location: Any = ..., policy: Any | None = ... ): ... - def delete_bucket(self, bucket, headers: Dict[Text, Text] | None = ...): ... + def delete_bucket(self, bucket, headers: dict[Text, Text] | None = ...): ... def make_request(self, method, bucket: str = ..., key: str = ..., headers: Any | None = ..., data: str = ..., query_args: Any | None = ..., sender: Any | None = ..., override_num_retries: Any | None = ..., retry_handler: Any | None = ..., *args, **kwargs): ... # type: ignore # https://github.com/python/mypy/issues/1237 diff --git a/stubs/boto/boto/s3/key.pyi b/stubs/boto/boto/s3/key.pyi index f32016226eb0..1a8b365a2604 100644 --- a/stubs/boto/boto/s3/key.pyi +++ b/stubs/boto/boto/s3/key.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Text, overload +from typing import Any, Callable, Text, overload class Key: DefaultContentType: str @@ -45,16 +45,16 @@ class Key: def handle_addl_headers(self, headers): ... def open_read( self, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., query_args: str = ..., override_num_retries: Any | None = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., ): ... - def open_write(self, headers: Dict[Text, Text] | None = ..., override_num_retries: Any | None = ...): ... + def open_write(self, headers: dict[Text, Text] | None = ..., override_num_retries: Any | None = ...): ... def open( self, mode: str = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., query_args: Any | None = ..., override_num_retries: Any | None = ..., ): ... @@ -76,27 +76,27 @@ class Key: ): ... def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... - def exists(self, headers: Dict[Text, Text] | None = ...): ... - def delete(self, headers: Dict[Text, Text] | None = ...): ... + def exists(self, headers: dict[Text, Text] | None = ...): ... + def delete(self, headers: dict[Text, Text] | None = ...): ... def get_metadata(self, name): ... def set_metadata(self, name, value): ... def update_metadata(self, d): ... - def set_acl(self, acl_str, headers: Dict[Text, Text] | None = ...): ... - def get_acl(self, headers: Dict[Text, Text] | None = ...): ... - def get_xml_acl(self, headers: Dict[Text, Text] | None = ...): ... - def set_xml_acl(self, acl_str, headers: Dict[Text, Text] | None = ...): ... - def set_canned_acl(self, acl_str, headers: Dict[Text, Text] | None = ...): ... + def set_acl(self, acl_str, headers: dict[Text, Text] | None = ...): ... + def get_acl(self, headers: dict[Text, Text] | None = ...): ... + def get_xml_acl(self, headers: dict[Text, Text] | None = ...): ... + def set_xml_acl(self, acl_str, headers: dict[Text, Text] | None = ...): ... + def set_canned_acl(self, acl_str, headers: dict[Text, Text] | None = ...): ... def get_redirect(self): ... - def set_redirect(self, redirect_location, headers: Dict[Text, Text] | None = ...): ... - def make_public(self, headers: Dict[Text, Text] | None = ...): ... + def set_redirect(self, redirect_location, headers: dict[Text, Text] | None = ...): ... + def make_public(self, headers: dict[Text, Text] | None = ...): ... def generate_url( self, expires_in, method: str = ..., - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., query_auth: bool = ..., force_http: bool = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., expires_in_absolute: bool = ..., version_id: Any | None = ..., policy: Any | None = ..., @@ -106,7 +106,7 @@ class Key: def send_file( self, fp, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ..., query_args: Any | None = ..., @@ -118,7 +118,7 @@ class Key: def set_contents_from_stream( self, fp, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., replace: bool = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ..., @@ -130,7 +130,7 @@ class Key: def set_contents_from_file( self, fp, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., replace: bool = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ..., @@ -145,7 +145,7 @@ class Key: def set_contents_from_filename( self, filename, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., replace: bool = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ..., @@ -157,7 +157,7 @@ class Key: def set_contents_from_string( self, string_data: Text | bytes, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., replace: bool = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ..., @@ -169,63 +169,63 @@ class Key: def get_file( self, fp, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ..., torrent: bool = ..., version_id: Any | None = ..., override_num_retries: Any | None = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., ): ... def get_torrent_file( - self, fp, headers: Dict[Text, Text] | None = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ... + self, fp, headers: dict[Text, Text] | None = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ... ): ... def get_contents_to_file( self, fp, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ..., torrent: bool = ..., version_id: Any | None = ..., res_download_handler: Any | None = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., ): ... def get_contents_to_filename( self, filename, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ..., torrent: bool = ..., version_id: Any | None = ..., res_download_handler: Any | None = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., ): ... @overload def get_contents_as_string( self, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ..., torrent: bool = ..., version_id: Any | None = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., encoding: None = ..., ) -> bytes: ... @overload def get_contents_as_string( self, - headers: Dict[Text, Text] | None = ..., + headers: dict[Text, Text] | None = ..., cb: Callable[[int, int], Any] | None = ..., num_cb: int = ..., torrent: bool = ..., version_id: Any | None = ..., - response_headers: Dict[Text, Text] | None = ..., + response_headers: dict[Text, Text] | None = ..., *, encoding: Text, ) -> Text: ... - def add_email_grant(self, permission, email_address, headers: Dict[Text, Text] | None = ...): ... - def add_user_grant(self, permission, user_id, headers: Dict[Text, Text] | None = ..., display_name: Any | None = ...): ... - def set_remote_metadata(self, metadata_plus, metadata_minus, preserve_acl, headers: Dict[Text, Text] | None = ...): ... - def restore(self, days, headers: Dict[Text, Text] | None = ...): ... + def add_email_grant(self, permission, email_address, headers: dict[Text, Text] | None = ...): ... + def add_user_grant(self, permission, user_id, headers: dict[Text, Text] | None = ..., display_name: Any | None = ...): ... + def set_remote_metadata(self, metadata_plus, metadata_minus, preserve_acl, headers: dict[Text, Text] | None = ...): ... + def restore(self, days, headers: dict[Text, Text] | None = ...): ... diff --git a/stubs/boto/boto/utils.pyi b/stubs/boto/boto/utils.pyi index 338b409fffad..c4549098806b 100644 --- a/stubs/boto/boto/utils.pyi +++ b/stubs/boto/boto/utils.pyi @@ -3,7 +3,7 @@ import logging.handlers import subprocess import sys import time -from typing import IO, Any, Callable, ContextManager, Dict, Iterable, List, Mapping, Sequence, Tuple, Type, TypeVar +from typing import IO, Any, Callable, ContextManager, Dict, Iterable, Mapping, Sequence, Tuple, Type, TypeVar import boto.connection @@ -38,7 +38,7 @@ _Provider = Any # TODO replace this with boto.provider.Provider once stubs exis _LockType = Any # TODO replace this with _thread.LockType once stubs exist JSONDecodeError: Type[ValueError] -qsa_of_interest: List[str] +qsa_of_interest: list[str] def unquote_v(nv: str) -> str | Tuple[str, str]: ... def canonical_string( @@ -108,7 +108,7 @@ class LRUCache(Dict[_KT, _VT]): key = ... value = ... def __init__(self, key, value) -> None: ... - _dict: Dict[_KT, LRUCache._Item] + _dict: dict[_KT, LRUCache._Item] capacity: int head: LRUCache._Item | None tail: LRUCache._Item | None @@ -134,15 +134,15 @@ def notify( append_instance_id: bool = ..., ) -> None: ... def get_utf8_value(value: str) -> bytes: ... -def mklist(value: Any) -> List[Any]: ... +def mklist(value: Any) -> list[Any]: ... def pythonize_name(name: str) -> str: ... def write_mime_multipart( - content: List[Tuple[str, str]], compress: bool = ..., deftype: str = ..., delimiter: str = ... + content: list[Tuple[str, str]], compress: bool = ..., deftype: str = ..., delimiter: str = ... ) -> str: ... def guess_mime_type(content: str, deftype: str) -> str: ... def compute_md5(fp: IO[Any], buf_size: int = ..., size: int | None = ...) -> Tuple[str, str, int]: ... def compute_hash(fp: IO[Any], buf_size: int = ..., size: int | None = ..., hash_algorithm: Any = ...) -> Tuple[str, str, int]: ... -def find_matching_headers(name: str, headers: Mapping[str, str | None]) -> List[str]: ... +def find_matching_headers(name: str, headers: Mapping[str, str | None]) -> list[str]: ... def merge_headers_by_name(name: str, headers: Mapping[str, str | None]) -> str: ... class RequestHook: diff --git a/stubs/characteristic/characteristic/__init__.pyi b/stubs/characteristic/characteristic/__init__.pyi index dd4322e93a8f..08056c3e6c07 100644 --- a/stubs/characteristic/characteristic/__init__.pyi +++ b/stubs/characteristic/characteristic/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Any, AnyStr, Callable, Dict, Sequence, Type, TypeVar +from typing import Any, AnyStr, Callable, Sequence, Type, TypeVar def with_repr(attrs: Sequence[AnyStr | Attribute]) -> Callable[..., Any]: ... def with_cmp(attrs: Sequence[AnyStr | Attribute]) -> Callable[..., Any]: ... @@ -17,7 +17,7 @@ def attributes( apply_with_repr: bool = ..., apply_immutable: bool = ..., store_attributes: Callable[[type, Attribute], Any] | None = ..., - **kw: Dict[Any, Any] | None, + **kw: dict[Any, Any] | None, ) -> Callable[[Type[_T]], Type[_T]]: ... class Attribute: diff --git a/stubs/chardet/chardet/universaldetector.pyi b/stubs/chardet/chardet/universaldetector.pyi index 5a2f68a0de8f..372a4fefa5e6 100644 --- a/stubs/chardet/chardet/universaldetector.pyi +++ b/stubs/chardet/chardet/universaldetector.pyi @@ -1,5 +1,5 @@ from logging import Logger -from typing import Dict, Pattern +from typing import Pattern from typing_extensions import TypedDict class _FinalResultType(TypedDict): @@ -17,7 +17,7 @@ class UniversalDetector(object): HIGH_BYTE_DETECTOR: Pattern[bytes] ESC_DETECTOR: Pattern[bytes] WIN_BYTE_DETECTOR: Pattern[bytes] - ISO_WIN_MAP: Dict[str, str] + ISO_WIN_MAP: dict[str, str] result: _IntermediateResultType done: bool diff --git a/stubs/chardet/chardet/version.pyi b/stubs/chardet/chardet/version.pyi index 13b2534d1c2c..966073bd25a6 100644 --- a/stubs/chardet/chardet/version.pyi +++ b/stubs/chardet/chardet/version.pyi @@ -1,4 +1,2 @@ -from typing import List - __version__: str -VERSION: List[str] +VERSION: list[str] diff --git a/stubs/click/click/core.pyi b/stubs/click/click/core.pyi index bd7341852693..b19e8aeb8ec6 100644 --- a/stubs/click/click/core.pyi +++ b/stubs/click/click/core.pyi @@ -1,19 +1,4 @@ -from typing import ( - Any, - Callable, - ContextManager, - Dict, - Iterable, - List, - Mapping, - NoReturn, - Optional, - Sequence, - Set, - Tuple, - TypeVar, - Union, -) +from typing import Any, Callable, ContextManager, Iterable, Mapping, NoReturn, Optional, Sequence, Set, Tuple, TypeVar, Union from click.formatting import HelpFormatter from click.parser import OptionParser @@ -32,9 +17,9 @@ class Context: parent: Context | None command: Command info_name: str | None - params: Dict[Any, Any] - args: List[str] - protected_args: List[str] + params: dict[Any, Any] + args: list[str] + protected_args: list[str] obj: Any default_map: Mapping[str, Any] | None invoked_subcommand: str | None @@ -43,13 +28,13 @@ class Context: allow_extra_args: bool allow_interspersed_args: bool ignore_unknown_options: bool - help_option_names: List[str] + help_option_names: list[str] token_normalize_func: Callable[[str], str] | None resilient_parsing: bool auto_envvar_prefix: str | None color: bool | None - _meta: Dict[str, Any] - _close_callbacks: List[Any] + _meta: dict[str, Any] + _close_callbacks: list[Any] _depth: int def __init__( self, @@ -65,12 +50,12 @@ class Context: allow_extra_args: bool | None = ..., allow_interspersed_args: bool | None = ..., ignore_unknown_options: bool | None = ..., - help_option_names: List[str] | None = ..., + help_option_names: list[str] | None = ..., token_normalize_func: Callable[[str], str] | None = ..., color: bool | None = ..., ) -> None: ... @property - def meta(self) -> Dict[str, Any]: ... + def meta(self) -> dict[str, Any]: ... @property def command_path(self) -> str: ... def scope(self, cleanup: bool = ...) -> ContextManager[Context]: ... @@ -94,16 +79,16 @@ class BaseCommand: allow_interspersed_args: bool ignore_unknown_options: bool name: str - context_settings: Dict[Any, Any] - def __init__(self, name: str, context_settings: Dict[Any, Any] | None = ...) -> None: ... + context_settings: dict[Any, Any] + def __init__(self, name: str, context_settings: dict[Any, Any] | None = ...) -> None: ... def get_usage(self, ctx: Context) -> str: ... def get_help(self, ctx: Context) -> str: ... - def make_context(self, info_name: str, args: List[str], parent: Context | None = ..., **extra: Any) -> Context: ... - def parse_args(self, ctx: Context, args: List[str]) -> List[str]: ... + def make_context(self, info_name: str, args: list[str], parent: Context | None = ..., **extra: Any) -> Context: ... + def parse_args(self, ctx: Context, args: list[str]) -> list[str]: ... def invoke(self, ctx: Context) -> Any: ... def main( self, - args: List[str] | None = ..., + args: list[str] | None = ..., prog_name: str | None = ..., complete_var: str | None = ..., standalone_mode: bool = ..., @@ -113,7 +98,7 @@ class BaseCommand: class Command(BaseCommand): callback: Callable[..., Any] | None - params: List[Parameter] + params: list[Parameter] help: str | None epilog: str | None short_help: str | None @@ -125,9 +110,9 @@ class Command(BaseCommand): def __init__( self, name: str, - context_settings: Dict[Any, Any] | None = ..., + context_settings: dict[Any, Any] | None = ..., callback: Callable[..., Any] | None = ..., - params: List[Parameter] | None = ..., + params: list[Parameter] | None = ..., help: str | None = ..., epilog: str | None = ..., short_help: str | None = ..., @@ -137,9 +122,9 @@ class Command(BaseCommand): hidden: bool = ..., deprecated: bool = ..., ) -> None: ... - def get_params(self, ctx: Context) -> List[Parameter]: ... + def get_params(self, ctx: Context) -> list[Parameter]: ... def format_usage(self, ctx: Context, formatter: HelpFormatter) -> None: ... - def collect_usage_pieces(self, ctx: Context) -> List[str]: ... + def collect_usage_pieces(self, ctx: Context) -> list[str]: ... def get_help_option_names(self, ctx: Context) -> Set[str]: ... def get_help_option(self, ctx: Context) -> Option | None: ... def make_parser(self, ctx: Context) -> OptionParser: ... @@ -170,20 +155,20 @@ class MultiCommand(Command): ) -> None: ... def resultcallback(self, replace: bool = ...) -> Callable[[_F], _F]: ... def format_commands(self, ctx: Context, formatter: HelpFormatter) -> None: ... - def resolve_command(self, ctx: Context, args: List[str]) -> Tuple[str, Command, List[str]]: ... + def resolve_command(self, ctx: Context, args: list[str]) -> Tuple[str, Command, list[str]]: ... def get_command(self, ctx: Context, cmd_name: str) -> Command | None: ... def list_commands(self, ctx: Context) -> Iterable[str]: ... class Group(MultiCommand): - commands: Dict[str, Command] - def __init__(self, name: str | None = ..., commands: Dict[str, Command] | None = ..., **attrs: Any) -> None: ... + commands: dict[str, Command] + def __init__(self, name: str | None = ..., commands: dict[str, Command] | None = ..., **attrs: Any) -> None: ... def add_command(self, cmd: Command, name: str | None = ...) -> None: ... def command(self, *args: Any, **kwargs: Any) -> Callable[[Callable[..., Any]], Command]: ... def group(self, *args: Any, **kwargs: Any) -> Callable[[Callable[..., Any]], Group]: ... class CommandCollection(MultiCommand): - sources: List[MultiCommand] - def __init__(self, name: str | None = ..., sources: List[MultiCommand] | None = ..., **attrs: Any) -> None: ... + sources: list[MultiCommand] + def __init__(self, name: str | None = ..., sources: list[MultiCommand] | None = ..., **attrs: Any) -> None: ... def add_source(self, multi_cmd: MultiCommand) -> None: ... class _ParamType: @@ -194,7 +179,7 @@ class _ParamType: def get_metavar(self, param: Parameter) -> str: ... def get_missing_message(self, param: Parameter) -> str: ... def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> Any: ... - def split_envvar_value(self, rv: str) -> List[str]: ... + def split_envvar_value(self, rv: str) -> list[str]: ... def fail(self, message: str, param: Parameter | None = ..., ctx: Context | None = ...) -> NoReturn: ... # This type is here to resolve https://github.com/python/mypy/issues/5275 @@ -205,8 +190,8 @@ _ConvertibleType = Union[ class Parameter: param_type_name: str name: str - opts: List[str] - secondary_opts: List[str] + opts: list[str] + secondary_opts: list[str] type: _ParamType required: bool callback: Callable[[Context, Parameter, str], Any] | None @@ -216,7 +201,7 @@ class Parameter: default: Any is_eager: bool metavar: str | None - envvar: str | List[str] | None + envvar: str | list[str] | None def __init__( self, param_decls: Iterable[str] | None = ..., @@ -228,23 +213,23 @@ class Parameter: metavar: str | None = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: str | List[str] | None = ..., + envvar: str | list[str] | None = ..., ) -> None: ... @property def human_readable_name(self) -> str: ... def make_metavar(self) -> str: ... def get_default(self, ctx: Context) -> Any: ... def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: ... - def consume_value(self, ctx: Context, opts: Dict[str, Any]) -> Any: ... + def consume_value(self, ctx: Context, opts: dict[str, Any]) -> Any: ... def type_cast_value(self, ctx: Context, value: Any) -> Any: ... def process_value(self, ctx: Context, value: Any) -> Any: ... def value_is_missing(self, value: Any) -> bool: ... def full_process_value(self, ctx: Context, value: Any) -> Any: ... def resolve_envvar_value(self, ctx: Context) -> str: ... - def value_from_envvar(self, ctx: Context) -> str | List[str]: ... - def handle_parse_result(self, ctx: Context, opts: Dict[str, Any], args: List[str]) -> Tuple[Any, List[str]]: ... + def value_from_envvar(self, ctx: Context) -> str | list[str]: ... + def handle_parse_result(self, ctx: Context, opts: dict[str, Any], args: list[str]) -> Tuple[Any, list[str]]: ... def get_help_record(self, ctx: Context) -> Tuple[str, str]: ... - def get_usage_pieces(self, ctx: Context) -> List[str]: ... + def get_usage_pieces(self, ctx: Context) -> list[str]: ... def get_error_hint(self, ctx: Context) -> str: ... class Option(Parameter): diff --git a/stubs/click/click/decorators.pyi b/stubs/click/click/decorators.pyi index b0cd8133308c..2401e060e868 100644 --- a/stubs/click/click/decorators.pyi +++ b/stubs/click/click/decorators.pyi @@ -1,6 +1,6 @@ from _typeshed import IdentityFunction from distutils.version import Version -from typing import Any, Callable, Dict, Iterable, List, Text, Tuple, Type, TypeVar, Union, overload +from typing import Any, Callable, Iterable, Text, Tuple, Type, TypeVar, Union, overload from click.core import Argument, Command, Context, Group, Option, Parameter, _ConvertibleType @@ -20,7 +20,7 @@ def command( name: str | None = ..., cls: Type[Command] | None = ..., # Command - context_settings: Dict[Any, Any] | None = ..., + context_settings: dict[Any, Any] | None = ..., help: str | None = ..., epilog: str | None = ..., short_help: str | None = ..., @@ -37,7 +37,7 @@ def group( name: str | None = ..., cls: Type[Command] = ..., # Group - commands: Dict[str, Command] | None = ..., + commands: dict[str, Command] | None = ..., # MultiCommand invoke_without_command: bool = ..., no_args_is_help: bool | None = ..., @@ -68,8 +68,8 @@ def argument( metavar: str | None = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: str | List[str] | None = ..., - autocompletion: Callable[[Context, List[str], str], Iterable[str | Tuple[str, str]]] | None = ..., + envvar: str | list[str] | None = ..., + autocompletion: Callable[[Context, list[str], str], Iterable[str | Tuple[str, str]]] | None = ..., ) -> IdentityFunction: ... @overload def option( @@ -96,7 +96,7 @@ def option( metavar: str | None = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: str | List[str] | None = ..., + envvar: str | list[str] | None = ..., # User-defined **kwargs: Any, ) -> IdentityFunction: ... @@ -125,7 +125,7 @@ def option( metavar: str | None = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: str | List[str] | None = ..., + envvar: str | list[str] | None = ..., # User-defined **kwargs: Any, ) -> IdentityFunction: ... @@ -154,7 +154,7 @@ def option( metavar: str | None = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: str | List[str] | None = ..., + envvar: str | list[str] | None = ..., # User-defined **kwargs: Any, ) -> IdentityFunction: ... @@ -183,7 +183,7 @@ def option( metavar: str | None = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: str | List[str] | None = ..., + envvar: str | list[str] | None = ..., # User-defined **kwargs: Any, ) -> IdentityFunction: ... @@ -210,7 +210,7 @@ def confirmation_option( metavar: str | None = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: str | List[str] | None = ..., + envvar: str | list[str] | None = ..., ) -> IdentityFunction: ... def password_option( *param_decls: str, @@ -235,7 +235,7 @@ def password_option( metavar: str | None = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: str | List[str] | None = ..., + envvar: str | list[str] | None = ..., ) -> IdentityFunction: ... def version_option( version: str | Version | None = ..., @@ -263,7 +263,7 @@ def version_option( metavar: str | None = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: str | List[str] | None = ..., + envvar: str | list[str] | None = ..., ) -> IdentityFunction: ... def help_option( *param_decls: str, @@ -288,5 +288,5 @@ def help_option( metavar: str | None = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: str | List[str] | None = ..., + envvar: str | list[str] | None = ..., ) -> IdentityFunction: ... diff --git a/stubs/click/click/exceptions.pyi b/stubs/click/click/exceptions.pyi index 8a89649b99f0..fa1a2c3e7911 100644 --- a/stubs/click/click/exceptions.pyi +++ b/stubs/click/click/exceptions.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, List +from typing import IO, Any from click.core import Command, Context, Parameter @@ -35,9 +35,9 @@ class MissingParameter(BadParameter): class NoSuchOption(UsageError): option_name: str - possibilities: List[str] | None + possibilities: list[str] | None def __init__( - self, option_name: str, message: str | None = ..., possibilities: List[str] | None = ..., ctx: Context | None = ... + self, option_name: str, message: str | None = ..., possibilities: list[str] | None = ..., ctx: Context | None = ... ) -> None: ... class BadOptionUsage(UsageError): diff --git a/stubs/click/click/formatting.pyi b/stubs/click/click/formatting.pyi index 60b5c605e5e0..08c607a66837 100644 --- a/stubs/click/click/formatting.pyi +++ b/stubs/click/click/formatting.pyi @@ -1,4 +1,4 @@ -from typing import ContextManager, Generator, Iterable, List, Tuple +from typing import ContextManager, Generator, Iterable, Tuple FORCED_WIDTH: int | None @@ -12,7 +12,7 @@ class HelpFormatter: indent_increment: int width: int | None current_indent: int - buffer: List[str] + buffer: list[str] def __init__(self, indent_increment: int = ..., width: int | None = ..., max_width: int | None = ...) -> None: ... def write(self, string: str) -> None: ... def indent(self) -> None: ... @@ -26,4 +26,4 @@ class HelpFormatter: def indentation(self) -> ContextManager[None]: ... def getvalue(self) -> str: ... -def join_options(options: List[str]) -> Tuple[str, bool]: ... +def join_options(options: list[str]) -> Tuple[str, bool]: ... diff --git a/stubs/click/click/parser.pyi b/stubs/click/click/parser.pyi index 51182494034e..70324011b50c 100644 --- a/stubs/click/click/parser.pyi +++ b/stubs/click/click/parser.pyi @@ -1,11 +1,11 @@ -from typing import Any, Dict, Iterable, List, Set, Tuple +from typing import Any, Iterable, Set, Tuple from click.core import Context -def _unpack_args(args: Iterable[str], nargs_spec: Iterable[int]) -> Tuple[Tuple[Tuple[str, ...] | None, ...], List[str]]: ... +def _unpack_args(args: Iterable[str], nargs_spec: Iterable[int]) -> Tuple[Tuple[Tuple[str, ...] | None, ...], list[str]]: ... def split_opt(opt: str) -> Tuple[str, str]: ... def normalize_opt(opt: str, ctx: Context) -> str: ... -def split_arg_string(string: str) -> List[str]: ... +def split_arg_string(string: str) -> list[str]: ... class Option: dest: str @@ -14,8 +14,8 @@ class Option: const: Any obj: Any prefixes: Set[str] - _short_opts: List[str] - _long_opts: List[str] + _short_opts: list[str] + _long_opts: list[str] def __init__( self, opts: Iterable[str], @@ -37,20 +37,20 @@ class Argument: def process(self, value: Any, state: ParsingState) -> None: ... class ParsingState: - opts: Dict[str, Any] - largs: List[str] - rargs: List[str] - order: List[Any] - def __init__(self, rargs: List[str]) -> None: ... + opts: dict[str, Any] + largs: list[str] + rargs: list[str] + order: list[Any] + def __init__(self, rargs: list[str]) -> None: ... class OptionParser: ctx: Context | None allow_interspersed_args: bool ignore_unknown_options: bool - _short_opt: Dict[str, Option] - _long_opt: Dict[str, Option] + _short_opt: dict[str, Option] + _long_opt: dict[str, Option] _opt_prefixes: Set[str] - _args: List[Argument] + _args: list[Argument] def __init__(self, ctx: Context | None = ...) -> None: ... def add_option( self, @@ -62,4 +62,4 @@ class OptionParser: obj: Any | None = ..., ) -> None: ... def add_argument(self, dest: str, nargs: int = ..., obj: Any | None = ...) -> None: ... - def parse_args(self, args: List[str]) -> Tuple[Dict[str, Any], List[str], List[Any]]: ... + def parse_args(self, args: list[str]) -> Tuple[dict[str, Any], list[str], list[Any]]: ... diff --git a/stubs/click/click/testing.pyi b/stubs/click/click/testing.pyi index 82dcc29e787f..d83881b59bdf 100644 --- a/stubs/click/click/testing.pyi +++ b/stubs/click/click/testing.pyi @@ -1,5 +1,5 @@ import io -from typing import IO, Any, BinaryIO, ContextManager, Dict, Iterable, List, Mapping, Text, Tuple +from typing import IO, Any, BinaryIO, ContextManager, Iterable, Mapping, Text, Tuple from typing_extensions import Literal from .core import BaseCommand @@ -11,7 +11,7 @@ class EchoingStdin: def __getattr__(self, x: str) -> Any: ... def read(self, n: int = ...) -> bytes: ... def readline(self, n: int = ...) -> bytes: ... - def readlines(self) -> List[bytes]: ... + def readlines(self) -> list[bytes]: ... def __iter__(self) -> Iterable[bytes]: ... def make_input_stream(input: bytes | Text | IO[Any] | None, charset: Text) -> BinaryIO: ... @@ -48,7 +48,7 @@ class CliRunner: self, charset: Text | None = ..., env: Mapping[str, str] | None = ..., echo_stdin: bool = ..., mix_stderr: bool = ... ) -> None: ... def get_default_prog_name(self, cli: BaseCommand) -> str: ... - def make_env(self, overrides: Mapping[str, str] | None = ...) -> Dict[str, str]: ... + def make_env(self, overrides: Mapping[str, str] | None = ...) -> dict[str, str]: ... def isolation( self, input: bytes | Text | IO[Any] | None = ..., env: Mapping[str, str] | None = ..., color: bool = ... ) -> ContextManager[Tuple[io.BytesIO, io.BytesIO | Literal[False]]]: ... diff --git a/stubs/click/click/types.pyi b/stubs/click/click/types.pyi index 2b9fe305f85d..f1e9b9ca078c 100644 --- a/stubs/click/click/types.pyi +++ b/stubs/click/click/types.pyi @@ -1,6 +1,6 @@ import datetime import uuid -from typing import IO, Any, Callable, Generic, Iterable, List, Optional, Sequence, Text, Tuple as _PyTuple, Type, TypeVar, Union +from typing import IO, Any, Callable, Generic, Iterable, Optional, Sequence, Text, Tuple as _PyTuple, Type, TypeVar, Union from click.core import Context, Parameter, _ConvertibleType, _ParamType @@ -102,7 +102,7 @@ class StringParamType(ParamType): def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> str: ... class Tuple(CompositeParamType): - types: List[ParamType] + types: list[ParamType] def __init__(self, types: Iterable[Any]) -> None: ... def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> Tuple: ... def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> Tuple: ... diff --git a/stubs/click/click/utils.pyi b/stubs/click/click/utils.pyi index fc753c4af798..f97dd8e81b8a 100644 --- a/stubs/click/click/utils.pyi +++ b/stubs/click/click/utils.pyi @@ -1,5 +1,5 @@ from types import TracebackType -from typing import IO, Any, AnyStr, Generic, Iterator, List, Text, Type, TypeVar +from typing import IO, Any, AnyStr, Generic, Iterator, Text, Type, TypeVar _T = TypeVar("_T") @@ -43,6 +43,6 @@ def get_text_stream(name: str, encoding: str | None = ..., errors: str = ...) -> def open_file( filename: str, mode: str = ..., encoding: str | None = ..., errors: str = ..., lazy: bool = ..., atomic: bool = ... ) -> Any: ... # really IO | LazyFile | KeepOpenFile -def get_os_args() -> List[str]: ... +def get_os_args() -> list[str]: ... def format_filename(filename: str, shorten: bool = ...) -> str: ... def get_app_dir(app_name: str, roaming: bool = ..., force_posix: bool = ...) -> str: ... diff --git a/stubs/croniter/croniter.pyi b/stubs/croniter/croniter.pyi index 3d54a0dd3db2..22cd88b343ce 100644 --- a/stubs/croniter/croniter.pyi +++ b/stubs/croniter/croniter.pyi @@ -1,5 +1,5 @@ import datetime -from typing import Any, Dict, Iterator, List, Text, Tuple, Type, TypeVar, Union +from typing import Any, Iterator, Text, Tuple, Type, TypeVar, Union _RetType = Union[Type[float], Type[datetime.datetime]] _SelfT = TypeVar("_SelfT", bound=croniter) @@ -13,15 +13,15 @@ class croniter(Iterator[Any]): MONTHS_IN_YEAR: int RANGES: Tuple[Tuple[int, int], ...] DAYS: Tuple[int, ...] - ALPHACONV: Tuple[Dict[str, Any], ...] - LOWMAP: Tuple[Dict[int, Any], ...] + ALPHACONV: Tuple[dict[str, Any], ...] + LOWMAP: Tuple[dict[int, Any], ...] bad_length: str tzinfo: datetime.tzinfo | None cur: float - expanded: List[List[str]] + expanded: list[list[str]] start_time: float dst_start_time: float - nth_weekday_of_month: Dict[str, Any] + nth_weekday_of_month: dict[str, Any] def __init__( self, expr_format: Text, @@ -45,6 +45,6 @@ class croniter(Iterator[Any]): def iter(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ... def is_leap(self, year: int) -> bool: ... @classmethod - def expand(cls, expr_format: Text) -> Tuple[List[List[str]], Dict[str, Any]]: ... + def expand(cls, expr_format: Text) -> Tuple[list[list[str]], dict[str, Any]]: ... @classmethod def is_valid(cls, expression: Text) -> bool: ... diff --git a/stubs/cryptography/cryptography/fernet.pyi b/stubs/cryptography/cryptography/fernet.pyi index 62a39efc0a91..2eb1e189bbe0 100644 --- a/stubs/cryptography/cryptography/fernet.pyi +++ b/stubs/cryptography/cryptography/fernet.pyi @@ -1,4 +1,4 @@ -from typing import List, Text +from typing import Text class InvalidToken(Exception): ... @@ -16,7 +16,7 @@ class Fernet(object): def generate_key(cls) -> bytes: ... class MultiFernet(object): - def __init__(self, fernets: List[Fernet]) -> None: ... + def __init__(self, fernets: list[Fernet]) -> None: ... def decrypt(self, token: bytes, ttl: int | None = ...) -> bytes: ... # See a note above on the typing of the ttl parameter. def decrypt_at_time(self, token: bytes, ttl: int, current_time: int) -> bytes: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs12.pyi b/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs12.pyi index c075872540d1..40b555bd29fa 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs12.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs12.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Tuple +from typing import Any, Tuple from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKeyWithSerialization from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKeyWithSerialization @@ -8,11 +8,11 @@ from cryptography.x509 import Certificate def load_key_and_certificates( data: bytes, password: bytes | None, backend: Any | None = ... -) -> Tuple[Any | None, Certificate | None, List[Certificate]]: ... +) -> Tuple[Any | None, Certificate | None, list[Certificate]]: ... def serialize_key_and_certificates( name: bytes, key: RSAPrivateKeyWithSerialization | EllipticCurvePrivateKeyWithSerialization | DSAPrivateKeyWithSerialization, cert: Certificate | None, - cas: List[Certificate] | None, + cas: list[Certificate] | None, enc: KeySerializationEncryption, ) -> bytes: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi b/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi index 27a5ddf25fe4..c403282f3df2 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi @@ -1,5 +1,5 @@ from enum import Enum -from typing import Any, Iterable, List +from typing import Any, Iterable from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey @@ -7,8 +7,8 @@ from cryptography.hazmat.primitives.hashes import SHA1, SHA224, SHA256, SHA384, from cryptography.hazmat.primitives.serialization import Encoding from cryptography.x509 import Certificate -def load_pem_pkcs7_certificates(data: bytes) -> List[Certificate]: ... -def load_der_pkcs7_certificates(data: bytes) -> List[Certificate]: ... +def load_pem_pkcs7_certificates(data: bytes) -> list[Certificate]: ... +def load_der_pkcs7_certificates(data: bytes) -> list[Certificate]: ... class PKCS7Options(Enum): Text: str diff --git a/stubs/cryptography/cryptography/x509/__init__.pyi b/stubs/cryptography/cryptography/x509/__init__.pyi index 9e95f3ed0beb..be3b7bdabd3f 100644 --- a/stubs/cryptography/cryptography/x509/__init__.pyi +++ b/stubs/cryptography/cryptography/x509/__init__.pyi @@ -2,7 +2,7 @@ import datetime from abc import ABCMeta, abstractmethod from enum import Enum from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network -from typing import Any, ClassVar, Generator, Generic, Iterable, List, Sequence, Text, Type, TypeVar +from typing import Any, ClassVar, Generator, Generic, Iterable, Sequence, Text, Type, TypeVar from cryptography.hazmat.backends.interfaces import X509Backend from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey @@ -112,17 +112,17 @@ class NameAttribute(object): def rfc4514_string(self) -> str: ... class RelativeDistinguishedName(object): - def __init__(self, attributes: List[NameAttribute]) -> None: ... + def __init__(self, attributes: list[NameAttribute]) -> None: ... def __iter__(self) -> Generator[NameAttribute, None, None]: ... - def get_attributes_for_oid(self, oid: ObjectIdentifier) -> List[NameAttribute]: ... + def get_attributes_for_oid(self, oid: ObjectIdentifier) -> list[NameAttribute]: ... def rfc4514_string(self) -> str: ... class Name(object): - rdns: List[RelativeDistinguishedName] + rdns: list[RelativeDistinguishedName] def __init__(self, attributes: Sequence[NameAttribute | RelativeDistinguishedName]) -> None: ... def __iter__(self) -> Generator[NameAttribute, None, None]: ... def __len__(self) -> int: ... - def get_attributes_for_oid(self, oid: ObjectIdentifier) -> List[NameAttribute]: ... + def get_attributes_for_oid(self, oid: ObjectIdentifier) -> list[NameAttribute]: ... def public_bytes(self, backend: X509Backend | None = ...) -> bytes: ... def rfc4514_string(self) -> str: ... @@ -290,7 +290,7 @@ class Extension(Generic[_T]): value: _T class Extensions(object): - def __init__(self, general_names: List[Extension[Any]]) -> None: ... + def __init__(self, general_names: list[Extension[Any]]) -> None: ... def __iter__(self) -> Generator[Extension[Any], None, None]: ... def get_extension_for_oid(self, oid: ObjectIdentifier) -> Extension[Any]: ... def get_extension_for_class(self, extclass: Type[_T]) -> Extension[_T]: ... @@ -304,20 +304,20 @@ class ExtensionNotFound(Exception): def __init__(self, msg: str, oid: ObjectIdentifier) -> None: ... class IssuerAlternativeName(ExtensionType): - def __init__(self, general_names: List[GeneralName]) -> None: ... + def __init__(self, general_names: list[GeneralName]) -> None: ... def __iter__(self) -> Generator[GeneralName, None, None]: ... - def get_values_for_type(self, type: Type[GeneralName]) -> List[Any]: ... + def get_values_for_type(self, type: Type[GeneralName]) -> list[Any]: ... class SubjectAlternativeName(ExtensionType): - def __init__(self, general_names: List[GeneralName]) -> None: ... + def __init__(self, general_names: list[GeneralName]) -> None: ... def __iter__(self) -> Generator[GeneralName, None, None]: ... - def get_values_for_type(self, type: Type[GeneralName]) -> List[Any]: ... + def get_values_for_type(self, type: Type[GeneralName]) -> list[Any]: ... class AuthorityKeyIdentifier(ExtensionType): @property def key_identifier(self) -> bytes: ... @property - def authority_cert_issuer(self) -> List[GeneralName] | None: ... + def authority_cert_issuer(self) -> list[GeneralName] | None: ... @property def authority_cert_serial_number(self) -> int | None: ... def __init__( diff --git a/stubs/cryptography/cryptography/x509/oid.pyi b/stubs/cryptography/cryptography/x509/oid.pyi index 7daf8aee55e2..2ca14b95ff64 100644 --- a/stubs/cryptography/cryptography/x509/oid.pyi +++ b/stubs/cryptography/cryptography/x509/oid.pyi @@ -1,5 +1,3 @@ -from typing import Dict - from cryptography.hazmat.primitives.hashes import HashAlgorithm from cryptography.x509 import ObjectIdentifier @@ -101,6 +99,6 @@ class CertificatePoliciesOID: CPS_USER_NOTICE: ObjectIdentifier = ... ANY_POLICY: ObjectIdentifier = ... -_OID_NAMES: Dict[ObjectIdentifier, str] = ... +_OID_NAMES: dict[ObjectIdentifier, str] = ... -_SIG_OIDS_TO_HASH: Dict[ObjectIdentifier, HashAlgorithm | None] = ... +_SIG_OIDS_TO_HASH: dict[ObjectIdentifier, HashAlgorithm | None] = ... diff --git a/stubs/dataclasses/dataclasses.pyi b/stubs/dataclasses/dataclasses.pyi index 9117eb79db9f..871ccabf1674 100644 --- a/stubs/dataclasses/dataclasses.pyi +++ b/stubs/dataclasses/dataclasses.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Tuple, Type, TypeVar, overload +from typing import Any, Callable, Generic, Iterable, Mapping, Tuple, Type, TypeVar, overload if sys.version_info >= (3, 9): from types import GenericAlias @@ -11,13 +11,13 @@ class _MISSING_TYPE: ... MISSING: _MISSING_TYPE @overload -def asdict(obj: Any) -> Dict[str, Any]: ... +def asdict(obj: Any) -> dict[str, Any]: ... @overload -def asdict(obj: Any, *, dict_factory: Callable[[List[Tuple[str, Any]]], _T]) -> _T: ... +def asdict(obj: Any, *, dict_factory: Callable[[list[Tuple[str, Any]]], _T]) -> _T: ... @overload def astuple(obj: Any) -> Tuple[Any, ...]: ... @overload -def astuple(obj: Any, *, tuple_factory: Callable[[List[Any]], _T]) -> _T: ... +def astuple(obj: Any, *, tuple_factory: Callable[[list[Any]], _T]) -> _T: ... @overload def dataclass(_cls: Type[_T]) -> Type[_T]: ... @overload @@ -80,7 +80,7 @@ def make_dataclass( fields: Iterable[str | Tuple[str, type] | Tuple[str, type, Field[Any]]], *, bases: Tuple[type, ...] = ..., - namespace: Dict[str, Any] | None = ..., + namespace: dict[str, Any] | None = ..., init: bool = ..., repr: bool = ..., eq: bool = ..., diff --git a/stubs/dateparser/dateparser.pyi b/stubs/dateparser/dateparser.pyi index 3401001e0eef..d1a9ad22fe79 100644 --- a/stubs/dateparser/dateparser.pyi +++ b/stubs/dateparser/dateparser.pyi @@ -1,13 +1,13 @@ import datetime -from typing import Any, List, Mapping, Set, Tuple +from typing import Any, Mapping, Set, Tuple __version__: str def parse( date_string: str, - date_formats: List[str] | Tuple[str] | Set[str] | None = ..., - languages: List[str] | Tuple[str] | Set[str] | None = ..., - locales: List[str] | Tuple[str] | Set[str] | None = ..., + date_formats: list[str] | Tuple[str] | Set[str] | None = ..., + languages: list[str] | Tuple[str] | Set[str] | None = ..., + locales: list[str] | Tuple[str] | Set[str] | None = ..., region: str | None = ..., settings: Mapping[str, Any] | None = ..., ) -> datetime.datetime | None: ... diff --git a/stubs/emoji/emoji/core.pyi b/stubs/emoji/emoji/core.pyi index f0d765663430..96b04d026223 100644 --- a/stubs/emoji/emoji/core.pyi +++ b/stubs/emoji/emoji/core.pyi @@ -1,4 +1,4 @@ -from typing import Dict, List, Pattern, Text, Tuple +from typing import Pattern, Text, Tuple from typing_extensions import Literal _DEFAULT_DELIMITER: str @@ -12,6 +12,6 @@ def emojize( ) -> str: ... def demojize(string: str, use_aliases: bool = ..., delimiters: Tuple[str, str] = ..., language: str = ...) -> str: ... def get_emoji_regexp(language: str = ...) -> Pattern[Text]: ... -def emoji_lis(string: str, language: str = ...) -> List[Dict[str, int | str]]: ... -def distinct_emoji_lis(string: str) -> List[str]: ... +def emoji_lis(string: str, language: str = ...) -> list[dict[str, int | str]]: ... +def distinct_emoji_lis(string: str) -> list[str]: ... def emoji_count(string: str) -> int: ... diff --git a/stubs/emoji/emoji/unicode_codes/__init__.pyi b/stubs/emoji/emoji/unicode_codes/__init__.pyi index a326b7652199..3dcd4dda06b6 100644 --- a/stubs/emoji/emoji/unicode_codes/__init__.pyi +++ b/stubs/emoji/emoji/unicode_codes/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Dict, Text +from typing import Text from .en import ( EMOJI_ALIAS_UNICODE_ENGLISH as EMOJI_ALIAS_UNICODE_ENGLISH, @@ -10,5 +10,5 @@ from .es import EMOJI_UNICODE_SPANISH as EMOJI_UNICODE_SPANISH, UNICODE_EMOJI_SP from .it import EMOJI_UNICODE_ITALIAN as EMOJI_UNICODE_ITALIAN, UNICODE_EMOJI_ITALIAN as UNICODE_EMOJI_ITALIAN from .pt import EMOJI_UNICODE_PORTUGUESE as EMOJI_UNICODE_PORTUGUESE, UNICODE_EMOJI_PORTUGUESE as UNICODE_EMOJI_PORTUGUESE -EMOJI_UNICODE: Dict[str, Dict[Text, Text]] -UNICODE_EMOJI: Dict[str, Dict[Text, Text]] +EMOJI_UNICODE: dict[str, dict[Text, Text]] +UNICODE_EMOJI: dict[str, dict[Text, Text]] diff --git a/stubs/emoji/emoji/unicode_codes/en.pyi b/stubs/emoji/emoji/unicode_codes/en.pyi index dc720927cb75..c9f5842f4375 100644 --- a/stubs/emoji/emoji/unicode_codes/en.pyi +++ b/stubs/emoji/emoji/unicode_codes/en.pyi @@ -1,6 +1,6 @@ -from typing import Dict, Text +from typing import Text -EMOJI_ALIAS_UNICODE_ENGLISH: Dict[Text, Text] -EMOJI_UNICODE_ENGLISH: Dict[Text, Text] -UNICODE_EMOJI_ENGLISH: Dict[Text, Text] -UNICODE_EMOJI_ALIAS_ENGLISH: Dict[Text, Text] +EMOJI_ALIAS_UNICODE_ENGLISH: dict[Text, Text] +EMOJI_UNICODE_ENGLISH: dict[Text, Text] +UNICODE_EMOJI_ENGLISH: dict[Text, Text] +UNICODE_EMOJI_ALIAS_ENGLISH: dict[Text, Text] diff --git a/stubs/emoji/emoji/unicode_codes/es.pyi b/stubs/emoji/emoji/unicode_codes/es.pyi index 4bcf12685911..f16505b47cb7 100644 --- a/stubs/emoji/emoji/unicode_codes/es.pyi +++ b/stubs/emoji/emoji/unicode_codes/es.pyi @@ -1,4 +1,4 @@ -from typing import Dict, Text +from typing import Text -EMOJI_UNICODE_SPANISH: Dict[Text, Text] -UNICODE_EMOJI_SPANISH: Dict[Text, Text] +EMOJI_UNICODE_SPANISH: dict[Text, Text] +UNICODE_EMOJI_SPANISH: dict[Text, Text] diff --git a/stubs/emoji/emoji/unicode_codes/it.pyi b/stubs/emoji/emoji/unicode_codes/it.pyi index a546b815182a..1edefd24077a 100644 --- a/stubs/emoji/emoji/unicode_codes/it.pyi +++ b/stubs/emoji/emoji/unicode_codes/it.pyi @@ -1,4 +1,4 @@ -from typing import Dict, Text +from typing import Text -EMOJI_UNICODE_ITALIAN: Dict[Text, Text] -UNICODE_EMOJI_ITALIAN: Dict[Text, Text] +EMOJI_UNICODE_ITALIAN: dict[Text, Text] +UNICODE_EMOJI_ITALIAN: dict[Text, Text] diff --git a/stubs/emoji/emoji/unicode_codes/pt.pyi b/stubs/emoji/emoji/unicode_codes/pt.pyi index 7ee68d46e465..ef94454f2dbb 100644 --- a/stubs/emoji/emoji/unicode_codes/pt.pyi +++ b/stubs/emoji/emoji/unicode_codes/pt.pyi @@ -1,4 +1,4 @@ -from typing import Dict, Text +from typing import Text -EMOJI_UNICODE_PORTUGUESE: Dict[Text, Text] -UNICODE_EMOJI_PORTUGUESE: Dict[Text, Text] +EMOJI_UNICODE_PORTUGUESE: dict[Text, Text] +UNICODE_EMOJI_PORTUGUESE: dict[Text, Text] diff --git a/stubs/mock/mock.pyi b/stubs/mock/mock.pyi index a691fbd34342..efff68bd3ee7 100644 --- a/stubs/mock/mock.pyi +++ b/stubs/mock/mock.pyi @@ -76,10 +76,10 @@ class NonCallableMock(Base, Any): # type: ignore 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 = ..., diff --git a/stubs/mypy-extensions/mypy_extensions.pyi b/stubs/mypy-extensions/mypy_extensions.pyi index b59eb17e33f3..fc6de37d07d1 100644 --- a/stubs/mypy-extensions/mypy_extensions.pyi +++ b/stubs/mypy-extensions/mypy_extensions.pyi @@ -1,6 +1,6 @@ import abc import sys -from typing import Any, Callable, Dict, Generic, ItemsView, KeysView, Mapping, Type, TypeVar, Union, ValuesView +from typing import Any, Callable, Generic, ItemsView, KeysView, Mapping, Type, TypeVar, Union, ValuesView _T = TypeVar("_T") _U = TypeVar("_U") @@ -25,7 +25,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): def viewvalues(self) -> ValuesView[object]: ... def __delitem__(self, k: NoReturn) -> None: ... -def TypedDict(typename: str, fields: Dict[str, Type[Any]], total: bool = ...) -> Type[Dict[str, Any]]: ... +def TypedDict(typename: str, fields: dict[str, Type[Any]], total: bool = ...) -> Type[dict[str, Any]]: ... def Arg(type: _T = ..., name: str | None = ...) -> _T: ... def DefaultArg(type: _T = ..., name: str | None = ...) -> _T: ... def NamedArg(type: _T = ..., name: str | None = ...) -> _T: ... diff --git a/stubs/nmap/nmap/nmap.pyi b/stubs/nmap/nmap/nmap.pyi index 82550de2c9eb..60b8632acd49 100644 --- a/stubs/nmap/nmap/nmap.pyi +++ b/stubs/nmap/nmap/nmap.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Iterable, Iterator, List, Text, Tuple, TypeVar +from typing import Any, Callable, Dict, Iterable, Iterator, Text, Tuple, TypeVar from typing_extensions import TypedDict _T = TypeVar("_T") @@ -6,7 +6,7 @@ _Callback = Callable[[str, _Result], Any] class _Result(TypedDict): nmap: _ResultNmap - scan: Dict[str, PortScannerHostDict] + scan: dict[str, PortScannerHostDict] class _ResultNmap(TypedDict): command_line: str @@ -53,7 +53,7 @@ class PortScanner(object): def __init__(self, nmap_search_path: Iterable[str] = ...) -> None: ... def get_nmap_last_output(self) -> Text: ... def nmap_version(self) -> Tuple[int, int]: ... - def listscan(self, hosts: str = ...) -> List[str]: ... + def listscan(self, hosts: str = ...) -> list[str]: ... def scan(self, hosts: Text = ..., ports: Text | None = ..., arguments: Text = ..., sudo: bool = ...) -> _Result: ... def analyse_nmap_xml_scan( self, @@ -63,7 +63,7 @@ class PortScanner(object): nmap_warn_keep_trace: str = ..., ) -> _Result: ... def __getitem__(self, host: Text) -> PortScannerHostDict: ... - def all_hosts(self) -> List[str]: ... + def all_hosts(self) -> list[str]: ... def command_line(self) -> str: ... def scaninfo(self) -> _ResultNmapInfo: ... def scanstats(self) -> _ResultNampStats: ... @@ -99,21 +99,21 @@ class PortScannerYield(PortScannerAsync): def still_scanning(self) -> None: ... # type: ignore class PortScannerHostDict(Dict[str, Any]): - def hostnames(self) -> List[_ResultHostNames]: ... + def hostnames(self) -> list[_ResultHostNames]: ... def hostname(self) -> str: ... def state(self) -> str: ... def uptime(self) -> _ResulHostUptime: ... - def all_protocols(self) -> List[str]: ... - def all_tcp(self) -> List[int]: ... + def all_protocols(self) -> list[str]: ... + def all_tcp(self) -> list[int]: ... def has_tcp(self, port: int) -> bool: ... def tcp(self, port: int) -> _ResultHostPort: ... - def all_udp(self) -> List[int]: ... + def all_udp(self) -> list[int]: ... def has_udp(self, port: int) -> bool: ... def udp(self, port: int) -> _ResultHostPort: ... - def all_ip(self) -> List[int]: ... + def all_ip(self) -> list[int]: ... def has_ip(self, port: int) -> bool: ... def ip(self, port: int) -> _ResultHostPort: ... - def all_sctp(self) -> List[int]: ... + def all_sctp(self) -> list[int]: ... def has_sctp(self, port: int) -> bool: ... def sctp(self, port: int) -> _ResultHostPort: ... diff --git a/stubs/paramiko/paramiko/agent.pyi b/stubs/paramiko/paramiko/agent.pyi index 3d5aa4bc61b1..768b49bd0ef2 100644 --- a/stubs/paramiko/paramiko/agent.pyi +++ b/stubs/paramiko/paramiko/agent.pyi @@ -1,6 +1,6 @@ from socket import _RetAddress, socket from threading import Thread -from typing import Dict, Protocol, Tuple +from typing import Protocol, Tuple from paramiko.channel import Channel from paramiko.message import Message @@ -45,7 +45,7 @@ class AgentServerProxy(AgentSSH): def __del__(self) -> None: ... def connect(self) -> None: ... def close(self) -> None: ... - def get_env(self) -> Dict[str, str]: ... + def get_env(self) -> dict[str, str]: ... class AgentRequestHandler: def __init__(self, chanClient: Channel) -> None: ... diff --git a/stubs/paramiko/paramiko/auth_handler.pyi b/stubs/paramiko/paramiko/auth_handler.pyi index ffd9c75fb8bb..6c412620ef19 100644 --- a/stubs/paramiko/paramiko/auth_handler.pyi +++ b/stubs/paramiko/paramiko/auth_handler.pyi @@ -32,7 +32,7 @@ class AuthHandler: def auth_gssapi_with_mic(self, username: str, gss_host: str, gss_deleg_creds: bool, event: Event) -> None: ... def auth_gssapi_keyex(self, username: str, event: Event) -> None: ... def abort(self) -> None: ... - def wait_for_response(self, event: Event) -> List[str]: ... + def wait_for_response(self, event: Event) -> list[str]: ... class GssapiWithMicAuthHandler: method: str diff --git a/stubs/paramiko/paramiko/ber.pyi b/stubs/paramiko/paramiko/ber.pyi index 200f5ea58d2b..906dd2564338 100644 --- a/stubs/paramiko/paramiko/ber.pyi +++ b/stubs/paramiko/paramiko/ber.pyi @@ -1,4 +1,4 @@ -from typing import Any, Iterable, List +from typing import Any, Iterable class BERException(Exception): ... @@ -7,10 +7,10 @@ class BER: idx: int def __init__(self, content: bytes = ...) -> None: ... def asbytes(self) -> bytes: ... - def decode(self) -> None | int | List[int]: ... - def decode_next(self) -> None | int | List[int]: ... + def decode(self) -> None | int | list[int]: ... + def decode_next(self) -> None | int | list[int]: ... @staticmethod - def decode_sequence(data: bytes) -> List[int | List[int]]: ... + def decode_sequence(data: bytes) -> list[int | list[int]]: ... def encode_tlv(self, ident: int, val: bytes) -> None: ... def encode(self, x: Any) -> None: ... @staticmethod diff --git a/stubs/paramiko/paramiko/client.pyi b/stubs/paramiko/paramiko/client.pyi index d6b9545ba9d7..c43eaa8babf2 100644 --- a/stubs/paramiko/paramiko/client.pyi +++ b/stubs/paramiko/paramiko/client.pyi @@ -1,5 +1,5 @@ from socket import socket -from typing import Dict, Iterable, Mapping, NoReturn, Tuple, Type +from typing import Iterable, Mapping, NoReturn, Tuple, Type from paramiko.channel import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile from paramiko.hostkeys import HostKeys @@ -37,7 +37,7 @@ class SSHClient(ClosingContextManager): auth_timeout: float | None = ..., gss_trust_dns: bool = ..., passphrase: str | None = ..., - disabled_algorithms: Dict[str, Iterable[str]] | None = ..., + disabled_algorithms: dict[str, Iterable[str]] | None = ..., ) -> None: ... def close(self) -> None: ... def exec_command( @@ -46,7 +46,7 @@ class SSHClient(ClosingContextManager): bufsize: int = ..., timeout: float | None = ..., get_pty: bool = ..., - environment: Dict[str, str] | None = ..., + environment: dict[str, str] | None = ..., ) -> Tuple[ChannelStdinFile, ChannelFile, ChannelStderrFile]: ... def invoke_shell( self, diff --git a/stubs/paramiko/paramiko/common.pyi b/stubs/paramiko/paramiko/common.pyi index abc6d79b2cc5..26c09d4f3e40 100644 --- a/stubs/paramiko/paramiko/common.pyi +++ b/stubs/paramiko/paramiko/common.pyi @@ -1,5 +1,5 @@ import sys -from typing import Dict, Protocol, Text, Union +from typing import Protocol, Text, Union MSG_DISCONNECT: int MSG_IGNORE: int @@ -74,7 +74,7 @@ cMSG_CHANNEL_REQUEST: bytes cMSG_CHANNEL_SUCCESS: bytes cMSG_CHANNEL_FAILURE: bytes -MSG_NAMES: Dict[int, str] +MSG_NAMES: dict[int, str] AUTH_SUCCESSFUL: int AUTH_PARTIALLY_SUCCESSFUL: int @@ -86,7 +86,7 @@ OPEN_FAILED_CONNECT_FAILED: int OPEN_FAILED_UNKNOWN_CHANNEL_TYPE: int OPEN_FAILED_RESOURCE_SHORTAGE: int -CONNECTION_FAILED_CODE: Dict[int, str] +CONNECTION_FAILED_CODE: dict[int, str] DISCONNECT_SERVICE_NOT_AVAILABLE: int DISCONNECT_AUTH_CANCELLED_BY_USER: int diff --git a/stubs/paramiko/paramiko/config.pyi b/stubs/paramiko/paramiko/config.pyi index 99d3c0383192..74b6c260b534 100644 --- a/stubs/paramiko/paramiko/config.pyi +++ b/stubs/paramiko/paramiko/config.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Dict, Iterable, List, Pattern, Set +from typing import IO, Any, Dict, Iterable, Pattern, Set from paramiko.ssh_exception import ConfigParseError as ConfigParseError, CouldNotCanonicalize as CouldNotCanonicalize @@ -6,7 +6,7 @@ SSH_PORT: int class SSHConfig: SETTINGS_REGEX: Pattern[str] - TOKENS_BY_CONFIG_KEY: Dict[str, List[str]] + TOKENS_BY_CONFIG_KEY: dict[str, list[str]] def __init__(self) -> None: ... @classmethod def from_text(cls, text: str) -> SSHConfig: ... diff --git a/stubs/paramiko/paramiko/ecdsakey.pyi b/stubs/paramiko/paramiko/ecdsakey.pyi index 804ae7d468a7..b442356d115b 100644 --- a/stubs/paramiko/paramiko/ecdsakey.pyi +++ b/stubs/paramiko/paramiko/ecdsakey.pyi @@ -1,4 +1,4 @@ -from typing import IO, Any, Callable, List, Sequence, Tuple, Type +from typing import IO, Any, Callable, Sequence, Tuple, Type from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve, EllipticCurvePrivateKey, EllipticCurvePublicKey from cryptography.hazmat.primitives.hashes import HashAlgorithm @@ -16,7 +16,7 @@ class _ECDSACurve: class _ECDSACurveSet: ecdsa_curves: Sequence[_ECDSACurve] def __init__(self, ecdsa_curves: Sequence[_ECDSACurve]) -> None: ... - def get_key_format_identifier_list(self) -> List[str]: ... + def get_key_format_identifier_list(self) -> list[str]: ... def get_by_curve_class(self, curve_class: Type[Any]) -> _ECDSACurve | None: ... def get_by_key_format_identifier(self, key_format_identifier: str) -> _ECDSACurve | None: ... def get_by_key_length(self, key_length: int) -> _ECDSACurve | None: ... @@ -37,7 +37,7 @@ class ECDSAKey(PKey): validate_point: bool = ..., ) -> None: ... @classmethod - def supported_key_format_identifiers(cls: Any) -> List[str]: ... + def supported_key_format_identifiers(cls: Any) -> list[str]: ... def asbytes(self) -> bytes: ... def __hash__(self) -> int: ... def get_name(self) -> str: ... diff --git a/stubs/paramiko/paramiko/file.pyi b/stubs/paramiko/paramiko/file.pyi index df8eae9b32f7..dbf35fc39c93 100644 --- a/stubs/paramiko/paramiko/file.pyi +++ b/stubs/paramiko/paramiko/file.pyi @@ -1,4 +1,4 @@ -from typing import Any, AnyStr, Generic, Iterable, List, Tuple +from typing import Any, AnyStr, Generic, Iterable, Tuple from paramiko.util import ClosingContextManager @@ -28,7 +28,7 @@ class BufferedFile(ClosingContextManager, Generic[AnyStr]): def readinto(self, buff: bytearray) -> int: ... def read(self, size: int | None = ...) -> bytes: ... def readline(self, size: int | None = ...) -> AnyStr: ... - def readlines(self, sizehint: int | None = ...) -> List[AnyStr]: ... + def readlines(self, sizehint: int | None = ...) -> list[AnyStr]: ... def seek(self, offset: int, whence: int = ...) -> None: ... def tell(self) -> int: ... def write(self, data: AnyStr) -> None: ... diff --git a/stubs/paramiko/paramiko/hostkeys.pyi b/stubs/paramiko/paramiko/hostkeys.pyi index d7b6d5d8083a..c099ac7fd0f9 100644 --- a/stubs/paramiko/paramiko/hostkeys.pyi +++ b/stubs/paramiko/paramiko/hostkeys.pyi @@ -1,16 +1,16 @@ -from typing import Iterator, List, Mapping, MutableMapping +from typing import Iterator, Mapping, MutableMapping from paramiko.pkey import PKey class _SubDict(MutableMapping[str, PKey]): # Internal to HostKeys.lookup() - def __init__(self, hostname: str, entries: List[HostKeyEntry], hostkeys: HostKeys) -> None: ... + def __init__(self, hostname: str, entries: list[HostKeyEntry], hostkeys: HostKeys) -> None: ... def __iter__(self) -> Iterator[str]: ... def __len__(self) -> int: ... def __delitem__(self, key: str) -> None: ... def __getitem__(self, key: str) -> PKey: ... def __setitem__(self, key: str, val: PKey) -> None: ... - def keys(self) -> List[str]: ... # type: ignore + def keys(self) -> list[str]: ... # type: ignore class HostKeys(MutableMapping[str, _SubDict]): def __init__(self, filename: str | None = ...) -> None: ... @@ -25,8 +25,8 @@ class HostKeys(MutableMapping[str, _SubDict]): def __getitem__(self, key: str) -> _SubDict: ... def __delitem__(self, key: str) -> None: ... def __setitem__(self, hostname: str, entry: Mapping[str, PKey]) -> None: ... - def keys(self) -> List[str]: ... # type: ignore - def values(self) -> List[_SubDict]: ... # type: ignore + def keys(self) -> list[str]: ... # type: ignore + def values(self) -> list[_SubDict]: ... # type: ignore @staticmethod def hash_host(hostname: str, salt: str | None = ...) -> str: ... @@ -39,7 +39,7 @@ class HostKeyEntry: valid: bool hostnames: str key: PKey - def __init__(self, hostnames: List[str] | None = ..., key: PKey | None = ...) -> None: ... + def __init__(self, hostnames: list[str] | None = ..., key: PKey | None = ...) -> None: ... @classmethod def from_line(cls, line: str, lineno: int | None = ...) -> HostKeyEntry | None: ... def to_line(self) -> str | None: ... diff --git a/stubs/paramiko/paramiko/message.pyi b/stubs/paramiko/paramiko/message.pyi index 604993604deb..e4fd1dfc27da 100644 --- a/stubs/paramiko/paramiko/message.pyi +++ b/stubs/paramiko/paramiko/message.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Iterable, List, Text +from typing import Any, Iterable, Text from .common import _LikeBytes @@ -29,7 +29,7 @@ class Message: def get_string(self) -> bytes: ... def get_text(self) -> Text: ... def get_binary(self) -> bytes: ... - def get_list(self) -> List[str]: ... + def get_list(self) -> list[str]: ... def add_bytes(self, b: bytes) -> Message: ... def add_byte(self, b: bytes) -> Message: ... def add_boolean(self, b: bool) -> Message: ... diff --git a/stubs/paramiko/paramiko/primes.pyi b/stubs/paramiko/paramiko/primes.pyi index a8c716d41a5c..efc7485342af 100644 --- a/stubs/paramiko/paramiko/primes.pyi +++ b/stubs/paramiko/paramiko/primes.pyi @@ -1,8 +1,8 @@ -from typing import Dict, List, Tuple +from typing import Tuple class ModulusPack: - pack: Dict[int, List[Tuple[int, int]]] - discarded: List[Tuple[int, str]] + pack: dict[int, list[Tuple[int, int]]] + discarded: list[Tuple[int, str]] def __init__(self) -> None: ... def read_file(self, filename: str) -> None: ... def get_modulus(self, min: int, prefer: int, max: int) -> Tuple[int, int]: ... diff --git a/stubs/paramiko/paramiko/proxy.pyi b/stubs/paramiko/paramiko/proxy.pyi index 0810605cc334..111e056b0c14 100644 --- a/stubs/paramiko/paramiko/proxy.pyi +++ b/stubs/paramiko/paramiko/proxy.pyi @@ -1,10 +1,10 @@ from subprocess import Popen -from typing import Any, List +from typing import Any from paramiko.util import ClosingContextManager class ProxyCommand(ClosingContextManager): - cmd: List[str] + cmd: list[str] process: Popen[Any] timeout: float | None def __init__(self, command_line: str) -> None: ... diff --git a/stubs/paramiko/paramiko/server.pyi b/stubs/paramiko/paramiko/server.pyi index c4ee38221245..1b18ec52414f 100644 --- a/stubs/paramiko/paramiko/server.pyi +++ b/stubs/paramiko/paramiko/server.pyi @@ -1,5 +1,5 @@ import threading -from typing import Any, List, Tuple +from typing import Any, Tuple from paramiko.channel import Channel from paramiko.message import Message @@ -13,7 +13,7 @@ class ServerInterface: def check_auth_password(self, username: str, password: str) -> int: ... def check_auth_publickey(self, username: str, key: PKey) -> int: ... def check_auth_interactive(self, username: str, submethods: str) -> int | InteractiveQuery: ... - def check_auth_interactive_response(self, responses: List[str]) -> int | InteractiveQuery: ... + def check_auth_interactive_response(self, responses: list[str]) -> int | InteractiveQuery: ... def check_auth_gssapi_with_mic(self, username: str, gss_authenticated: int = ..., cc_file: str | None = ...) -> int: ... def check_auth_gssapi_keyex(self, username: str, gss_authenticated: int = ..., cc_file: str | None = ...) -> int: ... def enable_auth_gssapi(self) -> bool: ... @@ -40,7 +40,7 @@ class ServerInterface: class InteractiveQuery: name: str instructions: str - prompts: List[Tuple[str, bool]] + prompts: list[Tuple[str, bool]] def __init__(self, name: str = ..., instructions: str = ..., *prompts: str | Tuple[str, bool]) -> None: ... def add_prompt(self, prompt: str, echo: bool = ...) -> None: ... diff --git a/stubs/paramiko/paramiko/sftp.pyi b/stubs/paramiko/paramiko/sftp.pyi index c941d6bfe10f..ec0b050692ac 100644 --- a/stubs/paramiko/paramiko/sftp.pyi +++ b/stubs/paramiko/paramiko/sftp.pyi @@ -1,5 +1,4 @@ from logging import Logger -from typing import Dict, List from paramiko.channel import Channel @@ -41,7 +40,7 @@ SFTP_NO_CONNECTION: int SFTP_CONNECTION_LOST: int SFTP_OP_UNSUPPORTED: int -SFTP_DESC: List[str] +SFTP_DESC: list[str] SFTP_FLAG_READ: int SFTP_FLAG_WRITE: int @@ -50,7 +49,7 @@ SFTP_FLAG_CREATE: int SFTP_FLAG_TRUNC: int SFTP_FLAG_EXCL: int -CMD_NAMES: Dict[int, str] +CMD_NAMES: dict[int, str] class SFTPError(Exception): ... diff --git a/stubs/paramiko/paramiko/sftp_attr.pyi b/stubs/paramiko/paramiko/sftp_attr.pyi index 532996598a03..361e4f0b9930 100644 --- a/stubs/paramiko/paramiko/sftp_attr.pyi +++ b/stubs/paramiko/paramiko/sftp_attr.pyi @@ -1,5 +1,4 @@ from os import stat_result -from typing import Dict class SFTPAttributes: FLAG_SIZE: int @@ -15,7 +14,7 @@ class SFTPAttributes: st_mtime: int | None filename: str # only when from_stat() is used longname: str # only when from_stat() is used - attr: Dict[str, str] + attr: dict[str, str] def __init__(self) -> None: ... @classmethod def from_stat(cls, obj: stat_result, filename: str | None = ...) -> SFTPAttributes: ... diff --git a/stubs/paramiko/paramiko/sftp_client.pyi b/stubs/paramiko/paramiko/sftp_client.pyi index 203bf380a534..a8f7b6583abe 100644 --- a/stubs/paramiko/paramiko/sftp_client.pyi +++ b/stubs/paramiko/paramiko/sftp_client.pyi @@ -1,5 +1,5 @@ from logging import Logger -from typing import IO, Any, Callable, Iterator, List, Text, Tuple +from typing import IO, Any, Callable, Iterator, Text, Tuple from paramiko.channel import Channel from paramiko.sftp import BaseSFTP @@ -24,8 +24,8 @@ class SFTPClient(BaseSFTP, ClosingContextManager): ) -> SFTPClient | None: ... def close(self) -> None: ... def get_channel(self) -> Channel | None: ... - def listdir(self, path: str = ...) -> List[str]: ... - def listdir_attr(self, path: str = ...) -> List[SFTPAttributes]: ... + def listdir(self, path: str = ...) -> list[str]: ... + def listdir_attr(self, path: str = ...) -> list[SFTPAttributes]: ... def listdir_iter(self, path: bytes | Text = ..., read_aheads: int = ...) -> Iterator[SFTPAttributes]: ... def open(self, filename: bytes | Text, mode: str = ..., bufsize: int = ...) -> SFTPFile: ... file = open diff --git a/stubs/paramiko/paramiko/sftp_server.pyi b/stubs/paramiko/paramiko/sftp_server.pyi index a0f8cf0b56c4..6193ea1cbdb1 100644 --- a/stubs/paramiko/paramiko/sftp_server.pyi +++ b/stubs/paramiko/paramiko/sftp_server.pyi @@ -1,5 +1,5 @@ from logging import Logger -from typing import Any, Dict, Type +from typing import Any, Type from paramiko.channel import Channel from paramiko.server import ServerInterface, SubsystemHandler @@ -13,8 +13,8 @@ class SFTPServer(BaseSFTP, SubsystemHandler): logger: Logger ultra_debug: bool next_handle: int - file_table: Dict[bytes, SFTPHandle] - folder_table: Dict[bytes, SFTPHandle] + file_table: dict[bytes, SFTPHandle] + folder_table: dict[bytes, SFTPHandle] server: SFTPServerInterface sock: Channel | None def __init__( diff --git a/stubs/paramiko/paramiko/sftp_si.pyi b/stubs/paramiko/paramiko/sftp_si.pyi index 70b7d6b080c0..efca37e842f6 100644 --- a/stubs/paramiko/paramiko/sftp_si.pyi +++ b/stubs/paramiko/paramiko/sftp_si.pyi @@ -1,4 +1,4 @@ -from typing import Any, List +from typing import Any from paramiko.server import ServerInterface from paramiko.sftp_attr import SFTPAttributes @@ -9,7 +9,7 @@ class SFTPServerInterface: def session_started(self) -> None: ... def session_ended(self) -> None: ... def open(self, path: str, flags: int, attr: SFTPAttributes) -> SFTPHandle | int: ... - def list_folder(self, path: str) -> List[SFTPAttributes] | int: ... + def list_folder(self, path: str) -> list[SFTPAttributes] | int: ... def stat(self, path: str) -> SFTPAttributes | int: ... def lstat(self, path: str) -> SFTPAttributes | int: ... def remove(self, path: str) -> int: ... diff --git a/stubs/paramiko/paramiko/ssh_exception.pyi b/stubs/paramiko/paramiko/ssh_exception.pyi index 2911b5a70266..e75afb22b1eb 100644 --- a/stubs/paramiko/paramiko/ssh_exception.pyi +++ b/stubs/paramiko/paramiko/ssh_exception.pyi @@ -1,5 +1,5 @@ import socket -from typing import List, Mapping, Tuple +from typing import Mapping, Tuple from paramiko.pkey import PKey @@ -8,13 +8,13 @@ class AuthenticationException(SSHException): ... class PasswordRequiredException(AuthenticationException): ... class BadAuthenticationType(AuthenticationException): - allowed_types: List[str] + allowed_types: list[str] explanation: str - def __init__(self, explanation: str, types: List[str]) -> None: ... + def __init__(self, explanation: str, types: list[str]) -> None: ... class PartialAuthentication(AuthenticationException): - allowed_types: List[str] - def __init__(self, types: List[str]) -> None: ... + allowed_types: list[str] + def __init__(self, types: list[str]) -> None: ... class ChannelException(SSHException): code: int diff --git a/stubs/paramiko/paramiko/transport.pyi b/stubs/paramiko/paramiko/transport.pyi index 46fdf356f0b5..d4962334484f 100644 --- a/stubs/paramiko/paramiko/transport.pyi +++ b/stubs/paramiko/paramiko/transport.pyi @@ -2,7 +2,7 @@ from logging import Logger from socket import socket from threading import Condition, Event, Lock, Thread from types import ModuleType -from typing import Any, Callable, Dict, Iterable, List, Protocol, Sequence, Tuple, Type +from typing import Any, Callable, Iterable, Protocol, Sequence, Tuple, Type from paramiko.auth_handler import AuthHandler, _InteractiveCallback from paramiko.channel import Channel @@ -45,8 +45,8 @@ class Transport(Thread, ClosingContextManager): in_kex: bool authenticated: bool lock: Lock - channel_events: Dict[int, Event] - channels_seen: Dict[int, bool] + channel_events: dict[int, Event] + channels_seen: dict[int, bool] default_max_packet_size: int default_window_size: int saved_exception: Exception | None @@ -61,13 +61,13 @@ class Transport(Thread, ClosingContextManager): banner_timeout: float handshake_timeout: float auth_timeout: float - disabled_algorithms: Dict[str, Iterable[str]] | None + disabled_algorithms: dict[str, Iterable[str]] | None server_mode: bool server_object: ServerInterface | None - server_key_dict: Dict[str, PKey] - server_accepts: List[Channel] + server_key_dict: dict[str, PKey] + server_accepts: list[Channel] server_accept_cv: Condition - subsystem_table: Dict[str, Tuple[Type[SubsystemHandler], Tuple[Any, ...], Dict[str, Any]]] + subsystem_table: dict[str, Tuple[Type[SubsystemHandler], Tuple[Any, ...], dict[str, Any]]] sys: ModuleType def __init__( self, @@ -76,7 +76,7 @@ class Transport(Thread, ClosingContextManager): default_max_packet_size: int = ..., gss_kex: bool = ..., gss_deleg_creds: bool = ..., - disabled_algorithms: Dict[str, Iterable[str]] | None = ..., + disabled_algorithms: dict[str, Iterable[str]] | None = ..., ) -> None: ... @property def preferred_ciphers(self) -> Sequence[str]: ... @@ -142,15 +142,15 @@ class Transport(Thread, ClosingContextManager): def is_authenticated(self) -> bool: ... def get_username(self) -> str | None: ... def get_banner(self) -> bytes | None: ... - def auth_none(self, username: str) -> List[str]: ... - def auth_password(self, username: str, password: str, event: Event | None = ..., fallback: bool = ...) -> List[str]: ... - def auth_publickey(self, username: str, key: PKey, event: Event | None = ...) -> List[str]: ... - def auth_interactive(self, username: str, handler: _InteractiveCallback, submethods: str = ...) -> List[str]: ... + def auth_none(self, username: str) -> list[str]: ... + def auth_password(self, username: str, password: str, event: Event | None = ..., fallback: bool = ...) -> list[str]: ... + def auth_publickey(self, username: str, key: PKey, event: Event | None = ...) -> list[str]: ... + def auth_interactive(self, username: str, handler: _InteractiveCallback, submethods: str = ...) -> list[str]: ... def auth_interactive_dumb( self, username: str, handler: _InteractiveCallback | None = ..., submethods: str = ... - ) -> List[str]: ... - def auth_gssapi_with_mic(self, username: str, gss_host: str, gss_deleg_creds: bool) -> List[str]: ... - def auth_gssapi_keyex(self, username: str) -> List[str]: ... + ) -> list[str]: ... + def auth_gssapi_with_mic(self, username: str, gss_host: str, gss_deleg_creds: bool) -> list[str]: ... + def auth_gssapi_keyex(self, username: str) -> list[str]: ... def set_log_channel(self, name: str) -> None: ... def get_log_channel(self) -> str: ... def set_hexdump(self, hexdump: bool) -> None: ... @@ -188,5 +188,5 @@ class ChannelMap: def put(self, chanid: int, chan: Channel) -> None: ... def get(self, chanid: int) -> Channel: ... def delete(self, chanid: int) -> None: ... - def values(self) -> List[Channel]: ... + def values(self) -> list[Channel]: ... def __len__(self) -> int: ... diff --git a/stubs/paramiko/paramiko/util.pyi b/stubs/paramiko/paramiko/util.pyi index 4ca921eb47a0..05bd5c73ffe8 100644 --- a/stubs/paramiko/paramiko/util.pyi +++ b/stubs/paramiko/paramiko/util.pyi @@ -1,7 +1,7 @@ import sys from logging import Logger, LogRecord from types import TracebackType -from typing import IO, AnyStr, Callable, List, Protocol, Type, TypeVar +from typing import IO, AnyStr, Callable, Protocol, Type, TypeVar from paramiko.config import SSHConfig, SSHConfigDict from paramiko.hostkeys import HostKeys @@ -23,11 +23,11 @@ deflate_zero: int deflate_ff: int def deflate_long(n: int, add_sign_padding: bool = ...) -> bytes: ... -def format_binary(data: bytes, prefix: str = ...) -> List[str]: ... +def format_binary(data: bytes, prefix: str = ...) -> list[str]: ... def format_binary_line(data: bytes) -> str: ... def safe_string(s: bytes) -> bytes: ... def bit_length(n: int) -> int: ... -def tb_strings() -> List[str]: ... +def tb_strings() -> list[str]: ... def generate_key_bytes(hash_alg: Type[_Hash], salt: bytes, key: bytes | str, nbytes: int) -> bytes: ... def load_host_keys(filename: str) -> HostKeys: ... def parse_ssh_config(file_obj: IO[str]) -> SSHConfig: ... diff --git a/stubs/polib/polib.pyi b/stubs/polib/polib.pyi index f1df97f72b13..e98a0b9671e0 100644 --- a/stubs/polib/polib.pyi +++ b/stubs/polib/polib.pyi @@ -1,5 +1,5 @@ import textwrap -from typing import IO, Any, Callable, Dict, Generic, List, Text, Tuple, Type, TypeVar, overload +from typing import IO, Any, Callable, Generic, List, Text, Tuple, Type, TypeVar, overload from typing_extensions import SupportsIndex _TB = TypeVar("_TB", bound="_BaseEntry") @@ -29,7 +29,7 @@ class _BaseFile(List[_TB]): encoding: Text check_for_duplicates: bool header: Text - metadata: Dict[Text, Text] + metadata: dict[Text, Text] metadata_is_fuzzy: bool def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __unicode__(self) -> Text: ... @@ -47,10 +47,10 @@ class POFile(_BaseFile[POEntry]): def __unicode__(self) -> Text: ... def save_as_mofile(self, fpath: Text) -> None: ... def percent_translated(self) -> int: ... - def translated_entries(self) -> List[POEntry]: ... - def untranslated_entries(self) -> List[POEntry]: ... - def fuzzy_entries(self) -> List[POEntry]: ... - def obsolete_entries(self) -> List[POEntry]: ... + def translated_entries(self) -> list[POEntry]: ... + def untranslated_entries(self) -> list[POEntry]: ... + def fuzzy_entries(self) -> list[POEntry]: ... + def obsolete_entries(self) -> list[POEntry]: ... def merge(self, refpot: POFile) -> None: ... class MOFile(_BaseFile[MOEntry]): @@ -62,16 +62,16 @@ class MOFile(_BaseFile[MOEntry]): def save_as_pofile(self, fpath: str) -> None: ... def save(self, fpath: Text | None = ...) -> None: ... # type: ignore # binary file does not allow argument repr_method def percent_translated(self) -> int: ... - def translated_entries(self) -> List[MOEntry]: ... - def untranslated_entries(self) -> List[MOEntry]: ... - def fuzzy_entries(self) -> List[MOEntry]: ... - def obsolete_entries(self) -> List[MOEntry]: ... + def translated_entries(self) -> list[MOEntry]: ... + def untranslated_entries(self) -> list[MOEntry]: ... + def fuzzy_entries(self) -> list[MOEntry]: ... + def obsolete_entries(self) -> list[MOEntry]: ... class _BaseEntry(object): msgid: Text msgstr: Text msgid_plural: Text - msgstr_plural: List[Text] + msgstr_plural: list[Text] msgctxt: Text obsolete: bool encoding: str @@ -82,8 +82,8 @@ class _BaseEntry(object): class POEntry(_BaseEntry): comment: Text tcomment: Text - occurrences: List[Tuple[str, int]] - flags: List[Text] + occurrences: list[Tuple[str, int]] + flags: list[Text] previous_msgctxt: Text | None previous_msgid: Text | None previous_msgid_plural: Text | None @@ -108,8 +108,8 @@ class POEntry(_BaseEntry): class MOEntry(_BaseEntry): comment: Text tcomment: Text - occurrences: List[Tuple[str, int]] - flags: List[Text] + occurrences: list[Tuple[str, int]] + flags: list[Text] previous_msgctxt: Text | None previous_msgid: Text | None previous_msgid_plural: Text | None @@ -119,7 +119,7 @@ class MOEntry(_BaseEntry): class _POFileParser(Generic[_TP]): fhandle: IO[Text] instance: _TP - transitions: Dict[Tuple[str, str], Tuple[Callable[[], bool], str]] + transitions: dict[Tuple[str, str], Tuple[Callable[[], bool], str]] current_line: int current_entry: POEntry current_state: str @@ -128,7 +128,7 @@ class _POFileParser(Generic[_TP]): entry_obsolete: int def __init__(self, pofile: Text, *args: Any, **kwargs: Any) -> None: ... def parse(self) -> _TP: ... - def add(self, symbol: str, states: List[str], next_state: str) -> None: ... + def add(self, symbol: str, states: list[str], next_state: str) -> None: ... def process(self, symbol: str) -> None: ... def handle_he(self) -> bool: ... def handle_tc(self) -> bool: ... diff --git a/stubs/pyOpenSSL/OpenSSL/crypto.pyi b/stubs/pyOpenSSL/OpenSSL/crypto.pyi index ce2044906298..ed0cda54eb26 100644 --- a/stubs/pyOpenSSL/OpenSSL/crypto.pyi +++ b/stubs/pyOpenSSL/OpenSSL/crypto.pyi @@ -1,5 +1,5 @@ from datetime import datetime -from typing import Any, Callable, Iterable, List, Sequence, Set, Text, Tuple, Union +from typing import Any, Callable, Iterable, Sequence, Set, Text, Tuple, Union from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey @@ -45,7 +45,7 @@ class X509Name: emailAddress: Text def __init__(self, name: X509Name) -> None: ... def der(self) -> bytes: ... - def get_components(self) -> List[Tuple[bytes, bytes]]: ... + def get_components(self) -> list[Tuple[bytes, bytes]]: ... def hash(self) -> int: ... class X509: @@ -83,7 +83,7 @@ class X509Req: def add_extensions(self, extensions: Iterable[X509Extension]) -> None: ... @classmethod def from_cryptography(cls, crypto_req: CertificateSigningRequest) -> X509Req: ... - def get_extensions(self) -> List[X509Extension]: ... + def get_extensions(self) -> list[X509Extension]: ... def get_pubkey(self) -> PKey: ... def get_subject(self) -> X509Name: ... def get_version(self) -> int: ... @@ -103,7 +103,7 @@ class X509Extension: class Revoked: def __init__(self) -> None: ... - def all_reasons(self) -> List[bytes]: ... + def all_reasons(self) -> list[bytes]: ... def get_reason(self) -> bytes | None: ... def get_rev_date(self) -> bytes: ... def get_serial(self) -> bytes: ... @@ -135,7 +135,7 @@ class X509Store: class X509StoreContext: def __init__(self, store: X509Store, certificate: X509, chain: Sequence[X509] | None = ...) -> None: ... - def get_verified_chain(self) -> List[X509]: ... + def get_verified_chain(self) -> list[X509]: ... def set_store(self, store: X509Store) -> None: ... def verify_certificate(self) -> None: ... diff --git a/stubs/pycurl/pycurl.pyi b/stubs/pycurl/pycurl.pyi index ca6538d3274f..dc17860278cb 100644 --- a/stubs/pycurl/pycurl.pyi +++ b/stubs/pycurl/pycurl.pyi @@ -1,6 +1,6 @@ # TODO(MichalPokorny): more precise types -from typing import Any, List, Text, Tuple +from typing import Any, Text, Tuple GLOBAL_ACK_EINTR: int GLOBAL_ALL: int @@ -39,9 +39,9 @@ class CurlMulti(object): def add_handle(self, obj: Curl) -> None: ... def remove_handle(self, obj: Curl) -> None: ... def perform(self) -> Tuple[Any, int]: ... - def fdset(self) -> Tuple[List[Any], List[Any], List[Any]]: ... + def fdset(self) -> Tuple[list[Any], list[Any], list[Any]]: ... def select(self, timeout: float = ...) -> int: ... - def info_read(self, max_objects: int = ...) -> Tuple[int, List[Any], List[Any]]: ... + def info_read(self, max_objects: int = ...) -> Tuple[int, list[Any], list[Any]]: ... def socket_action(self, sockfd: int, ev_bitmask: int) -> Tuple[int, int]: ... class CurlShare(object): diff --git a/stubs/pysftp/pysftp/__init__.pyi b/stubs/pysftp/pysftp/__init__.pyi index 133c78e9a7d9..d706213e9a6e 100644 --- a/stubs/pysftp/pysftp/__init__.pyi +++ b/stubs/pysftp/pysftp/__init__.pyi @@ -1,6 +1,6 @@ from stat import S_IMODE as S_IMODE from types import TracebackType -from typing import IO, Any, Callable, ContextManager, List, Sequence, Text, Tuple, Type, Union +from typing import IO, Any, Callable, ContextManager, Sequence, Text, Tuple, Type, Union from typing_extensions import Literal import paramiko @@ -73,15 +73,15 @@ class Connection: callback: _Callback | None = ..., confirm: bool = ..., ) -> paramiko.SFTPAttributes: ... - def execute(self, command: str) -> List[str]: ... + def execute(self, command: str) -> list[str]: ... def cd(self, remotepath: _Path | None = ...) -> ContextManager[None]: ... # noqa: F811 def chdir(self, remotepath: _Path) -> None: ... def cwd(self, remotepath: _Path) -> None: ... def chmod(self, remotepath: _Path, mode: int = ...) -> None: ... def chown(self, remotepath: _Path, uid: int | None = ..., gid: int | None = ...) -> None: ... def getcwd(self) -> str: ... - def listdir(self, remotepath: _Path = ...) -> List[str]: ... - def listdir_attr(self, remotepath: _Path = ...) -> List[paramiko.SFTPAttributes]: ... + def listdir(self, remotepath: _Path = ...) -> list[str]: ... + def listdir_attr(self, remotepath: _Path = ...) -> list[paramiko.SFTPAttributes]: ... def mkdir(self, remotepath: _Path, mode: int = ...) -> None: ... def normalize(self, remotepath: _Path) -> str: ... def isdir(self, remotepath: _Path) -> bool: ... diff --git a/stubs/pysftp/pysftp/helpers.pyi b/stubs/pysftp/pysftp/helpers.pyi index 4849fe213768..c1e0138d47f9 100644 --- a/stubs/pysftp/pysftp/helpers.pyi +++ b/stubs/pysftp/pysftp/helpers.pyi @@ -1,4 +1,4 @@ -from typing import Callable, ContextManager, Iterator, List +from typing import Callable, ContextManager, Iterator def known_hosts() -> str: ... def st_mode_to_int(val: int) -> int: ... @@ -9,17 +9,17 @@ class WTCallbacks: def dir_cb(self, pathname: str) -> None: ... def unk_cb(self, pathname: str) -> None: ... @property - def flist(self) -> List[str]: ... + def flist(self) -> list[str]: ... @flist.setter - def flist(self, val: List[str]) -> None: ... + def flist(self, val: list[str]) -> None: ... @property - def dlist(self) -> List[str]: ... + def dlist(self) -> list[str]: ... @dlist.setter - def dlist(self, val: List[str]) -> None: ... + def dlist(self, val: list[str]) -> None: ... @property - def ulist(self) -> List[str]: ... + def ulist(self) -> list[str]: ... @ulist.setter - def ulist(self, val: List[str]) -> None: ... + def ulist(self, val: list[str]) -> None: ... def path_advance(thepath: str, sep: str = ...) -> Iterator[str]: ... def path_retreat(thepath: str, sep: str = ...) -> Iterator[str]: ... diff --git a/stubs/python-dateutil/dateutil/parser.pyi b/stubs/python-dateutil/dateutil/parser.pyi index 2fd41c4c1a9f..bdbb4bdef79b 100644 --- a/stubs/python-dateutil/dateutil/parser.pyi +++ b/stubs/python-dateutil/dateutil/parser.pyi @@ -1,17 +1,17 @@ from datetime import datetime, tzinfo -from typing import IO, Any, Dict, List, Mapping, Text, Tuple, Union +from typing import IO, Any, Mapping, Text, Tuple, Union _FileOrStr = Union[bytes, Text, IO[str], IO[Any]] class parserinfo(object): - JUMP: List[str] - WEEKDAYS: List[Tuple[str, str]] - MONTHS: List[Tuple[str, str]] - HMS: List[Tuple[str, str, str]] - AMPM: List[Tuple[str, str]] - UTCZONE: List[str] - PERTAIN: List[str] - TZOFFSET: Dict[str, int] + JUMP: list[str] + WEEKDAYS: list[Tuple[str, str]] + MONTHS: list[Tuple[str, str]] + HMS: list[Tuple[str, str, str]] + AMPM: list[Tuple[str, str]] + UTCZONE: list[str] + PERTAIN: list[str] + TZOFFSET: dict[str, int] def __init__(self, dayfirst: bool = ..., yearfirst: bool = ...) -> None: ... def jump(self, name: Text) -> bool: ... def weekday(self, name: Text) -> int | None: ... diff --git a/stubs/python-dateutil/dateutil/tz/tz.pyi b/stubs/python-dateutil/dateutil/tz/tz.pyi index 70dd605a8011..6e264420cf81 100644 --- a/stubs/python-dateutil/dateutil/tz/tz.pyi +++ b/stubs/python-dateutil/dateutil/tz/tz.pyi @@ -1,5 +1,5 @@ import datetime -from typing import IO, Any, List, Text, Tuple, Union +from typing import IO, Any, Text, Tuple, Union from ..relativedelta import relativedelta from ._common import _tzinfo as _tzinfo, enfold as enfold, tzname_in_python2 as tzname_in_python2, tzrangebase as tzrangebase @@ -87,8 +87,8 @@ class tzical: def keys(self): ... def get(self, tzid: Any | None = ...): ... -TZFILES: List[str] -TZPATHS: List[str] +TZFILES: list[str] +TZPATHS: list[str] def datetime_exists(dt: datetime.datetime, tz: datetime.tzinfo | None = ...) -> bool: ... def datetime_ambiguous(dt: datetime.datetime, tz: datetime.tzinfo | None = ...) -> bool: ... diff --git a/stubs/python-gflags/gflags.pyi b/stubs/python-gflags/gflags.pyi index 7cf85dfa321f..bc674935cb24 100644 --- a/stubs/python-gflags/gflags.pyi +++ b/stubs/python-gflags/gflags.pyi @@ -1,5 +1,5 @@ from types import ModuleType -from typing import IO, Any, Callable, Dict, Iterable, List, Sequence, Text +from typing import IO, Any, Callable, Iterable, Sequence, Text class Error(Exception): ... @@ -39,12 +39,12 @@ class FlagValues: def is_gnu_getopt(self) -> bool: ... IsGnuGetOpt = is_gnu_getopt # TODO dict type - def FlagDict(self) -> Dict[Any, Any]: ... - def flags_by_module_dict(self) -> Dict[str, List[Flag]]: ... + def FlagDict(self) -> dict[Any, Any]: ... + def flags_by_module_dict(self) -> dict[str, list[Flag]]: ... FlagsByModuleDict = flags_by_module_dict - def flags_by_module_id_dict(self) -> Dict[int, List[Flag]]: ... + def flags_by_module_id_dict(self) -> dict[int, list[Flag]]: ... FlagsByModuleIdDict = flags_by_module_id_dict - def key_flags_by_module_dict(self) -> Dict[str, List[Flag]]: ... + def key_flags_by_module_dict(self) -> dict[str, list[Flag]]: ... KeyFlagsByModuleDict = key_flags_by_module_dict def find_module_defining_flag(self, flagname: str, default: str = ...) -> str: ... FindModuleDefiningFlag = find_module_defining_flag @@ -64,11 +64,11 @@ class FlagValues: def __contains__(self, name: str) -> bool: ... has_key = __contains__ def __iter__(self) -> Iterable[str]: ... - def __call__(self, argv: List[str], known_only: bool = ...) -> List[str]: ... + def __call__(self, argv: list[str], known_only: bool = ...) -> list[str]: ... def reset(self) -> None: ... Reset = reset - def RegisteredFlags(self) -> List[str]: ... - def flag_values_dict(self) -> Dict[str, Any]: ... + def RegisteredFlags(self) -> list[str]: ... + def flag_values_dict(self) -> dict[str, Any]: ... FlagValuesDict = flag_values_dict def __str__(self) -> str: ... def GetHelp(self, prefix: str = ...) -> str: ... @@ -77,9 +77,9 @@ class FlagValues: def main_module_help(self) -> str: ... MainModuleHelp = main_module_help def get(self, name: str, default: Any) -> Any: ... - def ShortestUniquePrefixes(self, fl: Dict[str, Flag]) -> Dict[str, str]: ... + def ShortestUniquePrefixes(self, fl: dict[str, Flag]) -> dict[str, str]: ... def ExtractFilename(self, flagfile_str: str) -> str: ... - def read_flags_from_files(self, argv: List[str], force_gnu: bool = ...) -> List[str]: ... + def read_flags_from_files(self, argv: list[str], force_gnu: bool = ...) -> list[str]: ... ReadFlagsFromFiles = read_flags_from_files def flags_into_string(self) -> str: ... FlagsIntoString = flags_into_string @@ -138,7 +138,7 @@ class ArgumentSerializer: class ListSerializer(ArgumentSerializer): def __init__(self, list_sep: str) -> None: ... - def Serialize(self, value: List[Any]) -> str: ... + def Serialize(self, value: list[Any]) -> str: ... def register_validator( flag_name: str, checker: Callable[[Any], bool], message: str = ..., flag_values: FlagValues = ... @@ -242,12 +242,12 @@ def DEFINE_integer( ) -> None: ... class EnumParser(ArgumentParser): - def __init__(self, enum_values: List[str]) -> None: ... + def __init__(self, enum_values: list[str]) -> None: ... def Parse(self, argument: Any) -> Any: ... class EnumFlag(Flag): def __init__( - self, name: str, default: str | None, help: str, enum_values: List[str], short_name: str, **args: Any + self, name: str, default: str | None, help: str, enum_values: list[str], short_name: str, **args: Any ) -> None: ... def DEFINE_enum( @@ -256,7 +256,7 @@ def DEFINE_enum( class BaseListParser(ArgumentParser): def __init__(self, token: str = ..., name: str = ...) -> None: ... - def Parse(self, argument: Any) -> List[Any]: ... + def Parse(self, argument: Any) -> list[Any]: ... class ListParser(BaseListParser): def __init__(self) -> None: ... @@ -264,8 +264,8 @@ class ListParser(BaseListParser): class WhitespaceSeparatedListParser(BaseListParser): def __init__(self) -> None: ... -def DEFINE_list(name: str, default: List[str] | None, help: str, flag_values: FlagValues = ..., **args: Any) -> None: ... -def DEFINE_spaceseplist(name: str, default: List[str] | None, help: str, flag_values: FlagValues = ..., **args: Any) -> None: ... +def DEFINE_list(name: str, default: list[str] | None, help: str, flag_values: FlagValues = ..., **args: Any) -> None: ... +def DEFINE_spaceseplist(name: str, default: list[str] | None, help: str, flag_values: FlagValues = ..., **args: Any) -> None: ... class MultiFlag(Flag): def __init__(self, *args: Any, **kwargs: Any) -> None: ... @@ -273,14 +273,14 @@ class MultiFlag(Flag): def Serialize(self) -> str: ... def DEFINE_multi_string( - name: str, default: str | List[str] | None, help: str, flag_values: FlagValues = ..., **args: Any + name: str, default: str | list[str] | None, help: str, flag_values: FlagValues = ..., **args: Any ) -> None: ... DEFINE_multistring = DEFINE_multi_string def DEFINE_multi_integer( name: str, - default: int | List[int] | None, + default: int | list[int] | None, help: str, lower_bound: int = ..., upper_bound: int = ..., @@ -292,7 +292,7 @@ DEFINE_multi_int = DEFINE_multi_integer def DEFINE_multi_float( name: str, - default: float | List[float] | None, + default: float | list[float] | None, help: str, lower_bound: float = ..., upper_bound: float = ..., diff --git a/stubs/pytz/pytz/__init__.pyi b/stubs/pytz/pytz/__init__.pyi index 1bf5a6cd1acb..f9dd0e11ca38 100644 --- a/stubs/pytz/pytz/__init__.pyi +++ b/stubs/pytz/pytz/__init__.pyi @@ -1,5 +1,5 @@ import datetime -from typing import List, Mapping, Set +from typing import Mapping, Set class BaseTzInfo(datetime.tzinfo): zone: str = ... @@ -32,11 +32,11 @@ UTC: _UTCclass def timezone(zone: str) -> _UTCclass | _StaticTzInfo | _DstTzInfo: ... def FixedOffset(offset: int) -> _UTCclass | datetime.tzinfo: ... -all_timezones: List[str] +all_timezones: list[str] all_timezones_set: Set[str] -common_timezones: List[str] +common_timezones: list[str] common_timezones_set: Set[str] -country_timezones: Mapping[str, List[str]] +country_timezones: Mapping[str, list[str]] country_names: Mapping[str, str] ZERO: datetime.timedelta HOUR: datetime.timedelta diff --git a/stubs/pyvmomi/pyVmomi/vim/__init__.pyi b/stubs/pyvmomi/pyVmomi/vim/__init__.pyi index 57083f91d08a..a06b018224d4 100644 --- a/stubs/pyvmomi/pyVmomi/vim/__init__.pyi +++ b/stubs/pyvmomi/pyVmomi/vim/__init__.pyi @@ -1,6 +1,6 @@ from datetime import datetime from enum import Enum -from typing import Any, List +from typing import Any from ..vmodl.query import PropertyCollector from .event import EventManager @@ -44,15 +44,15 @@ class PerformanceManager: def __getattr__(self, name: str) -> Any: ... # incomplete class QuerySpec: entity: ManagedEntity - metricId: List[PerformanceManager.MetricId] + metricId: list[PerformanceManager.MetricId] intervalId: int maxSample: int startTime: datetime def __getattr__(self, name: str) -> Any: ... # incomplete class EntityMetricBase: entity: ManagedEntity - def QueryPerfCounterByLevel(self, collection_level: int) -> List[PerformanceManager.PerfCounterInfo]: ... - def QueryPerf(self, querySpec: List[PerformanceManager.QuerySpec]) -> List[PerformanceManager.EntityMetricBase]: ... + def QueryPerfCounterByLevel(self, collection_level: int) -> list[PerformanceManager.PerfCounterInfo]: ... + def QueryPerf(self, querySpec: list[PerformanceManager.QuerySpec]) -> list[PerformanceManager.EntityMetricBase]: ... def __getattr__(self, name: str) -> Any: ... # incomplete class ClusterComputeResource(ManagedEntity): ... diff --git a/stubs/pyvmomi/pyVmomi/vim/event.pyi b/stubs/pyvmomi/pyVmomi/vim/event.pyi index b8d320ab82d4..4a422e3f1a7d 100644 --- a/stubs/pyvmomi/pyVmomi/vim/event.pyi +++ b/stubs/pyvmomi/pyVmomi/vim/event.pyi @@ -1,5 +1,5 @@ from datetime import datetime -from typing import Any, List +from typing import Any def __getattr__(name: str) -> Any: ... # incomplete @@ -13,4 +13,4 @@ class EventFilterSpec: class EventManager: latestEvent: Event - def QueryEvents(self, filer: EventFilterSpec) -> List[Event]: ... + def QueryEvents(self, filer: EventFilterSpec) -> list[Event]: ... diff --git a/stubs/pyvmomi/pyVmomi/vim/option.pyi b/stubs/pyvmomi/pyVmomi/vim/option.pyi index 164cf3c818ce..da6e05385ccd 100644 --- a/stubs/pyvmomi/pyVmomi/vim/option.pyi +++ b/stubs/pyvmomi/pyVmomi/vim/option.pyi @@ -1,9 +1,9 @@ -from typing import Any, List +from typing import Any def __getattr__(name: str) -> Any: ... # incomplete class OptionManager: - def QueryOptions(self, name: str) -> List[OptionValue]: ... + def QueryOptions(self, name: str) -> list[OptionValue]: ... class OptionValue: value: Any diff --git a/stubs/pyvmomi/pyVmomi/vim/view.pyi b/stubs/pyvmomi/pyVmomi/vim/view.pyi index c5bc840f871d..c00ad51db1c7 100644 --- a/stubs/pyvmomi/pyVmomi/vim/view.pyi +++ b/stubs/pyvmomi/pyVmomi/vim/view.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Type +from typing import Any, Type from pyVmomi.vim import ManagedEntity @@ -8,8 +8,8 @@ class ContainerView: def Destroy(self) -> None: ... class ViewManager: - # Doc says the `type` parameter of CreateContainerView is a `List[str]`, - # but in practice it seems to be `List[Type[ManagedEntity]]` + # Doc says the `type` parameter of CreateContainerView is a `list[str]`, + # but in practice it seems to be `list[Type[ManagedEntity]]` # Source: https://pubs.vmware.com/vi-sdk/visdk250/ReferenceGuide/vim.view.ViewManager.html @staticmethod - def CreateContainerView(container: ManagedEntity, type: List[Type[ManagedEntity]], recursive: bool) -> ContainerView: ... + def CreateContainerView(container: ManagedEntity, type: list[Type[ManagedEntity]], recursive: bool) -> ContainerView: ... diff --git a/stubs/pyvmomi/pyVmomi/vmodl/query.pyi b/stubs/pyvmomi/pyVmomi/vmodl/query.pyi index 059e282b7607..89f2769c13f8 100644 --- a/stubs/pyvmomi/pyVmomi/vmodl/query.pyi +++ b/stubs/pyvmomi/pyVmomi/vmodl/query.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Type +from typing import Any, Type from pyVmomi.vim import ManagedEntity from pyVmomi.vim.view import ContainerView @@ -6,10 +6,10 @@ from pyVmomi.vmodl import DynamicProperty class PropertyCollector: class PropertySpec: - def __init__(self, *, all: bool = ..., type: Type[ManagedEntity] = ..., pathSet: List[str] = ...) -> None: ... + def __init__(self, *, all: bool = ..., type: Type[ManagedEntity] = ..., pathSet: list[str] = ...) -> None: ... all: bool type: Type[ManagedEntity] - pathSet: List[str] + pathSet: list[str] class TraversalSpec: def __init__( self, *, path: str = ..., skip: bool = ..., type: Type[ContainerView] = ..., **kwargs: Any # incomplete @@ -23,35 +23,35 @@ class PropertyCollector: maxObjects: int class ObjectSpec: def __init__( - self, *, skip: bool = ..., selectSet: List[PropertyCollector.TraversalSpec] = ..., obj: Any = ... + self, *, skip: bool = ..., selectSet: list[PropertyCollector.TraversalSpec] = ..., obj: Any = ... ) -> None: ... skip: bool - selectSet: List[PropertyCollector.TraversalSpec] + selectSet: list[PropertyCollector.TraversalSpec] obj: Any class FilterSpec: def __init__( self, *, - propSet: List[PropertyCollector.PropertySpec] = ..., - objectSet: List[PropertyCollector.ObjectSpec] = ..., + propSet: list[PropertyCollector.PropertySpec] = ..., + objectSet: list[PropertyCollector.ObjectSpec] = ..., **kwargs: Any, # incomplete ) -> None: ... - propSet: List[PropertyCollector.PropertySpec] - objectSet: List[PropertyCollector.ObjectSpec] + propSet: list[PropertyCollector.PropertySpec] + objectSet: list[PropertyCollector.ObjectSpec] def __getattr__(self, name: str) -> Any: ... # incomplete class ObjectContent: def __init__( - self, *, obj: ManagedEntity = ..., propSet: List[DynamicProperty] = ..., **kwargs: Any # incomplete + self, *, obj: ManagedEntity = ..., propSet: list[DynamicProperty] = ..., **kwargs: Any # incomplete ) -> None: ... obj: ManagedEntity - propSet: List[DynamicProperty] + propSet: list[DynamicProperty] def __getattr__(self, name: str) -> Any: ... # incomplete class RetrieveResult: - def __init__(self, *, objects: List[PropertyCollector.ObjectContent] = ..., token: str | None = ...) -> None: ... - objects: List[PropertyCollector.ObjectContent] + def __init__(self, *, objects: list[PropertyCollector.ObjectContent] = ..., token: str | None = ...) -> None: ... + objects: list[PropertyCollector.ObjectContent] token: str | None def RetrievePropertiesEx( - self, specSet: List[PropertyCollector.FilterSpec], options: PropertyCollector.RetrieveOptions + self, specSet: list[PropertyCollector.FilterSpec], options: PropertyCollector.RetrieveOptions ) -> PropertyCollector.RetrieveResult: ... def ContinueRetrievePropertiesEx(self, token: str) -> PropertyCollector.RetrieveResult: ... def __getattr__(self, name: str) -> Any: ... # incomplete diff --git a/stubs/redis/redis/client.pyi b/stubs/redis/redis/client.pyi index 5303c93c5598..e3eeda7ef332 100644 --- a/stubs/redis/redis/client.pyi +++ b/stubs/redis/redis/client.pyi @@ -1,22 +1,5 @@ from datetime import datetime, timedelta -from typing import ( - Any, - Callable, - Dict, - Generic, - Iterable, - Iterator, - List, - Mapping, - Sequence, - Set, - Text, - Tuple, - Type, - TypeVar, - Union, - overload, -) +from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, Sequence, Set, Text, Tuple, Type, TypeVar, Union, overload from typing_extensions import Literal from .connection import ConnectionPool @@ -392,11 +375,11 @@ class Redis(Generic[_StrType]): def pubsub(self, shard_hint: Any = ..., ignore_subscribe_messages: bool = ...) -> PubSub: ... def execute_command(self, *args, **options): ... def parse_response(self, connection, command_name, **options): ... - def acl_cat(self, category: Text | None = ...) -> List[str]: ... + def acl_cat(self, category: Text | None = ...) -> list[str]: ... def acl_deluser(self, username: Text) -> int: ... def acl_genpass(self) -> Text: ... def acl_getuser(self, username: Text) -> Any | None: ... - def acl_list(self) -> List[Text]: ... + def acl_list(self) -> list[Text]: ... def acl_load(self) -> bool: ... def acl_setuser( self, @@ -412,13 +395,13 @@ class Redis(Generic[_StrType]): reset_keys: bool = ..., reset_passwords: bool = ..., ) -> bool: ... - def acl_users(self) -> List[Text]: ... + def acl_users(self) -> list[Text]: ... def acl_whoami(self) -> Text: ... def bgrewriteaof(self): ... def bgsave(self): ... def client_id(self) -> int: ... def client_kill(self, address: Text) -> bool: ... - def client_list(self) -> List[Dict[str, str]]: ... + def client_list(self) -> list[dict[str, str]]: ... def client_getname(self) -> str | None: ... def client_setname(self, name: Text) -> bool: ... def readwrite(self) -> bool: ... @@ -472,8 +455,8 @@ class Redis(Generic[_StrType]): def incr(self, name: _Key, amount: int = ...) -> int: ... def incrby(self, name: _Key, amount: int = ...) -> int: ... def incrbyfloat(self, name: _Key, amount: float = ...) -> float: ... - def keys(self, pattern: _Key = ...) -> List[_StrType]: ... - def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> List[_StrType | None]: ... + def keys(self, pattern: _Key = ...) -> list[_StrType]: ... + def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... def mset(self, mapping: Mapping[_Key, _Value]) -> Literal[True]: ... def msetnx(self, mapping: Mapping[_Key, _Value]) -> bool: ... def move(self, name: _Key, db: int) -> bool: ... @@ -525,7 +508,7 @@ class Redis(Generic[_StrType]): def lpop(self, name): ... def lpush(self, name: _Value, *values: _Value) -> int: ... def lpushx(self, name, value): ... - def lrange(self, name: _Key, start: int, end: int) -> List[_StrType]: ... + def lrange(self, name: _Key, start: int, end: int) -> list[_StrType]: ... def lrem(self, name: _Key, count: int, value: _Value) -> int: ... def lset(self, name: _Key, index: int, value: _Value) -> bool: ... def ltrim(self, name: _Key, start: int, end: int) -> bool: ... @@ -545,7 +528,7 @@ class Redis(Generic[_StrType]): alpha: bool = ..., store: None = ..., groups: bool = ..., - ) -> List[_StrType]: ... + ) -> list[_StrType]: ... @overload def sort( self, @@ -573,13 +556,13 @@ class Redis(Generic[_StrType]): store: _Key, groups: bool = ..., ) -> int: ... - def scan(self, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Tuple[int, List[_StrType]]: ... + def scan(self, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Tuple[int, list[_StrType]]: ... def scan_iter(self, match: Text | None = ..., count: int | None = ...) -> Iterator[_StrType]: ... - def sscan(self, name: _Key, cursor: int = ..., match: Text = ..., count: int = ...) -> Tuple[int, List[_StrType]]: ... + def sscan(self, name: _Key, cursor: int = ..., match: Text = ..., count: int = ...) -> Tuple[int, list[_StrType]]: ... def sscan_iter(self, name, match=..., count=...): ... def hscan( self, name: _Key, cursor: int = ..., match: Text = ..., count: int = ... - ) -> Tuple[int, Dict[_StrType, _StrType]]: ... + ) -> Tuple[int, dict[_StrType, _StrType]]: ... def hscan_iter(self, name, match=..., count=...): ... def zscan(self, name, cursor=..., match=..., count=..., score_cast_func=...): ... def zscan_iter(self, name, match=..., count=..., score_cast_func=...): ... @@ -595,11 +578,11 @@ class Redis(Generic[_StrType]): @overload def spop(self, name: _Key, count: None = ...) -> _Value | None: ... @overload - def spop(self, name: _Key, count: int) -> List[_Value]: ... + def spop(self, name: _Key, count: int) -> list[_Value]: ... @overload def srandmember(self, name: _Key, number: None = ...) -> _Value | None: ... @overload - def srandmember(self, name: _Key, number: int) -> List[_Value]: ... + def srandmember(self, name: _Key, number: int) -> list[_Value]: ... def srem(self, name: _Key, *values: _Value) -> int: ... def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> Set[_Value]: ... def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... @@ -632,8 +615,8 @@ class Redis(Generic[_StrType]): def zincrby(self, name: _Key, amount: float, value: _Value) -> float: ... def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] = ...) -> int: ... def zlexcount(self, name: _Key, min: _Value, max: _Value) -> int: ... - def zpopmax(self, name: _Key, count: int | None = ...) -> List[_StrType]: ... - def zpopmin(self, name: _Key, count: int | None = ...) -> List[_StrType]: ... + def zpopmax(self, name: _Key, count: int | None = ...) -> list[_StrType]: ... + def zpopmin(self, name: _Key, count: int | None = ...) -> list[_StrType]: ... @overload def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> Tuple[_StrType, _StrType, float]: ... @overload @@ -652,7 +635,7 @@ class Redis(Generic[_StrType]): *, withscores: Literal[True], score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ..., - ) -> List[Tuple[_StrType, _ScoreCastFuncReturn]]: ... + ) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ... @overload def zrange( self, @@ -662,10 +645,10 @@ class Redis(Generic[_StrType]): desc: bool = ..., withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ..., - ) -> List[_StrType]: ... + ) -> list[_StrType]: ... def zrangebylex( self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ... - ) -> List[_StrType]: ... + ) -> list[_StrType]: ... @overload def zrangebyscore( self, @@ -677,7 +660,7 @@ class Redis(Generic[_StrType]): *, withscores: Literal[True], score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ..., - ) -> List[Tuple[_StrType, _ScoreCastFuncReturn]]: ... + ) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ... @overload def zrangebyscore( self, @@ -688,7 +671,7 @@ class Redis(Generic[_StrType]): num: int | None = ..., withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ..., - ) -> List[_StrType]: ... + ) -> list[_StrType]: ... def zrank(self, name: _Key, value: _Value) -> int | None: ... def zrem(self, name: _Key, *values: _Value) -> int: ... def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> int: ... @@ -704,7 +687,7 @@ class Redis(Generic[_StrType]): *, withscores: Literal[True], score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ..., - ) -> List[Tuple[_StrType, _ScoreCastFuncReturn]]: ... + ) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ... @overload def zrevrange( self, @@ -714,7 +697,7 @@ class Redis(Generic[_StrType]): desc: bool = ..., withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ..., - ) -> List[_StrType]: ... + ) -> list[_StrType]: ... @overload def zrevrangebyscore( self, @@ -726,7 +709,7 @@ class Redis(Generic[_StrType]): *, withscores: Literal[True], score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ..., - ) -> List[Tuple[_StrType, _ScoreCastFuncReturn]]: ... + ) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ... @overload def zrevrangebyscore( self, @@ -737,10 +720,10 @@ class Redis(Generic[_StrType]): num: int | None = ..., withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ..., - ) -> List[_StrType]: ... + ) -> list[_StrType]: ... def zrevrangebylex( self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ... - ) -> List[_StrType]: ... + ) -> list[_StrType]: ... def zrevrank(self, name: _Key, value: _Value) -> int | None: ... def zscore(self, name: _Key, value: _Value) -> float | None: ... def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] = ...) -> int: ... @@ -750,10 +733,10 @@ class Redis(Generic[_StrType]): def hdel(self, name: _Key, *keys: _Key) -> int: ... def hexists(self, name: _Key, key: _Key) -> bool: ... def hget(self, name: _Key, key: _Key) -> _StrType | None: ... - def hgetall(self, name: _Key) -> Dict[_StrType, _StrType]: ... + def hgetall(self, name: _Key) -> dict[_StrType, _StrType]: ... def hincrby(self, name: _Key, key: _Key, amount: int = ...) -> int: ... def hincrbyfloat(self, name: _Key, key: _Key, amount: float = ...) -> float: ... - def hkeys(self, name: _Key) -> List[_StrType]: ... + def hkeys(self, name: _Key) -> list[_StrType]: ... def hlen(self, name: _Key) -> int: ... @overload def hset(self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ...) -> int: ... @@ -763,8 +746,8 @@ class Redis(Generic[_StrType]): def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value]) -> int: ... def hsetnx(self, name: _Key, key: _Key, value: _Value) -> int: ... def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> bool: ... - def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> List[_StrType | None]: ... - def hvals(self, name: _Key) -> List[_StrType]: ... + def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... + def hvals(self, name: _Key) -> list[_StrType]: ... def publish(self, channel: _Key, message: _Key) -> int: ... def eval(self, script, numkeys, *keys_and_args): ... def evalsha(self, sha, numkeys, *keys_and_args): ... @@ -773,8 +756,8 @@ class Redis(Generic[_StrType]): def script_kill(self): ... def script_load(self, script): ... def register_script(self, script: Text | _StrType) -> Script: ... - def pubsub_channels(self, pattern: _Key = ...) -> List[Text]: ... - def pubsub_numsub(self, *args: _Key) -> List[Tuple[Text, int]]: ... + def pubsub_channels(self, pattern: _Key = ...) -> list[Text]: ... + def pubsub_numsub(self, *args: _Key) -> list[Tuple[Text, int]]: ... def pubsub_numpat(self) -> int: ... def monitor(self) -> Monitor: ... def cluster(self, cluster_arg: str, *args: Any) -> Any: ... @@ -813,8 +796,8 @@ class PubSub: def subscribe(self, *args: _Key, **kwargs: Callable[[Any], None]) -> None: ... def unsubscribe(self, *args: _Key) -> None: ... def listen(self): ... - def get_message(self, ignore_subscribe_messages: bool = ..., timeout: float = ...) -> Dict[str, Any] | None: ... - def handle_message(self, response, ignore_subscribe_messages: bool = ...) -> Dict[str, Any] | None: ... + def get_message(self, ignore_subscribe_messages: bool = ..., timeout: float = ...) -> dict[str, Any] | None: ... + def handle_message(self, response, ignore_subscribe_messages: bool = ...) -> dict[str, Any] | None: ... def run_in_thread(self, sleep_time=...): ... def ping(self, message: _Value | None = ...) -> None: ... @@ -845,7 +828,7 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): def annotate_exception(self, exception, number, command): ... def parse_response(self, connection, command_name, **options): ... def load_scripts(self): ... - def execute(self, raise_on_error: bool = ...) -> List[Any]: ... + def execute(self, raise_on_error: bool = ...) -> list[Any]: ... def watch(self, *names: _Key) -> bool: ... def unwatch(self) -> bool: ... # in the Redis implementation, the following methods are inherited from client. @@ -1150,5 +1133,5 @@ class Monitor(object): def __init__(self, connection_pool) -> None: ... def __enter__(self) -> Monitor: ... def __exit__(self, *args: Any) -> None: ... - def next_command(self) -> Dict[Text, Any]: ... - def listen(self) -> Iterable[Dict[Text, Any]]: ... + def next_command(self) -> dict[Text, Any]: ... + def listen(self) -> Iterable[dict[Text, Any]]: ... diff --git a/stubs/redis/redis/connection.pyi b/stubs/redis/redis/connection.pyi index 8863d4b79a9e..a8b4cc13c710 100644 --- a/stubs/redis/redis/connection.pyi +++ b/stubs/redis/redis/connection.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Mapping, Text, Tuple, Type +from typing import Any, Mapping, Text, Tuple, Type ssl_available: Any hiredis_version: Any @@ -105,7 +105,7 @@ class Connection: def read_response(self): ... def pack_command(self, *args): ... def pack_commands(self, commands): ... - def repr_pieces(self) -> List[Tuple[Text, Text]]: ... + def repr_pieces(self) -> list[Tuple[Text, Text]]: ... class SSLConnection(Connection): description_format: Any @@ -144,7 +144,7 @@ class UnixDomainSocketConnection(Connection): health_check_interval: int = ..., client_name=..., ) -> None: ... - def repr_pieces(self) -> List[Tuple[Text, Text]]: ... + def repr_pieces(self) -> list[Tuple[Text, Text]]: ... def to_bool(value: object) -> bool: ... diff --git a/stubs/requests/requests/utils.pyi b/stubs/requests/requests/utils.pyi index 4deba4d858dd..0ac3a161c41d 100644 --- a/stubs/requests/requests/utils.pyi +++ b/stubs/requests/requests/utils.pyi @@ -1,4 +1,4 @@ -from typing import Any, AnyStr, Dict, Iterable, Mapping, Text, Tuple +from typing import Any, AnyStr, Iterable, Mapping, Text, Tuple from . import compat, cookies, exceptions, structures @@ -40,7 +40,7 @@ def is_ipv4_address(string_ip): ... def is_valid_cidr(string_network): ... def set_environ(env_name, value): ... def should_bypass_proxies(url, no_proxy: Iterable[AnyStr] | None) -> bool: ... -def get_environ_proxies(url, no_proxy: Iterable[AnyStr] | None = ...) -> Dict[Any, Any]: ... +def get_environ_proxies(url, no_proxy: Iterable[AnyStr] | None = ...) -> dict[Any, Any]: ... def select_proxy(url: Text, proxies: Mapping[Any, Any] | None): ... def default_user_agent(name=...): ... def default_headers(): ... diff --git a/stubs/retry/retry/api.pyi b/stubs/retry/retry/api.pyi index 637599514f7e..dd7f3761f748 100644 --- a/stubs/retry/retry/api.pyi +++ b/stubs/retry/retry/api.pyi @@ -1,13 +1,13 @@ from _typeshed import IdentityFunction from logging import Logger -from typing import Any, Callable, Dict, Sequence, Tuple, Type, TypeVar +from typing import Any, Callable, Sequence, Tuple, Type, TypeVar _R = TypeVar("_R") def retry_call( f: Callable[..., _R], fargs: Sequence[Any] | None = ..., - fkwargs: Dict[str, Any] | None = ..., + fkwargs: dict[str, Any] | None = ..., exceptions: Type[Exception] | Tuple[Type[Exception], ...] = ..., tries: int = ..., delay: float = ..., diff --git a/stubs/setuptools/pkg_resources/__init__.pyi b/stubs/setuptools/pkg_resources/__init__.pyi index 240907e4bcf9..ce3699ca329c 100644 --- a/stubs/setuptools/pkg_resources/__init__.pyi +++ b/stubs/setuptools/pkg_resources/__init__.pyi @@ -2,7 +2,7 @@ import importlib.abc import types import zipimport from abc import ABCMeta -from typing import IO, Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Set, Tuple, TypeVar, Union, overload +from typing import IO, Any, Callable, Generator, Iterable, Optional, Sequence, Set, Tuple, TypeVar, Union, overload LegacyVersion = Any # from packaging.version Version = Any # from packaging.version @@ -20,7 +20,7 @@ def declare_namespace(name: str) -> None: ... def fixup_namespace_packages(path_item: str) -> None: ... class WorkingSet: - entries: List[str] + entries: list[str] def __init__(self, entries: Iterable[str] | None = ...) -> None: ... def require(self, *requirements: _NestedStr) -> Sequence[Distribution]: ... def run_script(self, requires: str, script_name: str) -> None: ... @@ -31,12 +31,12 @@ class WorkingSet: def find(self, req: Requirement) -> Distribution | None: ... def resolve( self, requirements: Iterable[Requirement], env: Environment | None = ..., installer: _InstallerType | None = ... - ) -> List[Distribution]: ... + ) -> list[Distribution]: ... def add(self, dist: Distribution, entry: str | None = ..., insert: bool = ..., replace: bool = ...) -> None: ... def subscribe(self, callback: Callable[[Distribution], None]) -> None: ... def find_plugins( self, plugin_env: Environment, full_env: Environment | None = ..., fallback: bool = ... - ) -> Tuple[List[Distribution], Dict[Distribution, Exception]]: ... + ) -> Tuple[list[Distribution], dict[Distribution, Exception]]: ... working_set: WorkingSet = ... @@ -47,7 +47,7 @@ add_activation_listener = working_set.subscribe class Environment: def __init__(self, search_path: Sequence[str] | None = ..., platform: str | None = ..., python: str | None = ...) -> None: ... - def __getitem__(self, project_name: str) -> List[Distribution]: ... + def __getitem__(self, project_name: str) -> list[Distribution]: ... def __iter__(self) -> Generator[str, None, None]: ... def add(self, dist: Distribution) -> None: ... def remove(self, dist: Distribution) -> None: ... @@ -71,7 +71,7 @@ class Requirement: project_name: str key: str extras: Tuple[str, ...] - specs: List[Tuple[str, str]] + specs: list[Tuple[str, str]] # TODO: change this to packaging.markers.Marker | None once we can import # packaging.markers marker: Any | None @@ -83,9 +83,9 @@ class Requirement: def load_entry_point(dist: _EPDistType, group: str, name: str) -> Any: ... def get_entry_info(dist: _EPDistType, group: str, name: str) -> EntryPoint | None: ... @overload -def get_entry_map(dist: _EPDistType) -> Dict[str, Dict[str, EntryPoint]]: ... +def get_entry_map(dist: _EPDistType) -> dict[str, dict[str, EntryPoint]]: ... @overload -def get_entry_map(dist: _EPDistType, group: str) -> Dict[str, EntryPoint]: ... +def get_entry_map(dist: _EPDistType, group: str) -> dict[str, EntryPoint]: ... class EntryPoint: name: str @@ -104,11 +104,11 @@ class EntryPoint: @classmethod def parse(cls, src: str, dist: Distribution | None = ...) -> EntryPoint: ... @classmethod - def parse_group(cls, group: str, lines: str | Sequence[str], dist: Distribution | None = ...) -> Dict[str, EntryPoint]: ... + def parse_group(cls, group: str, lines: str | Sequence[str], dist: Distribution | None = ...) -> dict[str, EntryPoint]: ... @classmethod def parse_map( - cls, data: Dict[str, str | Sequence[str]] | str | Sequence[str], dist: Distribution | None = ... - ) -> Dict[str, EntryPoint]: ... + cls, data: dict[str, str | Sequence[str]] | str | Sequence[str], dist: Distribution | None = ... + ) -> dict[str, EntryPoint]: ... def load(self, require: bool = ..., env: Environment | None = ..., installer: _InstallerType | None = ...) -> Any: ... def require(self, env: Environment | None = ..., installer: _InstallerType | None = ...) -> None: ... def resolve(self) -> Any: ... @@ -121,7 +121,7 @@ class Distribution(IResourceProvider, IMetadataProvider): location: str project_name: str key: str - extras: List[str] + extras: list[str] version: str parsed_version: Tuple[str, ...] py_version: str @@ -143,17 +143,17 @@ class Distribution(IResourceProvider, IMetadataProvider): ) -> Distribution: ... @classmethod def from_filename(cls, filename: str, metadata: _MetadataType = ..., **kw: str | None | int) -> Distribution: ... - def activate(self, path: List[str] | None = ...) -> None: ... + def activate(self, path: list[str] | None = ...) -> None: ... def as_requirement(self) -> Requirement: ... - def requires(self, extras: Tuple[str, ...] = ...) -> List[Requirement]: ... + def requires(self, extras: Tuple[str, ...] = ...) -> list[Requirement]: ... def clone(self, **kw: str | int | None) -> Requirement: ... def egg_name(self) -> str: ... def __cmp__(self, other: Any) -> bool: ... def get_entry_info(self, group: str, name: str) -> EntryPoint | None: ... @overload - def get_entry_map(self) -> Dict[str, Dict[str, EntryPoint]]: ... + def get_entry_map(self) -> dict[str, dict[str, EntryPoint]]: ... @overload - def get_entry_map(self, group: str) -> Dict[str, EntryPoint]: ... + def get_entry_map(self, group: str) -> dict[str, EntryPoint]: ... def load_entry_point(self, group: str, name: str) -> Any: ... EGG_DIST: int @@ -166,20 +166,20 @@ def resource_exists(package_or_requirement: _PkgReqType, resource_name: str) -> def resource_stream(package_or_requirement: _PkgReqType, resource_name: str) -> IO[bytes]: ... def resource_string(package_or_requirement: _PkgReqType, resource_name: str) -> bytes: ... def resource_isdir(package_or_requirement: _PkgReqType, resource_name: str) -> bool: ... -def resource_listdir(package_or_requirement: _PkgReqType, resource_name: str) -> List[str]: ... +def resource_listdir(package_or_requirement: _PkgReqType, resource_name: str) -> list[str]: ... def resource_filename(package_or_requirement: _PkgReqType, resource_name: str) -> str: ... def set_extraction_path(path: str) -> None: ... -def cleanup_resources(force: bool = ...) -> List[str]: ... +def cleanup_resources(force: bool = ...) -> list[str]: ... class IResourceManager: def resource_exists(self, package_or_requirement: _PkgReqType, resource_name: str) -> bool: ... def resource_stream(self, package_or_requirement: _PkgReqType, resource_name: str) -> IO[bytes]: ... def resource_string(self, package_or_requirement: _PkgReqType, resource_name: str) -> bytes: ... def resource_isdir(self, package_or_requirement: _PkgReqType, resource_name: str) -> bool: ... - def resource_listdir(self, package_or_requirement: _PkgReqType, resource_name: str) -> List[str]: ... + def resource_listdir(self, package_or_requirement: _PkgReqType, resource_name: str) -> list[str]: ... def resource_filename(self, package_or_requirement: _PkgReqType, resource_name: str) -> str: ... def set_extraction_path(self, path: str) -> None: ... - def cleanup_resources(self, force: bool = ...) -> List[str]: ... + def cleanup_resources(self, force: bool = ...) -> list[str]: ... def get_cache_path(self, archive_name: str, names: Iterable[str] = ...) -> str: ... def extraction_error(self) -> None: ... def postprocess(self, tempname: str, filename: str) -> None: ... @@ -192,10 +192,10 @@ def get_provider(package_or_requirement: Requirement) -> Distribution: ... class IMetadataProvider: def has_metadata(self, name: str) -> bool: ... def metadata_isdir(self, name: str) -> bool: ... - def metadata_listdir(self, name: str) -> List[str]: ... + def metadata_listdir(self, name: str) -> list[str]: ... def get_metadata(self, name: str) -> str: ... def get_metadata_lines(self, name: str) -> Generator[str, None, None]: ... - def run_script(self, script_name: str, namespace: Dict[str, Any]) -> None: ... + def run_script(self, script_name: str, namespace: dict[str, Any]) -> None: ... class ResolutionError(Exception): ... diff --git a/stubs/six/six/__init__.pyi b/stubs/six/six/__init__.pyi index bf22203db5d6..46e922bcba56 100644 --- a/stubs/six/six/__init__.pyi +++ b/stubs/six/six/__init__.pyi @@ -10,7 +10,6 @@ from typing import ( Any, AnyStr, Callable, - Dict, ItemsView, Iterable, KeysView, @@ -58,7 +57,7 @@ def get_method_self(meth: types.MethodType) -> object | None: ... def get_function_closure(fun: types.FunctionType) -> Tuple[types._Cell, ...] | None: ... def get_function_code(fun: types.FunctionType) -> types.CodeType: ... def get_function_defaults(fun: types.FunctionType) -> Tuple[Any, ...] | None: ... -def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ... +def get_function_globals(fun: types.FunctionType) -> dict[str, Any]: ... def iterkeys(d: Mapping[_K, Any]) -> typing.Iterator[_K]: ... def itervalues(d: Mapping[Any, _V]) -> typing.Iterator[_V]: ... def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ... diff --git a/stubs/tabulate/tabulate.pyi b/stubs/tabulate/tabulate.pyi index f91b8313b324..8b5efde5bf08 100644 --- a/stubs/tabulate/tabulate.pyi +++ b/stubs/tabulate/tabulate.pyi @@ -1,11 +1,11 @@ -from typing import Any, Callable, Container, Dict, Iterable, List, Mapping, NamedTuple, Sequence, Union +from typing import Any, Callable, Container, Iterable, List, Mapping, NamedTuple, Sequence, Union -LATEX_ESCAPE_RULES: Dict[str, str] +LATEX_ESCAPE_RULES: dict[str, str] MIN_PADDING: int PRESERVE_WHITESPACE: bool WIDE_CHARS_MODE: bool -multiline_formats: Dict[str, str] -tabulate_formats: List[str] +multiline_formats: dict[str, str] +tabulate_formats: list[str] class Line(NamedTuple): begin: str @@ -34,7 +34,7 @@ class TableFormat(NamedTuple): def simple_separated_format(separator: str) -> TableFormat: ... def tabulate( tabular_data: Mapping[str, Iterable[Any]] | Iterable[Iterable[Any]], - headers: str | Dict[str, str] | Sequence[str] = ..., + headers: str | dict[str, str] | Sequence[str] = ..., tablefmt: str | TableFormat = ..., floatfmt: str | Iterable[str] = ..., numalign: str | None = ..., diff --git a/stubs/toml/toml.pyi b/stubs/toml/toml.pyi index ec12441da4a3..3f8580b33376 100644 --- a/stubs/toml/toml.pyi +++ b/stubs/toml/toml.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import StrPath, SupportsWrite -from typing import IO, Any, List, Mapping, MutableMapping, Text, Type, Union +from typing import IO, Any, Mapping, MutableMapping, Text, Type, Union if sys.version_info >= (3, 6): _PathLike = StrPath @@ -13,7 +13,7 @@ else: class TomlDecodeError(Exception): ... -def load(f: _PathLike | List[Text] | IO[str], _dict: Type[MutableMapping[str, Any]] = ...) -> MutableMapping[str, Any]: ... +def load(f: _PathLike | list[Text] | IO[str], _dict: Type[MutableMapping[str, Any]] = ...) -> MutableMapping[str, Any]: ... def loads(s: Text, _dict: Type[MutableMapping[str, Any]] = ...) -> MutableMapping[str, Any]: ... def dump(o: Mapping[str, Any], f: SupportsWrite[str]) -> str: ... def dumps(o: Mapping[str, Any]) -> str: ... diff --git a/stubs/typed-ast/typed_ast/ast27.pyi b/stubs/typed-ast/typed_ast/ast27.pyi index 1991733f4c08..93dbae12ee4d 100644 --- a/stubs/typed-ast/typed_ast/ast27.pyi +++ b/stubs/typed-ast/typed_ast/ast27.pyi @@ -33,21 +33,21 @@ class AST: class mod(AST): ... class Module(mod): - body: typing.List[stmt] - type_ignores: typing.List[TypeIgnore] + body: list[stmt] + type_ignores: list[TypeIgnore] class Interactive(mod): - body: typing.List[stmt] + body: list[stmt] class Expression(mod): body: expr class FunctionType(mod): - argtypes: typing.List[expr] + argtypes: list[expr] returns: expr class Suite(mod): - body: typing.List[stmt] + body: list[stmt] class stmt(AST): lineno: int @@ -56,24 +56,24 @@ class stmt(AST): class FunctionDef(stmt): name: identifier args: arguments - body: typing.List[stmt] - decorator_list: typing.List[expr] + body: list[stmt] + decorator_list: list[expr] type_comment: str | None class ClassDef(stmt): name: identifier - bases: typing.List[expr] - body: typing.List[stmt] - decorator_list: typing.List[expr] + bases: list[expr] + body: list[stmt] + decorator_list: list[expr] class Return(stmt): value: expr | None class Delete(stmt): - targets: typing.List[expr] + targets: list[expr] class Assign(stmt): - targets: typing.List[expr] + targets: list[expr] value: expr type_comment: str | None @@ -84,30 +84,30 @@ class AugAssign(stmt): class Print(stmt): dest: expr | None - values: typing.List[expr] + values: list[expr] nl: bool class For(stmt): target: expr iter: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] type_comment: str | None class While(stmt): test: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] class If(stmt): test: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] class With(stmt): context_expr: expr optional_vars: expr | None - body: typing.List[stmt] + body: list[stmt] type_comment: str | None class Raise(stmt): @@ -116,24 +116,24 @@ class Raise(stmt): tback: expr | None class TryExcept(stmt): - body: typing.List[stmt] - handlers: typing.List[ExceptHandler] - orelse: typing.List[stmt] + body: list[stmt] + handlers: list[ExceptHandler] + orelse: list[stmt] class TryFinally(stmt): - body: typing.List[stmt] - finalbody: typing.List[stmt] + body: list[stmt] + finalbody: list[stmt] class Assert(stmt): test: expr msg: expr | None class Import(stmt): - names: typing.List[alias] + names: list[alias] class ImportFrom(stmt): module: identifier | None - names: typing.List[alias] + names: list[alias] level: int | None class Exec(stmt): @@ -142,7 +142,7 @@ class Exec(stmt): locals: expr | None class Global(stmt): - names: typing.List[identifier] + names: list[identifier] class Expr(stmt): value: expr @@ -160,7 +160,7 @@ class Slice(slice): step: expr | None class ExtSlice(slice): - dims: typing.List[slice] + dims: list[slice] class Index(slice): value: expr @@ -173,7 +173,7 @@ class expr(AST): class BoolOp(expr): op: boolop - values: typing.List[expr] + values: list[expr] class BinOp(expr): left: expr @@ -194,41 +194,41 @@ class IfExp(expr): orelse: expr class Dict(expr): - keys: typing.List[expr] - values: typing.List[expr] + keys: list[expr] + values: list[expr] class Set(expr): - elts: typing.List[expr] + elts: list[expr] class ListComp(expr): elt: expr - generators: typing.List[comprehension] + generators: list[comprehension] class SetComp(expr): elt: expr - generators: typing.List[comprehension] + generators: list[comprehension] class DictComp(expr): key: expr value: expr - generators: typing.List[comprehension] + generators: list[comprehension] class GeneratorExp(expr): elt: expr - generators: typing.List[comprehension] + generators: list[comprehension] class Yield(expr): value: expr | None class Compare(expr): left: expr - ops: typing.List[cmpop] - comparators: typing.List[expr] + ops: list[cmpop] + comparators: list[expr] class Call(expr): func: expr - args: typing.List[expr] - keywords: typing.List[keyword] + args: list[expr] + keywords: list[keyword] starargs: expr | None kwargs: expr | None @@ -257,11 +257,11 @@ class Name(expr): ctx: expr_context class List(expr): - elts: typing.List[expr] + elts: list[expr] ctx: expr_context class Tuple(expr): - elts: typing.List[expr] + elts: list[expr] ctx: expr_context class expr_context(AST): ... @@ -307,21 +307,21 @@ class NotIn(cmpop): ... class comprehension(AST): target: expr iter: expr - ifs: typing.List[expr] + ifs: list[expr] class ExceptHandler(AST): type: expr | None name: expr | None - body: typing.List[stmt] + body: list[stmt] lineno: int col_offset: int class arguments(AST): - args: typing.List[expr] + args: list[expr] vararg: identifier | None kwarg: identifier | None - defaults: typing.List[expr] - type_comments: typing.List[str | None] + defaults: list[expr] + type_comments: list[str | None] class keyword(AST): arg: identifier diff --git a/stubs/typed-ast/typed_ast/ast3.pyi b/stubs/typed-ast/typed_ast/ast3.pyi index 0a62c20bdd17..8d0a830541a9 100644 --- a/stubs/typed-ast/typed_ast/ast3.pyi +++ b/stubs/typed-ast/typed_ast/ast3.pyi @@ -33,21 +33,21 @@ class AST: class mod(AST): ... class Module(mod): - body: typing.List[stmt] - type_ignores: typing.List[TypeIgnore] + body: list[stmt] + type_ignores: list[TypeIgnore] class Interactive(mod): - body: typing.List[stmt] + body: list[stmt] class Expression(mod): body: expr class FunctionType(mod): - argtypes: typing.List[expr] + argtypes: list[expr] returns: expr class Suite(mod): - body: typing.List[stmt] + body: list[stmt] class stmt(AST): lineno: int @@ -56,34 +56,34 @@ class stmt(AST): class FunctionDef(stmt): name: identifier args: arguments - body: typing.List[stmt] - decorator_list: typing.List[expr] + body: list[stmt] + decorator_list: list[expr] returns: expr | None type_comment: str | None class AsyncFunctionDef(stmt): name: identifier args: arguments - body: typing.List[stmt] - decorator_list: typing.List[expr] + body: list[stmt] + decorator_list: list[expr] returns: expr | None type_comment: str | None class ClassDef(stmt): name: identifier - bases: typing.List[expr] - keywords: typing.List[keyword] - body: typing.List[stmt] - decorator_list: typing.List[expr] + bases: list[expr] + keywords: list[keyword] + body: list[stmt] + decorator_list: list[expr] class Return(stmt): value: expr | None class Delete(stmt): - targets: typing.List[expr] + targets: list[expr] class Assign(stmt): - targets: typing.List[expr] + targets: list[expr] value: expr type_comment: str | None @@ -101,35 +101,35 @@ class AnnAssign(stmt): class For(stmt): target: expr iter: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] type_comment: str | None class AsyncFor(stmt): target: expr iter: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] type_comment: str | None class While(stmt): test: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] class If(stmt): test: expr - body: typing.List[stmt] - orelse: typing.List[stmt] + body: list[stmt] + orelse: list[stmt] class With(stmt): - items: typing.List[withitem] - body: typing.List[stmt] + items: list[withitem] + body: list[stmt] type_comment: str | None class AsyncWith(stmt): - items: typing.List[withitem] - body: typing.List[stmt] + items: list[withitem] + body: list[stmt] type_comment: str | None class Raise(stmt): @@ -137,28 +137,28 @@ class Raise(stmt): cause: expr | None class Try(stmt): - body: typing.List[stmt] - handlers: typing.List[ExceptHandler] - orelse: typing.List[stmt] - finalbody: typing.List[stmt] + body: list[stmt] + handlers: list[ExceptHandler] + orelse: list[stmt] + finalbody: list[stmt] class Assert(stmt): test: expr msg: expr | None class Import(stmt): - names: typing.List[alias] + names: list[alias] class ImportFrom(stmt): module: identifier | None - names: typing.List[alias] + names: list[alias] level: int | None class Global(stmt): - names: typing.List[identifier] + names: list[identifier] class Nonlocal(stmt): - names: typing.List[identifier] + names: list[identifier] class Expr(stmt): value: expr @@ -176,7 +176,7 @@ class Slice(slice): step: expr | None class ExtSlice(slice): - dims: typing.List[slice] + dims: list[slice] class Index(slice): value: expr @@ -187,7 +187,7 @@ class expr(AST): class BoolOp(expr): op: boolop - values: typing.List[expr] + values: list[expr] class BinOp(expr): left: expr @@ -208,28 +208,28 @@ class IfExp(expr): orelse: expr class Dict(expr): - keys: typing.List[expr] - values: typing.List[expr] + keys: list[expr] + values: list[expr] class Set(expr): - elts: typing.List[expr] + elts: list[expr] class ListComp(expr): elt: expr - generators: typing.List[comprehension] + generators: list[comprehension] class SetComp(expr): elt: expr - generators: typing.List[comprehension] + generators: list[comprehension] class DictComp(expr): key: expr value: expr - generators: typing.List[comprehension] + generators: list[comprehension] class GeneratorExp(expr): elt: expr - generators: typing.List[comprehension] + generators: list[comprehension] class Await(expr): value: expr @@ -242,13 +242,13 @@ class YieldFrom(expr): class Compare(expr): left: expr - ops: typing.List[cmpop] - comparators: typing.List[expr] + ops: list[cmpop] + comparators: list[expr] class Call(expr): func: expr - args: typing.List[expr] - keywords: typing.List[keyword] + args: list[expr] + keywords: list[keyword] class Num(expr): n: float | int | complex @@ -263,7 +263,7 @@ class FormattedValue(expr): format_spec: expr | None class JoinedStr(expr): - values: typing.List[expr] + values: list[expr] class Bytes(expr): s: bytes @@ -292,11 +292,11 @@ class Name(expr): ctx: expr_context class List(expr): - elts: typing.List[expr] + elts: list[expr] ctx: expr_context class Tuple(expr): - elts: typing.List[expr] + elts: list[expr] ctx: expr_context class expr_context(AST): ... @@ -343,23 +343,23 @@ class NotIn(cmpop): ... class comprehension(AST): target: expr iter: expr - ifs: typing.List[expr] + ifs: list[expr] is_async: int class ExceptHandler(AST): type: expr | None name: identifier | None - body: typing.List[stmt] + body: list[stmt] lineno: int col_offset: int class arguments(AST): - args: typing.List[arg] + args: list[arg] vararg: arg | None - kwonlyargs: typing.List[arg] - kw_defaults: typing.List[expr] + kwonlyargs: list[arg] + kw_defaults: list[expr] kwarg: arg | None - defaults: typing.List[expr] + defaults: list[expr] class arg(AST): arg: identifier diff --git a/stubs/waitress/waitress/adjustments.pyi b/stubs/waitress/waitress/adjustments.pyi index d88ad1d8d7f5..1374444d0fcb 100644 --- a/stubs/waitress/waitress/adjustments.pyi +++ b/stubs/waitress/waitress/adjustments.pyi @@ -1,5 +1,5 @@ from socket import socket -from typing import Any, Dict, FrozenSet, Iterable, List, Sequence, Set, Tuple +from typing import Any, FrozenSet, Iterable, Sequence, Set, Tuple from .compat import HAS_IPV6 as HAS_IPV6, PY2 as PY2, WIN as WIN, string_types as string_types from .proxy_headers import PROXY_HEADERS as PROXY_HEADERS @@ -9,12 +9,12 @@ KNOWN_PROXY_HEADERS: FrozenSet[Any] def asbool(s: bool | str | int | None) -> bool: ... def asoctal(s: str) -> int: ... -def aslist_cronly(value: str) -> List[str]: ... -def aslist(value: str) -> List[str]: ... +def aslist_cronly(value: str) -> list[str]: ... +def aslist(value: str) -> list[str]: ... def asset(value: str | None) -> Set[str]: ... def slash_fixed_str(s: str | None) -> str: ... def str_iftruthy(s: str | None) -> str | None: ... -def as_socket_list(sockets: Sequence[object]) -> List[socket]: ... +def as_socket_list(sockets: Sequence[object]) -> list[socket]: ... class _str_marker(str): ... class _int_marker(int): ... @@ -23,7 +23,7 @@ class _bool_marker: ... class Adjustments: host: _str_marker = ... port: _int_marker = ... - listen: List[str] = ... + listen: list[str] = ... threads: int = ... trusted_proxy: str | None = ... trusted_proxy_count: int | None = ... @@ -48,14 +48,14 @@ class Adjustments: expose_tracebacks: bool = ... unix_socket: str | None = ... unix_socket_perms: int = ... - socket_options: List[Tuple[int, int, int]] = ... + socket_options: list[Tuple[int, int, int]] = ... asyncore_loop_timeout: int = ... asyncore_use_poll: bool = ... ipv4: bool = ... ipv6: bool = ... - sockets: List[socket] = ... + sockets: list[socket] = ... def __init__(self, **kw: Any) -> None: ... @classmethod - def parse_args(cls, argv: str) -> Tuple[Dict[str, Any], Any]: ... + def parse_args(cls, argv: str) -> Tuple[dict[str, Any], Any]: ... @classmethod def check_sockets(cls, sockets: Iterable[socket]) -> None: ...