Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stdlib/concurrent/futures/thread.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import queue
import sys
from collections.abc import Iterable, Mapping, Set # equivalent to typing.AbstractSet, not builtins.set
from collections.abc import Iterable, Mapping, Set as AbstractSet
from threading import Lock, Semaphore, Thread
from typing import Any, Callable, Generic, Tuple, TypeVar
from weakref import ref
Expand Down Expand Up @@ -46,7 +46,7 @@ if sys.version_info >= (3, 7):
class ThreadPoolExecutor(Executor):
_max_workers: int
_idle_semaphore: Semaphore
_threads: Set[Thread]
_threads: AbstractSet[Thread]
_broken: bool
_shutdown: bool
_shutdown_lock: Lock
Expand Down
4 changes: 2 additions & 2 deletions stdlib/unittest/case.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import logging
import sys
import unittest.result
from _typeshed import Self
from collections.abc import Set # equivalent to typing.AbstractSet, not builtins.set
from collections.abc import Set as AbstractSet
from contextlib import AbstractContextManager
from types import TracebackType
from typing import (
Expand Down Expand Up @@ -201,7 +201,7 @@ class TestCase:
) -> 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 assertSetEqual(self, set1: AbstractSet[object], set2: AbstractSet[object], msg: Any = ...) -> None: ...
def assertDictEqual(self, d1: Mapping[Any, object], d2: Mapping[Any, object], msg: Any = ...) -> None: ...
def fail(self, msg: Any = ...) -> NoReturn: ...
def countTestCases(self) -> int: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/Pygments/pygments/style.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from collections.abc import Iterator, Mapping, Set
from collections.abc import Iterator, Mapping, Set as AbstractSet
from typing_extensions import TypedDict

from pygments.token import _TokenType

ansicolors: Set[str] # not intended to be mutable (== typing.AbstractSet, not builtins.set)
ansicolors: AbstractSet[str] # not intended to be mutable

class _StyleDict(TypedDict):
color: str | None
Expand Down
6 changes: 3 additions & 3 deletions stubs/dateparser/dateparser/search/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from collections.abc import Mapping, Set
from collections.abc import Mapping, Set as AbstractSet
from datetime import datetime
from typing import Any, Tuple, overload

Expand All @@ -11,14 +11,14 @@ else:
@overload
def search_dates(
text: str,
languages: list[str] | Tuple[str, ...] | Set[str] | None,
languages: list[str] | Tuple[str, ...] | AbstractSet[str] | None,
settings: Mapping[Any, Any] | None,
add_detected_language: Literal[True],
) -> list[tuple[str, datetime, str]]: ...
@overload
def search_dates(
text: str,
languages: list[str] | Tuple[str, ...] | Set[str] | None = ...,
languages: list[str] | Tuple[str, ...] | AbstractSet[str] | None = ...,
settings: Mapping[Any, Any] | None = ...,
add_detected_language: Literal[False] = ...,
) -> list[tuple[str, datetime]]: ...
6 changes: 5 additions & 1 deletion tests/check_new_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ def old_syntax_finder(self) -> OldSyntaxFinder:
def visit_ImportFrom(self, node: ast.ImportFrom) -> None:
if node.module == "collections.abc":
imported_classes = node.names
if any(cls.name == "Set" for cls in imported_classes):
if any(cls.name == "Set" and cls.asname != "AbstractSet" for cls in imported_classes):
errors.append(
f"{path}:{node.lineno}: "
f"Use `from collections.abc import Set as AbstractSet` to avoid confusion with `builtins.set`"
)
self.set_from_collections_abc = True

elif node.module == "typing_extensions":
Expand Down