diff --git a/stdlib/asyncio/base_subprocess.pyi b/stdlib/asyncio/base_subprocess.pyi index a27fe7643..23034790a 100644 --- a/stdlib/asyncio/base_subprocess.pyi +++ b/stdlib/asyncio/base_subprocess.pyi @@ -1,5 +1,6 @@ import subprocess -from typing import IO, Any, Callable, Deque, Optional, Sequence, Tuple, Union +from collections import deque +from typing import IO, Any, Callable, Optional, Sequence, Tuple, Union from . import events, futures, protocols, transports @@ -14,7 +15,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport): _pid: int | None # undocumented _returncode: int | None # undocumented _exit_waiters: list[futures.Future[Any]] # undocumented - _pending_calls: Deque[tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented + _pending_calls: deque[tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented _pipes: dict[int, _File] # undocumented _finished: bool # undocumented def __init__( diff --git a/stdlib/asyncio/locks.pyi b/stdlib/asyncio/locks.pyi index 901232740..7c4f40d9e 100644 --- a/stdlib/asyncio/locks.pyi +++ b/stdlib/asyncio/locks.pyi @@ -1,6 +1,7 @@ import sys +from collections import deque from types import TracebackType -from typing import Any, Awaitable, Callable, Deque, Generator, Type, TypeVar +from typing import Any, Awaitable, Callable, Generator, Type, TypeVar from .events import AbstractEventLoop from .futures import Future @@ -57,7 +58,7 @@ class Condition(_ContextManagerMixin): class Semaphore(_ContextManagerMixin): _value: int - _waiters: Deque[Future[Any]] + _waiters: deque[Future[Any]] def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... def locked(self) -> bool: ... async def acquire(self) -> bool: ... diff --git a/stdlib/asyncio/sslproto.pyi b/stdlib/asyncio/sslproto.pyi index 54f2a74f9..082e96dc0 100644 --- a/stdlib/asyncio/sslproto.pyi +++ b/stdlib/asyncio/sslproto.pyi @@ -1,6 +1,7 @@ import ssl import sys -from typing import Any, Callable, ClassVar, Deque +from collections import deque +from typing import Any, Callable, ClassVar from typing_extensions import Literal from . import constants, events, futures, protocols, transports @@ -73,7 +74,7 @@ class SSLProtocol(protocols.Protocol): _server_hostname: str | None _sslcontext: ssl.SSLContext _extra: dict[str, Any] - _write_backlog: Deque[tuple[bytes, int]] + _write_backlog: deque[tuple[bytes, int]] _write_buffer_size: int _waiter: futures.Future[Any] _loop: events.AbstractEventLoop diff --git a/stdlib/asyncio/tasks.pyi b/stdlib/asyncio/tasks.pyi index 49f70e0db..15c12909f 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, Optional, Set, TextIO, TypeVar, Union, overload +from typing import Any, Generic, Optional, TextIO, TypeVar, Union, overload from typing_extensions import Literal from .events import AbstractEventLoop @@ -232,22 +232,22 @@ if sys.version_info >= (3, 10): def shield(arg: _FutureT[_T]) -> Future[_T]: ... def sleep(delay: float, result: _T = ...) -> Future[_T]: ... @overload - def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> Future[tuple[Set[_FT], Set[_FT]]]: ... # type: ignore + def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> Future[tuple[set[_FT], set[_FT]]]: ... # type: ignore @overload def wait( fs: Iterable[Awaitable[_T]], *, timeout: float | None = ..., return_when: str = ... - ) -> Future[tuple[Set[Task[_T]], Set[Task[_T]]]]: ... + ) -> Future[tuple[set[Task[_T]], set[Task[_T]]]]: ... def wait_for(fut: _FutureT[_T], timeout: float | None) -> Future[_T]: ... else: def shield(arg: _FutureT[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ... def sleep(delay: float, result: _T = ..., *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ... @overload - def wait(fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...) -> Future[tuple[Set[_FT], Set[_FT]]]: ... # type: ignore + def wait(fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...) -> Future[tuple[set[_FT], set[_FT]]]: ... # type: ignore @overload def wait( fs: Iterable[Awaitable[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ... - ) -> Future[tuple[Set[Task[_T]], Set[Task[_T]]]]: ... + ) -> Future[tuple[set[Task[_T]], set[Task[_T]]]]: ... def wait_for(fut: _FutureT[_T], timeout: float | None, *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ... class Task(Future[_T], Generic[_T]): @@ -278,14 +278,14 @@ class Task(Future[_T], Generic[_T]): @classmethod def current_task(cls, loop: AbstractEventLoop | None = ...) -> Task[Any] | None: ... @classmethod - def all_tasks(cls, loop: AbstractEventLoop | None = ...) -> Set[Task[Any]]: ... + def all_tasks(cls, loop: AbstractEventLoop | None = ...) -> set[Task[Any]]: ... if sys.version_info < (3, 7): def _wakeup(self, fut: Future[Any]) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... if sys.version_info >= (3, 7): - def all_tasks(loop: AbstractEventLoop | None = ...) -> Set[Task[Any]]: ... + def all_tasks(loop: AbstractEventLoop | None = ...) -> set[Task[Any]]: ... if sys.version_info >= (3, 8): def create_task(coro: Generator[_TaskYieldType, None, _T] | Awaitable[_T], *, name: str | None = ...) -> Task[_T]: ... else: diff --git a/stdlib/concurrent/futures/thread.pyi b/stdlib/concurrent/futures/thread.pyi index 7a35bfc6e..5ad5b65d3 100644 --- a/stdlib/concurrent/futures/thread.pyi +++ b/stdlib/concurrent/futures/thread.pyi @@ -1,6 +1,6 @@ import queue import sys -from collections.abc import Iterable, Mapping, Set +from collections.abc import Iterable, Mapping, Set # equivalent to typing.AbstractSet, not builtins.set from threading import Lock, Semaphore, Thread from typing import Any, Callable, Generic, Tuple, TypeVar from weakref import ref diff --git a/stdlib/email/_header_value_parser.pyi b/stdlib/email/_header_value_parser.pyi index a4c060ef4..f1b08b5d5 100644 --- a/stdlib/email/_header_value_parser.pyi +++ b/stdlib/email/_header_value_parser.pyi @@ -1,22 +1,22 @@ import sys from email.errors import HeaderParseError, MessageDefect from email.policy import Policy -from typing import Any, Iterable, Iterator, List, Pattern, Set, Type, TypeVar, Union +from typing import Any, Iterable, Iterator, List, Pattern, Type, TypeVar, Union from typing_extensions import Final _T = TypeVar("_T") -WSP: Final[Set[str]] -CFWS_LEADER: Final[Set[str]] -SPECIALS: Final[Set[str]] -ATOM_ENDS: Final[Set[str]] -DOT_ATOM_ENDS: Final[Set[str]] -PHRASE_ENDS: Final[Set[str]] -TSPECIALS: Final[Set[str]] -TOKEN_ENDS: Final[Set[str]] -ASPECIALS: Final[Set[str]] -ATTRIBUTE_ENDS: Final[Set[str]] -EXTENDED_ATTRIBUTE_ENDS: Final[Set[str]] +WSP: Final[set[str]] +CFWS_LEADER: Final[set[str]] +SPECIALS: Final[set[str]] +ATOM_ENDS: Final[set[str]] +DOT_ATOM_ENDS: Final[set[str]] +PHRASE_ENDS: Final[set[str]] +TSPECIALS: Final[set[str]] +TOKEN_ENDS: Final[set[str]] +ASPECIALS: Final[set[str]] +ATTRIBUTE_ENDS: Final[set[str]] +EXTENDED_ATTRIBUTE_ENDS: Final[set[str]] def quote_string(value: Any) -> str: ... diff --git a/stdlib/lib2to3/pgen2/parse.pyi b/stdlib/lib2to3/pgen2/parse.pyi index feed7269e..e776ed1e5 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, Sequence, Set +from typing import Any, Sequence _Context = Sequence[Any] @@ -16,7 +16,7 @@ class Parser: convert: _Convert stack: list[tuple[_DFAS, int, _RawNode]] rootnode: _NL | None - used_names: Set[str] + used_names: set[str] def __init__(self, grammar: Grammar, convert: _Convert | None = ...) -> None: ... def setup(self, start: int | None = ...) -> None: ... def addtoken(self, type: int, value: str | None, context: _Context) -> bool: ... diff --git a/stdlib/msilib/__init__.pyi b/stdlib/msilib/__init__.pyi index d72c8efc8..4e1a7e6a7 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, Iterable, Sequence, Set, Tuple, Type +from typing import Any, Container, Iterable, Sequence, Tuple, Type from typing_extensions import Literal if sys.platform == "win32": @@ -49,13 +49,13 @@ if sys.platform == "win32": name: str files: list[tuple[str, str]] - filenames: Set[str] + filenames: set[str] index: int def __init__(self, name: str) -> None: ... def gen_id(self, file: str) -> str: ... def append(self, full: str, file: str, logical: str) -> tuple[int, str]: ... def commit(self, db: _Database) -> None: ... - _directories: Set[str] + _directories: set[str] class Directory: db: _Database @@ -64,8 +64,8 @@ if sys.platform == "win32": physical: str logical: str component: str | None - short_names: Set[str] - ids: Set[str] + short_names: set[str] + ids: set[str] keyfiles: dict[str, str] componentflags: int | None absolute: str diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 7a4588a97..b432f6931 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -30,7 +30,6 @@ from typing import ( NoReturn, Protocol, Sequence, - Set, Tuple, TypeVar, Union, @@ -56,10 +55,10 @@ error = OSError supports_bytes_environ: bool -supports_dir_fd: Set[Callable[..., Any]] -supports_fd: Set[Callable[..., Any]] -supports_effective_ids: Set[Callable[..., Any]] -supports_follow_symlinks: Set[Callable[..., Any]] +supports_dir_fd: set[Callable[..., Any]] +supports_fd: set[Callable[..., Any]] +supports_effective_ids: set[Callable[..., Any]] +supports_follow_symlinks: set[Callable[..., Any]] if sys.platform != "win32": # Unix only @@ -830,7 +829,7 @@ if sys.platform != "win32": def sched_setparam(pid: int, param: sched_param) -> None: ... # some flavors of Unix def sched_getparam(pid: int) -> sched_param: ... # some flavors of Unix def sched_setaffinity(pid: int, mask: Iterable[int]) -> None: ... # some flavors of Unix - def sched_getaffinity(pid: int) -> Set[int]: ... # some flavors of Unix + def sched_getaffinity(pid: int) -> set[int]: ... # some flavors of Unix def cpu_count() -> int | None: ... diff --git a/stdlib/unittest/case.pyi b/stdlib/unittest/case.pyi index ebb1f2457..057ac1620 100644 --- a/stdlib/unittest/case.pyi +++ b/stdlib/unittest/case.pyi @@ -3,7 +3,7 @@ import logging import sys import unittest.result from _typeshed import Self -from collections.abc import Set +from collections.abc import Set # equivalent to typing.AbstractSet, not builtins.set from types import TracebackType from typing import ( Any, diff --git a/stdlib/zoneinfo/__init__.pyi b/stdlib/zoneinfo/__init__.pyi index 2a188c7d0..4f924e0cc 100644 --- a/stdlib/zoneinfo/__init__.pyi +++ b/stdlib/zoneinfo/__init__.pyi @@ -1,7 +1,7 @@ import typing from _typeshed import StrPath from datetime import tzinfo -from typing import Any, Iterable, Protocol, Sequence, Set, Type +from typing import Any, Iterable, Protocol, Sequence, Type _T = typing.TypeVar("_T", bound="ZoneInfo") @@ -24,7 +24,7 @@ class ZoneInfo(tzinfo): # a sequence of strings is required. This should be remedied if a solution # to this typing bug is found: https://github.com/python/typing/issues/256 def reset_tzpath(to: Sequence[StrPath] | None = ...) -> None: ... -def available_timezones() -> Set[str]: ... +def available_timezones() -> set[str]: ... TZPATH: Sequence[str]