Skip to content

Commit 029cf55

Browse files
authored
Use lowercase set/deque in stdlib subdirectories (#6350)
1 parent 5c8e68f commit 029cf55

File tree

11 files changed

+44
-42
lines changed

11 files changed

+44
-42
lines changed

stdlib/asyncio/base_subprocess.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import subprocess
2-
from typing import IO, Any, Callable, Deque, Optional, Sequence, Tuple, Union
2+
from collections import deque
3+
from typing import IO, Any, Callable, Optional, Sequence, Tuple, Union
34

45
from . import events, futures, protocols, transports
56

@@ -14,7 +15,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
1415
_pid: int | None # undocumented
1516
_returncode: int | None # undocumented
1617
_exit_waiters: list[futures.Future[Any]] # undocumented
17-
_pending_calls: Deque[tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented
18+
_pending_calls: deque[tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented
1819
_pipes: dict[int, _File] # undocumented
1920
_finished: bool # undocumented
2021
def __init__(

stdlib/asyncio/locks.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
2+
from collections import deque
23
from types import TracebackType
3-
from typing import Any, Awaitable, Callable, Deque, Generator, Type, TypeVar
4+
from typing import Any, Awaitable, Callable, Generator, Type, TypeVar
45

56
from .events import AbstractEventLoop
67
from .futures import Future
@@ -57,7 +58,7 @@ class Condition(_ContextManagerMixin):
5758

5859
class Semaphore(_ContextManagerMixin):
5960
_value: int
60-
_waiters: Deque[Future[Any]]
61+
_waiters: deque[Future[Any]]
6162
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
6263
def locked(self) -> bool: ...
6364
async def acquire(self) -> bool: ...

stdlib/asyncio/sslproto.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ssl
22
import sys
3-
from typing import Any, Callable, ClassVar, Deque
3+
from collections import deque
4+
from typing import Any, Callable, ClassVar
45
from typing_extensions import Literal
56

67
from . import constants, events, futures, protocols, transports
@@ -73,7 +74,7 @@ class SSLProtocol(protocols.Protocol):
7374
_server_hostname: str | None
7475
_sslcontext: ssl.SSLContext
7576
_extra: dict[str, Any]
76-
_write_backlog: Deque[tuple[bytes, int]]
77+
_write_backlog: deque[tuple[bytes, int]]
7778
_write_buffer_size: int
7879
_waiter: futures.Future[Any]
7980
_loop: events.AbstractEventLoop

stdlib/asyncio/tasks.pyi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import concurrent.futures
22
import sys
33
from collections.abc import Awaitable, Generator, Iterable, Iterator
44
from types import FrameType
5-
from typing import Any, Generic, Optional, Set, TextIO, TypeVar, Union, overload
5+
from typing import Any, Generic, Optional, TextIO, TypeVar, Union, overload
66
from typing_extensions import Literal
77

88
from .events import AbstractEventLoop
@@ -232,22 +232,22 @@ if sys.version_info >= (3, 10):
232232
def shield(arg: _FutureT[_T]) -> Future[_T]: ...
233233
def sleep(delay: float, result: _T = ...) -> Future[_T]: ...
234234
@overload
235-
def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> Future[tuple[Set[_FT], Set[_FT]]]: ... # type: ignore
235+
def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> Future[tuple[set[_FT], set[_FT]]]: ... # type: ignore
236236
@overload
237237
def wait(
238238
fs: Iterable[Awaitable[_T]], *, timeout: float | None = ..., return_when: str = ...
239-
) -> Future[tuple[Set[Task[_T]], Set[Task[_T]]]]: ...
239+
) -> Future[tuple[set[Task[_T]], set[Task[_T]]]]: ...
240240
def wait_for(fut: _FutureT[_T], timeout: float | None) -> Future[_T]: ...
241241

242242
else:
243243
def shield(arg: _FutureT[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...
244244
def sleep(delay: float, result: _T = ..., *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...
245245
@overload
246-
def wait(fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...) -> Future[tuple[Set[_FT], Set[_FT]]]: ... # type: ignore
246+
def wait(fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...) -> Future[tuple[set[_FT], set[_FT]]]: ... # type: ignore
247247
@overload
248248
def wait(
249249
fs: Iterable[Awaitable[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...
250-
) -> Future[tuple[Set[Task[_T]], Set[Task[_T]]]]: ...
250+
) -> Future[tuple[set[Task[_T]], set[Task[_T]]]]: ...
251251
def wait_for(fut: _FutureT[_T], timeout: float | None, *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...
252252

253253
class Task(Future[_T], Generic[_T]):
@@ -278,14 +278,14 @@ class Task(Future[_T], Generic[_T]):
278278
@classmethod
279279
def current_task(cls, loop: AbstractEventLoop | None = ...) -> Task[Any] | None: ...
280280
@classmethod
281-
def all_tasks(cls, loop: AbstractEventLoop | None = ...) -> Set[Task[Any]]: ...
281+
def all_tasks(cls, loop: AbstractEventLoop | None = ...) -> set[Task[Any]]: ...
282282
if sys.version_info < (3, 7):
283283
def _wakeup(self, fut: Future[Any]) -> None: ...
284284
if sys.version_info >= (3, 9):
285285
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
286286

287287
if sys.version_info >= (3, 7):
288-
def all_tasks(loop: AbstractEventLoop | None = ...) -> Set[Task[Any]]: ...
288+
def all_tasks(loop: AbstractEventLoop | None = ...) -> set[Task[Any]]: ...
289289
if sys.version_info >= (3, 8):
290290
def create_task(coro: Generator[_TaskYieldType, None, _T] | Awaitable[_T], *, name: str | None = ...) -> Task[_T]: ...
291291
else:

stdlib/concurrent/futures/thread.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import queue
22
import sys
3-
from collections.abc import Iterable, Mapping, Set
3+
from collections.abc import Iterable, Mapping, Set # equivalent to typing.AbstractSet, not builtins.set
44
from threading import Lock, Semaphore, Thread
55
from typing import Any, Callable, Generic, Tuple, TypeVar
66
from weakref import ref

stdlib/email/_header_value_parser.pyi

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import sys
22
from email.errors import HeaderParseError, MessageDefect
33
from email.policy import Policy
4-
from typing import Any, Iterable, Iterator, List, Pattern, Set, Type, TypeVar, Union
4+
from typing import Any, Iterable, Iterator, List, Pattern, Type, TypeVar, Union
55
from typing_extensions import Final
66

77
_T = TypeVar("_T")
88

9-
WSP: Final[Set[str]]
10-
CFWS_LEADER: Final[Set[str]]
11-
SPECIALS: Final[Set[str]]
12-
ATOM_ENDS: Final[Set[str]]
13-
DOT_ATOM_ENDS: Final[Set[str]]
14-
PHRASE_ENDS: Final[Set[str]]
15-
TSPECIALS: Final[Set[str]]
16-
TOKEN_ENDS: Final[Set[str]]
17-
ASPECIALS: Final[Set[str]]
18-
ATTRIBUTE_ENDS: Final[Set[str]]
19-
EXTENDED_ATTRIBUTE_ENDS: Final[Set[str]]
9+
WSP: Final[set[str]]
10+
CFWS_LEADER: Final[set[str]]
11+
SPECIALS: Final[set[str]]
12+
ATOM_ENDS: Final[set[str]]
13+
DOT_ATOM_ENDS: Final[set[str]]
14+
PHRASE_ENDS: Final[set[str]]
15+
TSPECIALS: Final[set[str]]
16+
TOKEN_ENDS: Final[set[str]]
17+
ASPECIALS: Final[set[str]]
18+
ATTRIBUTE_ENDS: Final[set[str]]
19+
EXTENDED_ATTRIBUTE_ENDS: Final[set[str]]
2020

2121
def quote_string(value: Any) -> str: ...
2222

stdlib/lib2to3/pgen2/parse.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from lib2to3.pgen2.grammar import _DFAS, Grammar
22
from lib2to3.pytree import _NL, _Convert, _RawNode
3-
from typing import Any, Sequence, Set
3+
from typing import Any, Sequence
44

55
_Context = Sequence[Any]
66

@@ -16,7 +16,7 @@ class Parser:
1616
convert: _Convert
1717
stack: list[tuple[_DFAS, int, _RawNode]]
1818
rootnode: _NL | None
19-
used_names: Set[str]
19+
used_names: set[str]
2020
def __init__(self, grammar: Grammar, convert: _Convert | None = ...) -> None: ...
2121
def setup(self, start: int | None = ...) -> None: ...
2222
def addtoken(self, type: int, value: str | None, context: _Context) -> bool: ...

stdlib/msilib/__init__.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from types import ModuleType
3-
from typing import Any, Container, Iterable, Sequence, Set, Tuple, Type
3+
from typing import Any, Container, Iterable, Sequence, Tuple, Type
44
from typing_extensions import Literal
55

66
if sys.platform == "win32":
@@ -49,13 +49,13 @@ if sys.platform == "win32":
4949

5050
name: str
5151
files: list[tuple[str, str]]
52-
filenames: Set[str]
52+
filenames: set[str]
5353
index: int
5454
def __init__(self, name: str) -> None: ...
5555
def gen_id(self, file: str) -> str: ...
5656
def append(self, full: str, file: str, logical: str) -> tuple[int, str]: ...
5757
def commit(self, db: _Database) -> None: ...
58-
_directories: Set[str]
58+
_directories: set[str]
5959
class Directory:
6060

6161
db: _Database
@@ -64,8 +64,8 @@ if sys.platform == "win32":
6464
physical: str
6565
logical: str
6666
component: str | None
67-
short_names: Set[str]
68-
ids: Set[str]
67+
short_names: set[str]
68+
ids: set[str]
6969
keyfiles: dict[str, str]
7070
componentflags: int | None
7171
absolute: str

stdlib/os/__init__.pyi

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ from typing import (
3030
NoReturn,
3131
Protocol,
3232
Sequence,
33-
Set,
3433
Tuple,
3534
TypeVar,
3635
Union,
@@ -56,10 +55,10 @@ error = OSError
5655

5756
supports_bytes_environ: bool
5857

59-
supports_dir_fd: Set[Callable[..., Any]]
60-
supports_fd: Set[Callable[..., Any]]
61-
supports_effective_ids: Set[Callable[..., Any]]
62-
supports_follow_symlinks: Set[Callable[..., Any]]
58+
supports_dir_fd: set[Callable[..., Any]]
59+
supports_fd: set[Callable[..., Any]]
60+
supports_effective_ids: set[Callable[..., Any]]
61+
supports_follow_symlinks: set[Callable[..., Any]]
6362

6463
if sys.platform != "win32":
6564
# Unix only
@@ -830,7 +829,7 @@ if sys.platform != "win32":
830829
def sched_setparam(pid: int, param: sched_param) -> None: ... # some flavors of Unix
831830
def sched_getparam(pid: int) -> sched_param: ... # some flavors of Unix
832831
def sched_setaffinity(pid: int, mask: Iterable[int]) -> None: ... # some flavors of Unix
833-
def sched_getaffinity(pid: int) -> Set[int]: ... # some flavors of Unix
832+
def sched_getaffinity(pid: int) -> set[int]: ... # some flavors of Unix
834833

835834
def cpu_count() -> int | None: ...
836835

stdlib/unittest/case.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import logging
33
import sys
44
import unittest.result
55
from _typeshed import Self
6-
from collections.abc import Set
6+
from collections.abc import Set # equivalent to typing.AbstractSet, not builtins.set
77
from types import TracebackType
88
from typing import (
99
Any,

stdlib/zoneinfo/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import typing
22
from _typeshed import StrPath
33
from datetime import tzinfo
4-
from typing import Any, Iterable, Protocol, Sequence, Set, Type
4+
from typing import Any, Iterable, Protocol, Sequence, Type
55

66
_T = typing.TypeVar("_T", bound="ZoneInfo")
77

@@ -24,7 +24,7 @@ class ZoneInfo(tzinfo):
2424
# a sequence of strings is required. This should be remedied if a solution
2525
# to this typing bug is found: https://github.com/python/typing/issues/256
2626
def reset_tzpath(to: Sequence[StrPath] | None = ...) -> None: ...
27-
def available_timezones() -> Set[str]: ...
27+
def available_timezones() -> set[str]: ...
2828

2929
TZPATH: Sequence[str]
3030

0 commit comments

Comments
 (0)