Skip to content

Commit 197295b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
1 parent fd6231b commit 197295b

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

stdlib/builtins.pyi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,7 @@ class dict(MutableMapping[_KT, _VT]):
13311331
@classmethod
13321332
@overload
13331333
def fromkeys(cls, iterable: Iterable[_H1], value: _T, /) -> dict[_H1, _T]: ...
1334+
13341335
# Positional-only in dict, but not in MutableMapping
13351336
@overload # type: ignore[override]
13361337
def get(self, key: _KT, default: None = None, /) -> _VT | None: ...
@@ -1357,13 +1358,15 @@ class dict(MutableMapping[_KT, _VT]):
13571358
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
13581359
if sys.version_info >= (3, 15):
13591360
def __or__(self, value: dict[_H1, _T] | frozendict[_H1, _T], /) -> dict[_KT | _H1, _VT | _T]: ...
1361+
13601362
@overload
13611363
def __ror__(self, value: dict[_H1, _T], /) -> dict[_KT | _H1, _VT | _T]: ...
13621364
@overload
13631365
def __ror__(self, value: frozendict[_H1, _T], /) -> frozendict[_KT | _H1, _VT | _T]: ...
13641366
else:
13651367
def __or__(self, value: dict[_H1, _T], /) -> dict[_KT | _H1, _VT | _T]: ...
13661368
def __ror__(self, value: dict[_H1, _T], /) -> dict[_KT | _H1, _VT | _T]: ...
1369+
13671370
# dict.__ior__ should be kept roughly in line with MutableMapping.update()
13681371
@overload # type: ignore[misc]
13691372
def __ior__(self, value: SupportsKeysAndGetItem[_KT, _VT], /) -> Self: ...
@@ -1399,6 +1402,7 @@ if sys.version_info >= (3, 15):
13991402
@overload
14001403
@classmethod
14011404
def fromkeys(cls, iterable: Iterable[_H1], value: _T, /) -> frozendict[_H1, _T]: ...
1405+
14021406
@overload # type: ignore[override]
14031407
def get(self, key: _KT, default: None = None, /) -> _VT | None: ...
14041408
@overload
@@ -1428,6 +1432,7 @@ class set(MutableSet[_H1]):
14281432
def __init__(self) -> None: ...
14291433
@overload
14301434
def __init__(self, iterable: Iterable[_H1], /) -> None: ...
1435+
14311436
def add(self, element: _H1, /) -> None: ...
14321437
def copy(self) -> set[_H1]: ...
14331438
def difference(self, *s: Iterable[Hashable]) -> set[_H1]: ...
@@ -1468,6 +1473,7 @@ class frozenset(AbstractSet[_H1_co]):
14681473
def __new__(cls) -> Self: ...
14691474
@overload
14701475
def __new__(cls, iterable: Iterable[_H1_co], /) -> Self: ...
1476+
14711477
def copy(self) -> frozenset[_H1_co]: ...
14721478
def difference(self, *s: Iterable[Hashable]) -> frozenset[_H1_co]: ...
14731479
def intersection(self, *s: Iterable[Hashable]) -> frozenset[_H1_co]: ...

