Skip to content

Commit e1210cc

Browse files
committed
Typeshed cherry-pick: Use AbstractSet instead of set in random and inspect (#6574)
1 parent 2f0434f commit e1210cc

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

mypy/typeshed/stdlib/inspect.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import sys
33
import types
44
from _typeshed import Self
55
from collections import OrderedDict
6-
from collections.abc import Awaitable, Callable, Generator, Mapping, Sequence
6+
from collections.abc import Awaitable, Callable, Generator, Mapping, Sequence, Set as AbstractSet
77
from types import (
88
AsyncGeneratorType,
99
BuiltinFunctionType,
@@ -313,7 +313,7 @@ class ClosureVars(NamedTuple):
313313
nonlocals: Mapping[str, Any]
314314
globals: Mapping[str, Any]
315315
builtins: Mapping[str, Any]
316-
unbound: set[str]
316+
unbound: AbstractSet[str]
317317

318318
def getclosurevars(func: Callable[..., Any]) -> ClosureVars: ...
319319
def unwrap(func: Callable[..., Any], *, stop: Callable[[Any], Any] | None = ...) -> Any: ...

mypy/typeshed/stdlib/random.pyi

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _random
22
import sys
3-
from collections.abc import Callable, Iterable, MutableSequence, Sequence
3+
from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set as AbstractSet
44
from fractions import Fraction
55
from typing import Any, NoReturn, Tuple, TypeVar
66

@@ -27,9 +27,9 @@ class Random(_random.Random):
2727
) -> list[_T]: ...
2828
def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ...
2929
if sys.version_info >= (3, 9):
30-
def sample(self, population: Sequence[_T] | set[_T], k: int, *, counts: Iterable[_T] | None = ...) -> list[_T]: ...
30+
def sample(self, population: Sequence[_T] | AbstractSet[_T], k: int, *, counts: Iterable[_T] | None = ...) -> list[_T]: ...
3131
else:
32-
def sample(self, population: Sequence[_T] | set[_T], k: int) -> list[_T]: ...
32+
def sample(self, population: Sequence[_T] | AbstractSet[_T], k: int) -> list[_T]: ...
3333
def random(self) -> float: ...
3434
def uniform(self, a: float, b: float) -> float: ...
3535
def triangular(self, low: float = ..., high: float = ..., mode: float | None = ...) -> float: ...
@@ -66,10 +66,10 @@ def choices(
6666
def shuffle(x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ...
6767

6868
if sys.version_info >= (3, 9):
69-
def sample(population: Sequence[_T] | set[_T], k: int, *, counts: Iterable[_T] | None = ...) -> list[_T]: ...
69+
def sample(population: Sequence[_T] | AbstractSet[_T], k: int, *, counts: Iterable[_T] | None = ...) -> list[_T]: ...
7070

7171
else:
72-
def sample(population: Sequence[_T] | set[_T], k: int) -> list[_T]: ...
72+
def sample(population: Sequence[_T] | AbstractSet[_T], k: int) -> list[_T]: ...
7373

7474
def random() -> float: ...
7575
def uniform(a: float, b: float) -> float: ...

0 commit comments

Comments
 (0)