Skip to main content

collections

Standard library Module View source
class deque
class deque[T]
Fields 1
T type
Constructors 4
__init__
__init__(self: Self, /)
__init__
__init__(self: Self, /, maxlen: int)
__init__
__init__(self: Self, /, it: Generator[T])
__init__
__init__(self: Self, /, other: deque[T])
Properties 2
maxlen
@property
maxlen(self: Self) -> int
left
@property
left(self: Self) -> T
Methods 6
appendleft
appendleft(self: Self, x: T, /)
append
append(self: Self, x: T, /)
popleft
popleft(self: Self, /) -> T
pop
pop(self: Self, /) -> T
clear
clear(self: Self, /)
copy
copy(self: Self, /) -> deque[T]
Special methods 8
__bool__
__bool__(self: Self) -> bool
__len__
__len__(self: Self, /) -> int
__iter__
__iter__(self: Self, /) -> Generator[T]
__contains__
__contains__(self: Self, x: T, /) -> bool
__deepcopy__
__deepcopy__(self: Self) -> deque[T]
__copy__
__copy__(self: Self, /) -> deque[T]
__repr__
__repr__(self: Self, /) -> str
__getitem__
__getitem__(self: Self, idx: int, /) -> T
class Counter
@tuple
class Counter[T]
Fields 1
T type
Constructors 4
__new__
__new__(capacity: int = 8) -> Counter[T]
__new__
__new__(elements: Generator[T], /) -> Counter[T]
__new__
__new__(other: Counter[T], /) -> Counter[T]
__new__
__new__(other: Dict[(T, int)], /) -> Counter[T]
Methods 17
keys
keys(self: Self, /)
values
values(self: Self, /)
items
items(self: Self, /)
get
get(self: Self, key: T, /)
get(self: Self, key: T, default: int, /)
setdefault
setdefault(self: Self, key: T, value: int, /)
pop
pop(self: Self, key: T, /)
pop(self: Self, key: T, missing, /)
popitem
popitem(self: Self, /)
clear
clear(self: Self, /)
resize
resize(self: Self, minused: int)
increment
increment[Z: type](self: Self, key: T, by: Z = 1)
copy
copy(self: Self)
fromkeys
fromkeys[K: type, V: type](ks: Generator[K], v: V)
elements
elements(self: Self) -> Generator[T]
most_common
most_common(self: Self, n: Optional[int] = None) -> List[Tuple[(T, int)]]
subtract
subtract(self: Self, elements: Generator[T], /)
subtract(self: Self, other: Counter[T], /)
subtract(self: Self, other: Dict[(T, int)], /)
update
update(self: Self, elements: Generator[T], /)
update(self: Self, other: Counter[T], /)
update(self: Self, other: Dict[(T, int)], /)
update(self: Self, /)
total
total(self: Self) -> int
Special methods 25
__len__
__len__(self: Self, /)
__bool__
__bool__(self: Self)
__iter__
__iter__(self: Self, /)
__reversed__
__reversed__(self: Self, /)
__contains__
__contains__(self: Self, key: T, /)
__setitem__
__setitem__(self: Self, key: T, value: int, /)
__deepcopy__
__deepcopy__(self: Self)
__getitem__
__getitem__(self: Self, key: T, /) -> int
__delitem__
__delitem__(self: Self, key: T)
__eq__
__eq__(self: Self, other: Counter[T]) -> bool
__eq__(self: Self, other: Dict[(T, int)]) -> bool
__ne__
__ne__(self: Self, other: Counter[T]) -> bool
__ne__(self: Self, other: Dict[(T, int)]) -> bool
__copy__
__copy__(self: Self) -> Counter[T]
__or__
__or__(self: Self, other)
__or__(self: Self, other: Counter[T]) -> Counter[T]
__ior__
__ior__(self: Self, other)
__ior__(self: Self, other: Counter[T]) -> Counter[T]
__iadd__
__iadd__(self: Self, other: Counter[T]) -> Counter[T]
__isub__
__isub__(self: Self, other: Counter[T]) -> Counter[T]
__iand__
__iand__(self: Self, other: Counter[T]) -> Counter[T]
__pos__
__pos__(self: Self) -> Counter[T]
__neg__
__neg__(self: Self) -> Counter[T]
__add__
__add__(self: Self, other: Counter[T]) -> Counter[T]
__sub__
__sub__(self: Self, other: Counter[T]) -> Counter[T]
__and__
__and__(self: Self, other: Counter[T]) -> Counter[T]
__repr__
__repr__(self: Self)
__dict_do_op__
__dict_do_op__[F: type, Z: type](self: Self, key: T, other: Z, default: int, op: F)
__dict_do_op_throws__
__dict_do_op_throws__[F: type, Z: type](self: Self, key: T, other: Z, op: F)
class OrderedDict
@extend
class OrderedDict[K, V]
Constructors 1
__init__
__init__(self: Dict[(K, int)], other: Counter[K])
Methods 1
update
update(self: Dict[(K, int)], other: Counter[K])
Special methods 2
__eq__
__eq__(self: Dict[(K, int)], other: Counter[K])
__ne__
__ne__(self: Dict[(K, int)], other: Counter[K])
class defaultdict
@tuple
class defaultdict[K, V, S]
Fields 4
default_factory S
K type
V type
S TypeTrait[CallableTrait[([], V)]]
Constructors 8
__new__
__new__[VV: TypeTrait[V]]() -> defaultdict[(K, VV, Function[([], V)])]
__new__
__new__(f: S, /) -> defaultdict[(K, V, S)]
__new__
__new__[VV: TypeTrait[V]](other: Dict[(K, V)], /) -> defaultdict[(K, VV, Function[([], V)])]
__new__
__new__(f: S, other: Dict[(K, V)], /) -> defaultdict[(K, V, S)]
__new__
__new__[VV: TypeTrait[V], F: type](other: defaultdict[(K, V, F)], /) -> defaultdict[(K, VV, Function[([], V)])]
__new__
__new__[F: type](f: S, other: defaultdict[(K, V, F)], /) -> defaultdict[(K, V, S)]
__new__
__new__[VV: TypeTrait[V]](other: Counter[K], /) -> defaultdict[(K, VV, Function[([], V)])]
__new__
__new__(f: S, other: Counter[K], /) -> defaultdict[(K, V, S)]
Methods 13
keys
keys(self: Self, /)
values
values(self: Self, /)
items
items(self: Self, /)
get
get(self: Self, key: K, /)
get(self: Self, key: K, default: V, /)
setdefault
setdefault(self: Self, key: K, value: V, /)
pop
pop(self: Self, key: K, /)
pop(self: Self, key: K, missing, /)
popitem
popitem(self: Self, /)
clear
clear(self: Self, /)
resize
resize(self: Self, minused: int)
increment
increment[Z: type](self: Self, key: K, by: Z = 1)
update
update(self: Self, other, /)
fromkeys
fromkeys[K: type, V: type](ks: Generator[K], v: V, /)
copy
copy(self: Self, /)
Special methods 18
__len__
__len__(self: Self, /)
__bool__
__bool__(self: Self)
__iter__
__iter__(self: Self, /)
__reversed__
__reversed__(self: Self, /)
__contains__
__contains__(self: Self, key: K, /)
__setitem__
__setitem__(self: Self, key: K, value: V, /)
__delitem__
__delitem__(self: Self, key: K, /)
__or__
__or__(self: Self, other, /)
__ior__
__ior__(self: Self, other, /)
__missing__
__missing__(self: Self, key: K, /)
__getitem__
__getitem__(self: Self, key: K, /) -> V
__dict_do_op_throws__
__dict_do_op_throws__[F: type, Z: type](self: Self, key: K, other: Z, op: F)
__dict_do_op__
__dict_do_op__[F: type, Z: type](self: Self, key: K, other: Z, default: V, op: F)
__copy__
__copy__(self: Self, /)
__deepcopy__
__deepcopy__(self: Self)
__eq__
__eq__[F: type](self: Self, other: defaultdict[(K, V, F)], /) -> bool
__eq__(self: Self, other: Dict[(K, V)], /) -> bool
__eq__(self: Self, other: Counter[K], /) -> bool
__ne__
__ne__[F: type](self: Self, other: defaultdict[(K, V, F)], /) -> bool
__ne__(self: Self, other: Dict[(K, V)], /) -> bool
__ne__(self: Self, other: Counter[K], /) -> bool
__repr__
__repr__(self: Self, /)
class OrderedDict
@extend
class OrderedDict[K, V]
Constructors 1
__init__
__init__[S: type](self: Dict[(K, V)], other: defaultdict[(K, V, S)])
Methods 1
update
update[S: type](self: Dict[(K, V)], other: defaultdict[(K, V, S)])
Special methods 2
__eq__
__eq__[S: type](self: Dict[(K, V)], other: defaultdict[(K, V, S)])
__ne__
__ne__[S: type](self: Dict[(K, V)], other: defaultdict[(K, V, S)])
class Counter
@extend
class Counter[T]
Constructors 1
__new__
__new__[S: type](other: defaultdict[(T, int, S)], /) -> Counter[T]
Methods 2
update
update[S: type](self: Self, other: defaultdict[(T, int, S)], /)
subtract
subtract[S: type](self: Self, other: defaultdict[(T, int, S)], /)
Special methods 2
__eq__
__eq__[S: type](self: Self, other: defaultdict[(T, int, S)])
__ne__
__ne__[S: type](self: Self, other: defaultdict[(T, int, S)])
function namedtuple
@__generated__
namedtuple[name: Literal[str]](args)