X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=docs%2Fpyutils.collectionz.rst;h=0b0123797f7cfa159ea5b0f58aebed67830a3347;hb=993b0992473c12294ed659e52b532e1c8cf9cd1e;hp=60518dcc9812e8b95e2a513839bc5c002ac0d984;hpb=b38920f24d1ac948958480c540bc4b8436186765;p=pyutils.git diff --git a/docs/pyutils.collectionz.rst b/docs/pyutils.collectionz.rst index 60518dc..0b01237 100644 --- a/docs/pyutils.collectionz.rst +++ b/docs/pyutils.collectionz.rst @@ -1,42 +1,18 @@ pyutils.collectionz package =========================== +This subpackage contains some homegrown collections that try to emulate +:mod:`collections` included in the Python standard library. It ends +with a 'z' so as not to collide with the standard library package. + Submodules ---------- pyutils.collectionz.bidict module --------------------------------- -The bidict.BiDict class is a subclass of :py:class:`dict` that -implements a bidirectional dictionary. That is, it maps each key to a -value in constant time and each value back to the one or more keys it -is associated with in constant time. It does this by simply storing -the data twice. - -Sample usage:: - - # Initialize with a normal dict... - third_party_wierdos = BiDict({ - 'prometheus-fastapi-instrumentator': 'prometheus_fastapi_instrumentator', - 'scikit-learn': 'sklearn', - 'antlr4-python3-runtime' : 'antlr4', - 'python-dateutil': 'dateutil', - 'speechrecognition': 'speech_recognition', - 'beautifulsoup4': 'bs4', - 'python-dateutil': 'dateutil', - 'homeassistant-api': 'homeassistant_api', - }) - - # Use in one direction: - x = third_party_wierdos['scikit-learn'] - - # Use in opposite direction: - y = third_party_wierdos.inverse['python_dateutil'] - - # Note: type(y) is List since one value may map back to multiple keys. - - .. automodule:: pyutils.collectionz.bidict + :imported-members: :members: :undoc-members: :show-inheritance: @@ -44,8 +20,6 @@ Sample usage:: pyutils.collectionz.bst module ------------------------------ -The bst.BinarySearchTree class is a binary search tree container. - .. automodule:: pyutils.collectionz.bst :members: :undoc-members: @@ -70,13 +44,6 @@ size. pyutils.collectionz.trie module ------------------------------- -The trie.Trie class is a Trie or prefix tree. It can be used with -arbitrary sequences as keys and stores its values in a tree with paths -determined by the sequence determined by each key. Thus, it can -determine whether a value is contained in the tree via a simple -traversal in linear time and can also check whether a key-prefix is -present in the tree in linear time. - .. automodule:: pyutils.collectionz.trie :members: :undoc-members: