forked from wheerd/multiset
/
multiset.pyi
127 lines (122 loc) · 5.7 KB
/
multiset.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# -*- coding: utf-8 -*-
from typing import (Generic, ItemsView, Iterable, Iterator, KeysView, Mapping, Hashable,
MutableMapping, Optional, Set, Type, TypeVar, Union, ValuesView, overload)
from _typeshed import SupportsKeysAndGetItem
T = TypeVar('T')
TElement = TypeVar('TElement', bound=Hashable)
OtherType = Union[Iterable[TElement], Mapping[TElement, int]]
Self = TypeVar('Self', bound='BaseMultiset')
class BaseMultiset(Mapping[TElement, int], Generic[TElement]):
def __init__(self, iterable: Optional[OtherType]=None) -> None: ...
def __new__(cls, iterable=None): ...
def __contains__(self, element: object) -> bool: ...
def __getitem__(self, element: TElement) -> int: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[TElement]: ...
def isdisjoint(self, other: OtherType) -> bool: ...
def difference(self: Self, *others: OtherType) -> Self: ...
def __bool__(self) -> bool: ...
@overload
def __sub__(self: Self, other: Set[TElement]) -> Self: ...
@overload
def __sub__(self: Self, other: 'BaseMultiset[TElement]') -> Self: ...
def union(self: Self, *others: OtherType) -> Self: ...
@overload
def __or__(self: Self, other: Set[TElement]) -> Self: ...
@overload
def __or__(self: Self, other: 'BaseMultiset[TElement]') -> Self: ...
__ror__ = __or__
def combine(self: Self, *others: OtherType) -> Self: ...
@overload
def __add__(self: Self, other: Set[TElement]) -> Self: ...
@overload
def __add__(self: Self, other: 'BaseMultiset[TElement]') -> Self: ...
__radd__ = __add__
def intersection(self: Self, *others: OtherType) -> Self: ...
@overload
def __and__(self: Self, other: Set[TElement]) -> Self: ...
@overload
def __and__(self: Self, other: 'BaseMultiset[TElement]') -> Self: ...
__rand__ = __and__
def symmetric_difference(self: Self, other: OtherType) -> Self: ...
@overload
def __xor__(self: Self, other: Set[TElement]) -> Self: ...
@overload
def __xor__(self: Self, other: 'BaseMultiset[TElement]') -> Self: ...
__rxor__ = __xor__
def times(self: Self, factor: int) -> Self: ...
def __mul__(self: Self, factor: int) -> Self: ...
__rmul__ = __mul__
def _issubset(self, other: OtherType, strict: bool) -> bool: ...
def issubset(self, other: OtherType) -> bool: ...
@overload
def __le__(self, other: Set[TElement]) -> bool: ...
@overload
def __le__(self, other: 'BaseMultiset[TElement]') -> bool: ...
@overload
def __lt__(self, other: Set[TElement]) -> bool: ...
@overload
def __lt__(self, other: 'BaseMultiset[TElement]') -> bool: ...
def _issuperset(self, other: OtherType, strict: bool) -> bool: ...
def issuperset(self, other: OtherType) -> bool: ...
@overload
def __ge__(self, other: Set[TElement]) -> bool: ...
@overload
def __ge__(self, other: 'BaseMultiset[TElement]') -> bool: ...
@overload
def __gt__(self, other: Set[TElement]) -> bool: ...
@overload
def __gt__(self, other: 'BaseMultiset[TElement]') -> bool: ...
def __eq__(self, other: object): ...
def __ne__(self, other: object): ...
def get(self, element: TElement, default: int) -> int: ... # type: ignore
@classmethod
def from_elements(cls: Type[Self], elements: Iterable[TElement], multiplicity: int) -> Self: ...
def copy(self: Self) -> Self: ...
def __copy__(self: Self) -> Self: ...
def items(self) -> ItemsView[TElement, int]: ...
def distinct_elements(self) -> KeysView[TElement]: ...
def multiplicities(self) -> ValuesView[int]: ...
class Multiset(BaseMultiset[TElement], MutableMapping[TElement, int], Generic[TElement]):
def __setitem__(self, element: TElement, multiplicity: int) -> None: ...
def __delitem__(self, element: TElement) -> None: ...
@overload
def update(self, *others: OtherType) -> None: ...
@overload
def update(self, __m: SupportsKeysAndGetItem[T, int], /, **kwargs: int) -> None: ...
@overload
def update(self, __m: Iterable[tuple[T, int]], /, **kwargs: int) -> None: ...
@overload
def update(self, **kwargs: int) -> None: ...
def union_update(self, *others: OtherType) -> None: ...
@overload
def __ior__(self: Self, other: Set[TElement]) -> Self: ...
@overload
def __ior__(self: Self, other: 'BaseMultiset[TElement]') -> Self: ...
def intersection_update(self, *others: OtherType) -> None: ...
@overload
def __iand__(self: Self, other: Set[TElement]) -> Self: ...
@overload
def __iand__(self: Self, other: 'BaseMultiset[TElement]') -> Self: ...
def difference_update(self, *others: OtherType) -> None: ...
@overload
def __isub__(self: Self, other: Set[TElement]) -> Self: ...
@overload
def __isub__(self: Self, other: 'BaseMultiset[TElement]') -> Self: ...
def symmetric_difference_update(self, other: OtherType) -> None: ...
@overload
def __ixor__(self: Self, other: Set[TElement]) -> Self: ...
@overload
def __ixor__(self: Self, other: 'BaseMultiset[TElement]') -> Self: ...
def times_update(self, factor: int) -> None: ...
def __imul__(self: Self, factor: int) -> Self: ...
def add(self, element: TElement, multiplicity: int=1) -> None: ...
def remove(self, element: TElement, multiplicity: Optional[int]=None) -> int: ...
def discard(self, element: TElement, multiplicity: Optional[int]=None) -> int: ...
def pop(self, element: TElement, default: int) -> int: ... # type: ignore
def setdefault(self, element: TElement, default: int) -> int: ... # type: ignore
def clear(self) -> None: ...
class FrozenMultiset(BaseMultiset[TElement], Generic[TElement]):
def __hash__(self): ...