collections

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