{
    "mode": "pydoc",
    "parameter": "collections",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/collections/json",
    "generated": "2026-06-02T13:21:56Z",
    "sections": {
        "NAME": {
            "content": "collections\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/collections.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module implements specialized container datatypes providing\nalternatives to Python's general purpose built-in containers, dict,\nlist, set, and tuple.\n\n* namedtuple   factory function for creating tuple subclasses with named fields\n* deque        list-like container with fast appends and pops on either end\n* ChainMap     dict-like class for creating a single view of multiple mappings\n* Counter      dict subclass for counting hashable objects\n* OrderedDict  dict subclass that remembers the order entries were added\n* defaultdict  dict subclass that calls a factory function to supply missing values\n* UserDict     wrapper around dictionary objects for easier dict subclassing\n* UserList     wrapper around list objects for easier list subclassing\n* UserString   wrapper around string objects for easier string subclassing\n",
            "subsections": []
        },
        "PACKAGE CONTENTS": {
            "content": "abc\n",
            "subsections": []
        },
        "SUBMODULES": {
            "content": "collectionsabc\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.dict(builtins.object)\nCounter\nOrderedDict\ndefaultdict\nbuiltins.object\ndeque\ncollections.abc.MutableMapping(collections.abc.Mapping)\nChainMap\nUserDict\ncollections.abc.MutableSequence(collections.abc.Sequence)\nUserList\ncollections.abc.Sequence(collections.abc.Reversible, collections.abc.Collection)\nUserString\n",
            "subsections": [
                {
                    "name": "class ChainMap",
                    "content": "|  ChainMap(*maps)\n|\n|  A ChainMap groups multiple dicts (or other mappings) together\n|  to create a single, updateable view.\n|\n|  The underlying mappings are stored in a list.  That list is public and can\n|  be accessed or updated using the *maps* attribute.  There is no other\n|  state.\n|\n|  Lookups search the underlying mappings successively until a key is found.\n|  In contrast, writes, updates, and deletions only operate on the first\n|  mapping.\n|\n|  Method resolution order:\n|      ChainMap\n|      collections.abc.MutableMapping\n|      collections.abc.Mapping\n|      collections.abc.Collection\n|      collections.abc.Sized\n|      collections.abc.Iterable\n|      collections.abc.Container\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  bool(self)\n|\n|  contains(self, key)\n|\n|  copy = copy(self)\n|\n|  delitem(self, key)\n|\n|  getitem(self, key)\n|\n|  init(self, *maps)\n|      Initialize a ChainMap by setting *maps* to the given mappings.\n|      If no mappings are provided, a single empty dictionary is used.\n|\n|  ior(self, other)\n|\n|  iter(self)\n|\n|  len(self)\n|\n|  missing(self, key)\n|\n|  or(self, other)\n|      Return self|value.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  ror(self, other)\n|      Return value|self.\n|\n|  setitem(self, key, value)\n|\n|  clear(self)\n|      Clear maps[0], leaving maps[1:] intact.\n|\n|  copy(self)\n|      New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]\n|\n|  get(self, key, default=None)\n|      D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.\n|\n|  newchild(self, m=None, kwargs)\n|      New ChainMap with a new map followed by all previous maps.\n|      If no map is provided, an empty dict is used.\n|      Keyword arguments update the map or new empty dict.\n|\n|  pop(self, key, *args)\n|      Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].\n|\n|  popitem(self)\n|      Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  fromkeys(iterable, *args) from abc.ABCMeta\n|      Create a ChainMap with a single dict created from the iterable.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  parents\n|      New ChainMap from maps[1:].\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  abstractmethods = frozenset()\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from collections.abc.MutableMapping:\n|\n|  setdefault(self, key, default=None)\n|      D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D\n|\n|  update(self, other=(), /, kwds)\n|      D.update([E, ]F) -> None.  Update D from mapping/iterable E and F.\n|      If E present and has a .keys() method, does:     for k in E: D[k] = E[k]\n|      If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v\n|      In either case, this is followed by: for k, v in F.items(): D[k] = v\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from collections.abc.Mapping:\n|\n|  eq(self, other)\n|      Return self==value.\n|\n|  items(self)\n|      D.items() -> a set-like object providing a view on D's items\n|\n|  keys(self)\n|      D.keys() -> a set-like object providing a view on D's keys\n|\n|  values(self)\n|      D.values() -> an object providing a view on D's values\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes inherited from collections.abc.Mapping:\n|\n|  hash = None\n|\n|  reversed = None\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.abc.Collection:\n|\n|  subclasshook(C) from abc.ABCMeta\n|      Abstract classes can override this to customize issubclass().\n|\n|      This is invoked early on by abc.ABCMeta.subclasscheck().\n|      It should return True, False or NotImplemented.  If it returns\n|      NotImplemented, the normal algorithm is used.  Otherwise, it\n|      overrides the normal algorithm (and the outcome is cached).\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.abc.Iterable:\n|\n|  classgetitem = GenericAlias(...) from abc.ABCMeta\n|      Represent a PEP 585 generic type\n|\n|      E.g. for t = list[int], t.origin is list and t.args is (int,).\n"
                },
                {
                    "name": "class Counter",
                    "content": "|  Counter(iterable=None, /, kwds)\n|\n|  Dict subclass for counting hashable items.  Sometimes called a bag\n|  or multiset.  Elements are stored as dictionary keys and their counts\n|  are stored as dictionary values.\n|\n|  >>> c = Counter('abcdeabcdabcaba')  # count elements from a string\n|\n|  >>> c.mostcommon(3)                # three most common elements\n|  [('a', 5), ('b', 4), ('c', 3)]\n|  >>> sorted(c)                       # list all unique elements\n|  ['a', 'b', 'c', 'd', 'e']\n|  >>> ''.join(sorted(c.elements()))   # list elements with repetitions\n|  'aaaaabbbbcccdde'\n|  >>> sum(c.values())                 # total of all counts\n|  15\n|\n|  >>> c['a']                          # count of letter 'a'\n|  5\n|  >>> for elem in 'shazam':           # update counts from an iterable\n|  ...     c[elem] += 1                # by adding 1 to each element's count\n|  >>> c['a']                          # now there are seven 'a'\n|  7\n|  >>> del c['b']                      # remove all 'b'\n|  >>> c['b']                          # now there are zero 'b'\n|  0\n|\n|  >>> d = Counter('simsalabim')       # make another counter\n|  >>> c.update(d)                     # add in the second counter\n|  >>> c['a']                          # now there are nine 'a'\n|  9\n|\n|  >>> c.clear()                       # empty the counter\n|  >>> c\n|  Counter()\n|\n|  Note:  If a count is set to zero or reduced to zero, it will remain\n|  in the counter until the entry is deleted or the counter is cleared:\n|\n|  >>> c = Counter('aaabbc')\n|  >>> c['b'] -= 2                     # reduce the count of 'b' by two\n|  >>> c.mostcommon()                 # 'b' is still in, but its count is zero\n|  [('a', 3), ('c', 1), ('b', 0)]\n|\n|  Method resolution order:\n|      Counter\n|      builtins.dict\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  add(self, other)\n|      Add counts from two counters.\n|\n|      >>> Counter('abbb') + Counter('bcc')\n|      Counter({'b': 4, 'c': 2, 'a': 1})\n|\n|  and(self, other)\n|      Intersection is the minimum of corresponding counts.\n|\n|      >>> Counter('abbb') & Counter('bcc')\n|      Counter({'b': 1})\n|\n|  delitem(self, elem)\n|      Like dict.delitem() but does not raise KeyError for missing values.\n|\n|  eq(self, other)\n|      True if all counts agree. Missing counts are treated as zero.\n|\n|  ge(self, other)\n|      True if all counts in self are a superset of those in other.\n|\n|  gt(self, other)\n|      True if all counts in self are a proper superset of those in other.\n|\n|  iadd(self, other)\n|      Inplace add from another counter, keeping only positive counts.\n|\n|      >>> c = Counter('abbb')\n|      >>> c += Counter('bcc')\n|      >>> c\n|      Counter({'b': 4, 'c': 2, 'a': 1})\n|\n|  iand(self, other)\n|      Inplace intersection is the minimum of corresponding counts.\n|\n|      >>> c = Counter('abbb')\n|      >>> c &= Counter('bcc')\n|      >>> c\n|      Counter({'b': 1})\n|\n|  init(self, iterable=None, /, kwds)\n|      Create a new, empty Counter object.  And if given, count elements\n|      from an input iterable.  Or, initialize the count from another mapping\n|      of elements to their counts.\n|\n|      >>> c = Counter()                           # a new, empty counter\n|      >>> c = Counter('gallahad')                 # a new counter from an iterable\n|      >>> c = Counter({'a': 4, 'b': 2})           # a new counter from a mapping\n|      >>> c = Counter(a=4, b=2)                   # a new counter from keyword args\n|\n|  ior(self, other)\n|      Inplace union is the maximum of value from either counter.\n|\n|      >>> c = Counter('abbb')\n|      >>> c |= Counter('bcc')\n|      >>> c\n|      Counter({'b': 3, 'c': 2, 'a': 1})\n|\n|  isub(self, other)\n|      Inplace subtract counter, but keep only results with positive counts.\n|\n|      >>> c = Counter('abbbc')\n|      >>> c -= Counter('bccd')\n|      >>> c\n|      Counter({'b': 2, 'a': 1})\n|\n|  le(self, other)\n|      True if all counts in self are a subset of those in other.\n|\n|  lt(self, other)\n|      True if all counts in self are a proper subset of those in other.\n|\n|  missing(self, key)\n|      The count of elements not in the Counter is zero.\n|\n|  ne(self, other)\n|      True if any counts disagree. Missing counts are treated as zero.\n|\n|  neg(self)\n|      Subtracts from an empty counter.  Strips positive and zero counts,\n|      and flips the sign on negative counts.\n|\n|  or(self, other)\n|      Union is the maximum of value in either of the input counters.\n|\n|      >>> Counter('abbb') | Counter('bcc')\n|      Counter({'b': 3, 'c': 2, 'a': 1})\n|\n|  pos(self)\n|      Adds an empty counter, effectively stripping negative and zero counts\n|\n|  reduce(self)\n|      Helper for pickle.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  sub(self, other)\n|      Subtract count, but keep only results with positive counts.\n|\n|      >>> Counter('abbbc') - Counter('bccd')\n|      Counter({'b': 2, 'a': 1})\n|\n|  copy(self)\n|      Return a shallow copy.\n|\n|  elements(self)\n|      Iterator over elements repeating each as many times as its count.\n|\n|      >>> c = Counter('ABCABC')\n|      >>> sorted(c.elements())\n|      ['A', 'A', 'B', 'B', 'C', 'C']\n|\n|      # Knuth's example for prime factors of 1836:  22 * 33 * 171\n|      >>> primefactors = Counter({2: 2, 3: 3, 17: 1})\n|      >>> product = 1\n|      >>> for factor in primefactors.elements():     # loop over factors\n|      ...     product *= factor                       # and multiply them\n|      >>> product\n|      1836\n|\n|      Note, if an element's count has been set to zero or is a negative\n|      number, elements() will ignore it.\n|\n|  mostcommon(self, n=None)\n|      List the n most common elements and their counts from the most\n|      common to the least.  If n is None, then list all element counts.\n|\n|      >>> Counter('abracadabra').mostcommon(3)\n|      [('a', 5), ('b', 2), ('r', 2)]\n|\n|  subtract(self, iterable=None, /, kwds)\n|      Like dict.update() but subtracts counts instead of replacing them.\n|      Counts can be reduced below zero.  Both the inputs and outputs are\n|      allowed to contain zero and negative counts.\n|\n|      Source can be an iterable, a dictionary, or another Counter instance.\n|\n|      >>> c = Counter('which')\n|      >>> c.subtract('witch')             # subtract elements from another iterable\n|      >>> c.subtract(Counter('watch'))    # subtract elements from another counter\n|      >>> c['h']                          # 2 in which, minus 1 in witch, minus 1 in watch\n|      0\n|      >>> c['w']                          # 1 in which, minus 1 in witch, minus 1 in watch\n|      -1\n|\n|  total(self)\n|      Sum of the counts\n|\n|  update(self, iterable=None, /, kwds)\n|      Like dict.update() but add counts instead of replacing them.\n|\n|      Source can be an iterable, a dictionary, or another Counter instance.\n|\n|      >>> c = Counter('which')\n|      >>> c.update('witch')           # add elements from another iterable\n|      >>> d = Counter('watch')\n|      >>> c.update(d)                 # add elements from another counter\n|      >>> c['h']                      # four 'h' in which, witch, and watch\n|      4\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  fromkeys(iterable, v=None) from builtins.type\n|      Create a new dictionary with keys from iterable and values set to value.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  hash = None\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.dict:\n|\n|  contains(self, key, /)\n|      True if the dictionary has the specified key, else False.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  getitem(...)\n|      x.getitem(y) <==> x[y]\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  len(self, /)\n|      Return len(self).\n|\n|  reversed(self, /)\n|      Return a reverse iterator over the dict keys.\n|\n|  ror(self, value, /)\n|      Return value|self.\n|\n|  setitem(self, key, value, /)\n|      Set self[key] to value.\n|\n|  sizeof(...)\n|      D.sizeof() -> size of D in memory, in bytes\n|\n|  clear(...)\n|      D.clear() -> None.  Remove all items from D.\n|\n|  get(self, key, default=None, /)\n|      Return the value for key if key is in the dictionary, else default.\n|\n|  items(...)\n|      D.items() -> a set-like object providing a view on D's items\n|\n|  keys(...)\n|      D.keys() -> a set-like object providing a view on D's keys\n|\n|  pop(...)\n|      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n|\n|      If the key is not found, return the default if given; otherwise,\n|      raise a KeyError.\n|\n|  popitem(self, /)\n|      Remove and return a (key, value) pair as a 2-tuple.\n|\n|      Pairs are returned in LIFO (last-in, first-out) order.\n|      Raises KeyError if the dict is empty.\n|\n|  setdefault(self, key, default=None, /)\n|      Insert key with a value of default if key is not in the dictionary.\n|\n|      Return the value for key if key is in the dictionary, else default.\n|\n|  values(...)\n|      D.values() -> an object providing a view on D's values\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from builtins.dict:\n|\n|  classgetitem(...) from builtins.type\n|      See PEP 585\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.dict:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n"
                },
                {
                    "name": "class OrderedDict",
                    "content": "|  Dictionary that remembers insertion order\n|\n|  Method resolution order:\n|      OrderedDict\n|      builtins.dict\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  delitem(self, key, /)\n|      Delete self[key].\n|\n|  eq(self, value, /)\n|      Return self==value.\n|\n|  ge(self, value, /)\n|      Return self>=value.\n|\n|  gt(self, value, /)\n|      Return self>value.\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ior(self, value, /)\n|      Return self|=value.\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  le(self, value, /)\n|      Return self<=value.\n|\n|  lt(self, value, /)\n|      Return self<value.\n|\n|  ne(self, value, /)\n|      Return self!=value.\n|\n|  or(self, value, /)\n|      Return self|value.\n|\n|  reduce(...)\n|      Return state information for pickling\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  reversed(...)\n|      od.reversed() <==> reversed(od)\n|\n|  ror(self, value, /)\n|      Return value|self.\n|\n|  setitem(self, key, value, /)\n|      Set self[key] to value.\n|\n|  sizeof(...)\n|      D.sizeof() -> size of D in memory, in bytes\n|\n|  clear(...)\n|      od.clear() -> None.  Remove all items from od.\n|\n|  copy(...)\n|      od.copy() -> a shallow copy of od\n|\n|  items(...)\n|      D.items() -> a set-like object providing a view on D's items\n|\n|  keys(...)\n|      D.keys() -> a set-like object providing a view on D's keys\n|\n|  movetoend(self, /, key, last=True)\n|      Move an existing element to the end (or beginning if last is false).\n|\n|      Raise KeyError if the element does not exist.\n|\n|  pop(...)\n|      od.pop(key[,default]) -> v, remove specified key and return the corresponding value.\n|\n|      If the key is not found, return the default if given; otherwise,\n|      raise a KeyError.\n|\n|  popitem(self, /, last=True)\n|      Remove and return a (key, value) pair from the dictionary.\n|\n|      Pairs are returned in LIFO order if last is true or FIFO order if false.\n|\n|  setdefault(self, /, key, default=None)\n|      Insert key with a value of default if key is not in the dictionary.\n|\n|      Return the value for key if key is in the dictionary, else default.\n|\n|  update(...)\n|      D.update([E, ]F) -> None.  Update D from dict/iterable E and F.\n|      If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]\n|      If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v\n|      In either case, this is followed by: for k in F:  D[k] = F[k]\n|\n|  values(...)\n|      D.values() -> an object providing a view on D's values\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  fromkeys(iterable, value=None) from builtins.type\n|      Create a new ordered dictionary with keys from iterable and values set to value.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  hash = None\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.dict:\n|\n|  contains(self, key, /)\n|      True if the dictionary has the specified key, else False.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  getitem(...)\n|      x.getitem(y) <==> x[y]\n|\n|  len(self, /)\n|      Return len(self).\n|\n|  get(self, key, default=None, /)\n|      Return the value for key if key is in the dictionary, else default.\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from builtins.dict:\n|\n|  classgetitem(...) from builtins.type\n|      See PEP 585\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.dict:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n"
                },
                {
                    "name": "class UserDict",
                    "content": "|  UserDict(dict=None, /, kwargs)\n|\n|  Method resolution order:\n|      UserDict\n|      collections.abc.MutableMapping\n|      collections.abc.Mapping\n|      collections.abc.Collection\n|      collections.abc.Sized\n|      collections.abc.Iterable\n|      collections.abc.Container\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  contains(self, key)\n|      # Modify contains to work correctly when missing is present\n|\n|  copy(self)\n|\n|  delitem(self, key)\n|\n|  getitem(self, key)\n|\n|  init(self, dict=None, /, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ior(self, other)\n|\n|  iter(self)\n|\n|  len(self)\n|\n|  or(self, other)\n|      Return self|value.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  ror(self, other)\n|      Return value|self.\n|\n|  setitem(self, key, item)\n|\n|  copy(self)\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  fromkeys(iterable, value=None) from abc.ABCMeta\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  abstractmethods = frozenset()\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from collections.abc.MutableMapping:\n|\n|  clear(self)\n|      D.clear() -> None.  Remove all items from D.\n|\n|  pop(self, key, default=<object object at 0x7f3f88a54190>)\n|      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n|      If key is not found, d is returned if given, otherwise KeyError is raised.\n|\n|  popitem(self)\n|      D.popitem() -> (k, v), remove and return some (key, value) pair\n|      as a 2-tuple; but raise KeyError if D is empty.\n|\n|  setdefault(self, key, default=None)\n|      D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D\n|\n|  update(self, other=(), /, kwds)\n|      D.update([E, ]F) -> None.  Update D from mapping/iterable E and F.\n|      If E present and has a .keys() method, does:     for k in E: D[k] = E[k]\n|      If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v\n|      In either case, this is followed by: for k, v in F.items(): D[k] = v\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from collections.abc.Mapping:\n|\n|  eq(self, other)\n|      Return self==value.\n|\n|  get(self, key, default=None)\n|      D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.\n|\n|  items(self)\n|      D.items() -> a set-like object providing a view on D's items\n|\n|  keys(self)\n|      D.keys() -> a set-like object providing a view on D's keys\n|\n|  values(self)\n|      D.values() -> an object providing a view on D's values\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes inherited from collections.abc.Mapping:\n|\n|  hash = None\n|\n|  reversed = None\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.abc.Collection:\n|\n|  subclasshook(C) from abc.ABCMeta\n|      Abstract classes can override this to customize issubclass().\n|\n|      This is invoked early on by abc.ABCMeta.subclasscheck().\n|      It should return True, False or NotImplemented.  If it returns\n|      NotImplemented, the normal algorithm is used.  Otherwise, it\n|      overrides the normal algorithm (and the outcome is cached).\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.abc.Iterable:\n|\n|  classgetitem = GenericAlias(...) from abc.ABCMeta\n|      Represent a PEP 585 generic type\n|\n|      E.g. for t = list[int], t.origin is list and t.args is (int,).\n"
                },
                {
                    "name": "class UserList",
                    "content": "|  UserList(initlist=None)\n|\n|  A more or less complete user-defined wrapper around list objects.\n|\n|  Method resolution order:\n|      UserList\n|      collections.abc.MutableSequence\n|      collections.abc.Sequence\n|      collections.abc.Reversible\n|      collections.abc.Collection\n|      collections.abc.Sized\n|      collections.abc.Iterable\n|      collections.abc.Container\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  add(self, other)\n|\n|  contains(self, item)\n|\n|  copy(self)\n|\n|  delitem(self, i)\n|\n|  eq(self, other)\n|      Return self==value.\n|\n|  ge(self, other)\n|      Return self>=value.\n|\n|  getitem(self, i)\n|\n|  gt(self, other)\n|      Return self>value.\n|\n|  iadd(self, other)\n|\n|  imul(self, n)\n|\n|  init(self, initlist=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  le(self, other)\n|      Return self<=value.\n|\n|  len(self)\n|\n|  lt(self, other)\n|      Return self<value.\n|\n|  mul(self, n)\n|\n|  radd(self, other)\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  rmul = mul(self, n)\n|\n|  setitem(self, i, item)\n|\n|  append(self, item)\n|      S.append(value) -- append value to the end of the sequence\n|\n|  clear(self)\n|      S.clear() -> None -- remove all items from S\n|\n|  copy(self)\n|\n|  count(self, item)\n|      S.count(value) -> integer -- return number of occurrences of value\n|\n|  extend(self, other)\n|      S.extend(iterable) -- extend sequence by appending elements from the iterable\n|\n|  index(self, item, *args)\n|      S.index(value, [start, [stop]]) -> integer -- return first index of value.\n|      Raises ValueError if the value is not present.\n|\n|      Supporting start and stop arguments is optional, but\n|      recommended.\n|\n|  insert(self, i, item)\n|      S.insert(index, value) -- insert value before index\n|\n|  pop(self, i=-1)\n|      S.pop([index]) -> item -- remove and return item at index (default last).\n|      Raise IndexError if list is empty or index is out of range.\n|\n|  remove(self, item)\n|      S.remove(value) -- remove first occurrence of value.\n|      Raise ValueError if the value is not present.\n|\n|  reverse(self)\n|      S.reverse() -- reverse *IN PLACE*\n|\n|  sort(self, /, *args, kwds)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  abstractmethods = frozenset()\n|\n|  hash = None\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from collections.abc.Sequence:\n|\n|  iter(self)\n|\n|  reversed(self)\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.abc.Reversible:\n|\n|  subclasshook(C) from abc.ABCMeta\n|      Abstract classes can override this to customize issubclass().\n|\n|      This is invoked early on by abc.ABCMeta.subclasscheck().\n|      It should return True, False or NotImplemented.  If it returns\n|      NotImplemented, the normal algorithm is used.  Otherwise, it\n|      overrides the normal algorithm (and the outcome is cached).\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.abc.Iterable:\n|\n|  classgetitem = GenericAlias(...) from abc.ABCMeta\n|      Represent a PEP 585 generic type\n|\n|      E.g. for t = list[int], t.origin is list and t.args is (int,).\n"
                },
                {
                    "name": "class UserString",
                    "content": "|  UserString(seq)\n|\n|  Method resolution order:\n|      UserString\n|      collections.abc.Sequence\n|      collections.abc.Reversible\n|      collections.abc.Collection\n|      collections.abc.Sized\n|      collections.abc.Iterable\n|      collections.abc.Container\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  add(self, other)\n|\n|  complex(self)\n|\n|  contains(self, char)\n|\n|  eq(self, string)\n|      Return self==value.\n|\n|  float(self)\n|\n|  ge(self, string)\n|      Return self>=value.\n|\n|  getitem(self, index)\n|\n|  getnewargs(self)\n|\n|  gt(self, string)\n|      Return self>value.\n|\n|  hash(self)\n|      Return hash(self).\n|\n|  init(self, seq)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  int(self)\n|\n|  le(self, string)\n|      Return self<=value.\n|\n|  len(self)\n|\n|  lt(self, string)\n|      Return self<value.\n|\n|  mod(self, args)\n|\n|  mul(self, n)\n|\n|  radd(self, other)\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  rmod(self, template)\n|\n|  rmul = mul(self, n)\n|\n|  str(self)\n|      Return str(self).\n|\n|  capitalize(self)\n|      # the following methods are defined in alphabetical order:\n|\n|  casefold(self)\n|\n|  center(self, width, *args)\n|\n|  count(self, sub, start=0, end=9223372036854775807)\n|      S.count(value) -> integer -- return number of occurrences of value\n|\n|  encode(self, encoding='utf-8', errors='strict')\n|\n|  endswith(self, suffix, start=0, end=9223372036854775807)\n|\n|  expandtabs(self, tabsize=8)\n|\n|  find(self, sub, start=0, end=9223372036854775807)\n|\n|  format(self, /, *args, kwds)\n|\n|  formatmap(self, mapping)\n|\n|  index(self, sub, start=0, end=9223372036854775807)\n|      S.index(value, [start, [stop]]) -> integer -- return first index of value.\n|      Raises ValueError if the value is not present.\n|\n|      Supporting start and stop arguments is optional, but\n|      recommended.\n|\n|  isalnum(self)\n|\n|  isalpha(self)\n|\n|  isascii(self)\n|\n|  isdecimal(self)\n|\n|  isdigit(self)\n|\n|  isidentifier(self)\n|\n|  islower(self)\n|\n|  isnumeric(self)\n|\n|  isprintable(self)\n|\n|  isspace(self)\n|\n|  istitle(self)\n|\n|  isupper(self)\n|\n|  join(self, seq)\n|\n|  ljust(self, width, *args)\n|\n|  lower(self)\n|\n|  lstrip(self, chars=None)\n|\n|  partition(self, sep)\n|\n|  removeprefix(self, prefix, /)\n|\n|  removesuffix(self, suffix, /)\n|\n|  replace(self, old, new, maxsplit=-1)\n|\n|  rfind(self, sub, start=0, end=9223372036854775807)\n|\n|  rindex(self, sub, start=0, end=9223372036854775807)\n|\n|  rjust(self, width, *args)\n|\n|  rpartition(self, sep)\n|\n|  rsplit(self, sep=None, maxsplit=-1)\n|\n|  rstrip(self, chars=None)\n|\n|  split(self, sep=None, maxsplit=-1)\n|\n|  splitlines(self, keepends=False)\n|\n|  startswith(self, prefix, start=0, end=9223372036854775807)\n|\n|  strip(self, chars=None)\n|\n|  swapcase(self)\n|\n|  title(self)\n|\n|  translate(self, *args)\n|\n|  upper(self)\n|\n|  zfill(self, width)\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  maketrans(...)\n|      Return a translation table usable for str.translate().\n|\n|      If there is only one argument, it must be a dictionary mapping Unicode\n|      ordinals (integers) or characters to Unicode ordinals, strings or None.\n|      Character keys will be then converted to ordinals.\n|      If there are two arguments, they must be strings of equal length, and\n|      in the resulting dictionary, each character in x will be mapped to the\n|      character at the same position in y. If there is a third argument, it\n|      must be a string, whose characters will be mapped to None in the result.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  abstractmethods = frozenset()\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from collections.abc.Sequence:\n|\n|  iter(self)\n|\n|  reversed(self)\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.abc.Reversible:\n|\n|  subclasshook(C) from abc.ABCMeta\n|      Abstract classes can override this to customize issubclass().\n|\n|      This is invoked early on by abc.ABCMeta.subclasscheck().\n|      It should return True, False or NotImplemented.  If it returns\n|      NotImplemented, the normal algorithm is used.  Otherwise, it\n|      overrides the normal algorithm (and the outcome is cached).\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.abc.Iterable:\n|\n|  classgetitem = GenericAlias(...) from abc.ABCMeta\n|      Represent a PEP 585 generic type\n|\n|      E.g. for t = list[int], t.origin is list and t.args is (int,).\n"
                },
                {
                    "name": "class defaultdict",
                    "content": "|  defaultdict(defaultfactory=None, /, [...]) --> dict with default factory\n|\n|  The default factory is called without arguments to produce\n|  a new value when a key is not present, in getitem only.\n|  A defaultdict compares equal to a dict with the same items.\n|  All remaining arguments are treated the same as if they were\n|  passed to the dict constructor, including keyword arguments.\n|\n|  Method resolution order:\n|      defaultdict\n|      builtins.dict\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  copy(...)\n|      D.copy() -> a shallow copy of D.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  missing(...)\n|      missing(key) # Called by getitem for missing key; pseudo-code:\n|      if self.defaultfactory is None: raise KeyError((key,))\n|      self[key] = value = self.defaultfactory()\n|      return value\n|\n|  or(self, value, /)\n|      Return self|value.\n|\n|  reduce(...)\n|      Return state information for pickling.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  ror(self, value, /)\n|      Return value|self.\n|\n|  copy(...)\n|      D.copy() -> a shallow copy of D.\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  classgetitem(...) from builtins.type\n|      See PEP 585\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  defaultfactory\n|      Factory for default value called by missing().\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.dict:\n|\n|  contains(self, key, /)\n|      True if the dictionary has the specified key, else False.\n|\n|  delitem(self, key, /)\n|      Delete self[key].\n|\n|  eq(self, value, /)\n|      Return self==value.\n|\n|  ge(self, value, /)\n|      Return self>=value.\n|\n|  getitem(...)\n|      x.getitem(y) <==> x[y]\n|\n|  gt(self, value, /)\n|      Return self>value.\n|\n|  ior(self, value, /)\n|      Return self|=value.\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  le(self, value, /)\n|      Return self<=value.\n|\n|  len(self, /)\n|      Return len(self).\n|\n|  lt(self, value, /)\n|      Return self<value.\n|\n|  ne(self, value, /)\n|      Return self!=value.\n|\n|  reversed(self, /)\n|      Return a reverse iterator over the dict keys.\n|\n|  setitem(self, key, value, /)\n|      Set self[key] to value.\n|\n|  sizeof(...)\n|      D.sizeof() -> size of D in memory, in bytes\n|\n|  clear(...)\n|      D.clear() -> None.  Remove all items from D.\n|\n|  get(self, key, default=None, /)\n|      Return the value for key if key is in the dictionary, else default.\n|\n|  items(...)\n|      D.items() -> a set-like object providing a view on D's items\n|\n|  keys(...)\n|      D.keys() -> a set-like object providing a view on D's keys\n|\n|  pop(...)\n|      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n|\n|      If the key is not found, return the default if given; otherwise,\n|      raise a KeyError.\n|\n|  popitem(self, /)\n|      Remove and return a (key, value) pair as a 2-tuple.\n|\n|      Pairs are returned in LIFO (last-in, first-out) order.\n|      Raises KeyError if the dict is empty.\n|\n|  setdefault(self, key, default=None, /)\n|      Insert key with a value of default if key is not in the dictionary.\n|\n|      Return the value for key if key is in the dictionary, else default.\n|\n|  update(...)\n|      D.update([E, ]F) -> None.  Update D from dict/iterable E and F.\n|      If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]\n|      If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v\n|      In either case, this is followed by: for k in F:  D[k] = F[k]\n|\n|  values(...)\n|      D.values() -> an object providing a view on D's values\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from builtins.dict:\n|\n|  fromkeys(iterable, value=None, /) from builtins.type\n|      Create a new dictionary with keys from iterable and values set to value.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.dict:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes inherited from builtins.dict:\n|\n|  hash = None\n"
                },
                {
                    "name": "class deque",
                    "content": "|  deque([iterable[, maxlen]]) --> deque object\n|\n|  A list-like sequence optimized for data accesses near its endpoints.\n|\n|  Methods defined here:\n|\n|  add(self, value, /)\n|      Return self+value.\n|\n|  bool(self, /)\n|      True if self else False\n|\n|  contains(self, key, /)\n|      Return key in self.\n|\n|  copy(...)\n|      Return a shallow copy of a deque.\n|\n|  delitem(self, key, /)\n|      Delete self[key].\n|\n|  eq(self, value, /)\n|      Return self==value.\n|\n|  ge(self, value, /)\n|      Return self>=value.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  getitem(self, key, /)\n|      Return self[key].\n|\n|  gt(self, value, /)\n|      Return self>value.\n|\n|  iadd(self, value, /)\n|      Implement self+=value.\n|\n|  imul(self, value, /)\n|      Implement self*=value.\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  le(self, value, /)\n|      Return self<=value.\n|\n|  len(self, /)\n|      Return len(self).\n|\n|  lt(self, value, /)\n|      Return self<value.\n|\n|  mul(self, value, /)\n|      Return self*value.\n|\n|  ne(self, value, /)\n|      Return self!=value.\n|\n|  reduce(...)\n|      Return state information for pickling.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  reversed(...)\n|      D.reversed() -- return a reverse iterator over the deque\n|\n|  rmul(self, value, /)\n|      Return value*self.\n|\n|  setitem(self, key, value, /)\n|      Set self[key] to value.\n|\n|  sizeof(...)\n|      D.sizeof() -- size of D in memory, in bytes\n|\n|  append(...)\n|      Add an element to the right side of the deque.\n|\n|  appendleft(...)\n|      Add an element to the left side of the deque.\n|\n|  clear(...)\n|      Remove all elements from the deque.\n|\n|  copy(...)\n|      Return a shallow copy of a deque.\n|\n|  count(...)\n|      D.count(value) -> integer -- return number of occurrences of value\n|\n|  extend(...)\n|      Extend the right side of the deque with elements from the iterable\n|\n|  extendleft(...)\n|      Extend the left side of the deque with elements from the iterable\n|\n|  index(...)\n|      D.index(value, [start, [stop]]) -> integer -- return first index of value.\n|      Raises ValueError if the value is not present.\n|\n|  insert(...)\n|      D.insert(index, object) -- insert object before index\n|\n|  pop(...)\n|      Remove and return the rightmost element.\n|\n|  popleft(...)\n|      Remove and return the leftmost element.\n|\n|  remove(...)\n|      D.remove(value) -- remove first occurrence of value.\n|\n|  reverse(...)\n|      D.reverse() -- reverse *IN PLACE*\n|\n|  rotate(...)\n|      Rotate the deque n steps to the right (default n=1).  If n is negative, rotates left.\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  classgetitem(...) from builtins.type\n|      See PEP 585\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  maxlen\n|      maximum size of a deque or None if unbounded\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  hash = None\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "namedtuple",
                    "content": "Returns a new subclass of tuple with named fields.\n\n>>> Point = namedtuple('Point', ['x', 'y'])\n>>> Point.doc                   # docstring for the new class\n'Point(x, y)'\n>>> p = Point(11, y=22)             # instantiate with positional args or keywords\n>>> p[0] + p[1]                     # indexable like a plain tuple\n33\n>>> x, y = p                        # unpack like a regular tuple\n>>> x, y\n(11, 22)\n>>> p.x + p.y                       # fields also accessible by name\n33\n>>> d = p.asdict()                 # convert to a dictionary\n>>> d['x']\n11\n>>> Point(d)                      # convert from a dictionary\nPoint(x=11, y=22)\n>>> p.replace(x=100)               # replace() is like str.replace() but targets named fields\nPoint(x=100, y=22)\n"
                }
            ]
        },
        "DATA": {
            "content": "all = ['ChainMap', 'Counter', 'OrderedDict', 'UserDict', 'UserList...\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/collections/init.py\n\n",
            "subsections": []
        }
    },
    "summary": "collections",
    "flags": [],
    "examples": [],
    "see_also": []
}