stdlib/collections/__init__.pyi

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,17 @@ class UserDict(MutableMapping[_KT, _VT]):
9191
@classmethod
9292
@overload
9393
def fromkeys(cls, iterable: Iterable[_KT], value: _T) -> UserDict[_KT, _T]: ...
94+
9495
@overload
9596
def __or__(self, other: UserDict[_KT, _VT] | dict[_KT, _VT]) -> Self: ...
9697
@overload
9798
def __or__(self, other: UserDict[_KT2, _T] | dict[_KT2, _T]) -> UserDict[_KT | _KT2, _VT | _T]: ...
99+
98100
@overload
99101
def __ror__(self, other: UserDict[_KT, _VT] | dict[_KT, _VT]) -> Self: ...
100102
@overload
101103
def __ror__(self, other: UserDict[_KT2, _T] | dict[_KT2, _T]) -> UserDict[_KT | _KT2, _VT | _T]: ...
104+
102105
# UserDict.__ior__ should be kept roughly in line with MutableMapping.update()
103106
@overload # type: ignore[misc]
104107
def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
@@ -290,6 +293,7 @@ class Counter(dict[_KT, int], Generic[_KT]):
290293
def __init__(self, mapping: SupportsKeysAndGetItem[_KT, int], /) -> None: ...
291294
@overload
292295
def __init__(self, iterable: Iterable[_KT], /) -> None: ...
296+
293297
def copy(self) -> Self: ...
294298
def elements(self) -> Iterator[_KT]: ...
295299
def most_common(self, n: int | None = None) -> list[tuple[_KT, int]]: ...
@@ -302,6 +306,7 @@ class Counter(dict[_KT, int], Generic[_KT]):
302306
def subtract(self, mapping: Mapping[_KT, int], /) -> None: ...
303307
@overload
304308
def subtract(self, iterable: Iterable[_KT], /) -> None: ...
309+
305310
# Unlike dict.update(), use Mapping instead of SupportsKeysAndGetItem for the first overload
306311
# (source code does an `isinstance(other, Mapping)` check)
307312
#
@@ -320,6 +325,7 @@ class Counter(dict[_KT, int], Generic[_KT]):
320325
def update(self, iterable: Iterable[_KT], /) -> None: ...
321326
@overload
322327
def update(self, iterable: None = None, /) -> None: ...
328+
323329
def total(self) -> int: ...
324330
def __missing__(self, key: _KT) -> int: ...
325331
def __delitem__(self, elem: Hashable) -> None: ...
@@ -395,6 +401,7 @@ class OrderedDict(dict[_KT, _VT]):
395401
@classmethod
396402
@overload
397403
def fromkeys(cls, iterable: Iterable[_KT], value: _T) -> OrderedDict[_KT, _T]: ...
404+
398405
# Keep OrderedDict.setdefault in line with MutableMapping.setdefault, modulo positional-only differences.
399406
@overload
400407
def setdefault(self: OrderedDict[_KT, _T | None], key: _KT, default: None = None) -> _T | None: ...
@@ -416,6 +423,7 @@ class OrderedDict(dict[_KT, _VT]):
416423
def __or__(self, value: dict[_KT, _VT] | frozendict[_KT, _VT], /) -> Self: ...
417424
@overload
418425
def __or__(self, value: dict[_KT2, _T] | frozendict[_KT2, _T], /) -> OrderedDict[_KT | _KT2, _VT | _T]: ...
426+
419427
@overload # type: ignore[override]
420428
def __ror__(self, value: dict[_KT, _VT] | frozendict[_KT, _VT], /) -> Self: ... # type: ignore[override,misc]
421429
@overload
@@ -427,6 +435,7 @@ class OrderedDict(dict[_KT, _VT]):
427435
def __or__(self, value: dict[_KT, _VT], /) -> Self: ...
428436
@overload
429437
def __or__(self, value: dict[_KT2, _T], /) -> OrderedDict[_KT | _KT2, _VT | _T]: ...
438+
430439
@overload
431440
def __ror__(self, value: dict[_KT, _VT], /) -> Self: ...
432441
@overload
@@ -480,6 +489,7 @@ class defaultdict(dict[_KT, _VT]):
480489
def __or__(self, value: dict[_KT, _VT], /) -> Self: ...
481490
@overload
482491
def __or__(self, value: dict[_KT2, _T], /) -> defaultdict[_KT | _KT2, _VT | _T]: ...
492+
483493
@overload # type: ignore[override]
484494
def __ror__(self, value: dict[_KT, _VT], /) -> Self: ...
485495
@overload
@@ -541,14 +551,17 @@ class ChainMap(MutableMapping[_KT, _VT]):
541551
@classmethod
542552
@overload
543553
def fromkeys(cls, iterable: Iterable[_KT], value: _T, /) -> ChainMap[_KT, _T]: ...
554+
544555
@overload
545556
def __or__(self, other: Mapping[_KT, _VT]) -> Self: ...
546557
@overload
547558
def __or__(self, other: Mapping[_KT2, _T]) -> ChainMap[_KT | _KT2, _VT | _T]: ...
559+
548560
@overload
549561
def __ror__(self, other: Mapping[_KT, _VT]) -> Self: ...
550562
@overload
551563
def __ror__(self, other: Mapping[_KT2, _T]) -> ChainMap[_KT | _KT2, _VT | _T]: ...
564+
552565
# ChainMap.__ior__ should be kept roughly in line with MutableMapping.update()
553566
@overload # type: ignore[misc]
554567
def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...

0 commit comments

Comments
 (0)