Cawdreyο
Several useful custom dictionaries for Python πβπ
Docs |
|
|---|---|
Tests |
|
PyPI |
|
Anaconda |
|
Activity |
|
QA |
|
Other |
Highlightsο
frozendict: An immutable dictionary that cannot be changed after creation.FrozenOrderedDict: An immutableOrderedDictwhere the order of keys is preserved, but that cannot be changed after creation.AlphaDict: AFrozenOrderedDictwhere the keys are stored in alphabetical order.bdict: A dictionary wherekey, valuepairs are stored both ways round.Tally: A subclass ofcollections.Counterwith additional methods.HeaderMapping: Acollections.abc.MutableMappingwhich supports duplicate, case-insentive keys.
This package also provides two base classes for creating your own custom dictionaries:
FrozenBase: An Abstract Base Class for frozen dictionaries.MutableBase: An Abstract Base Class for mutable dictionaries.
Other Dictionary Packagesο
If youβre looking to unflatten a dictionary, such as to go from this:
{"foo.bar": "val"}
to this:
{"foo": {"bar": "val"}}
check out unflatten, flattery or morph to accomplish that.
indexed provides an OrderedDict where the values can be accessed by their index as well as by their keys.
Thereβs also python-benedict, which provides a custom dictionary with keylist/keypath support,
I/O shortcuts (Base64, CSV, JSON, TOML, XML, YAML, pickle, query-string)
and many utilities.
Installationο
python3 -m pip install cawdrey --user
First add the required channels
conda config --add channels https://conda.anaconda.org/conda-forge
conda config --add channels https://conda.anaconda.org/domdfcoding
Then install
conda install cawdrey
python3 -m pip install git+https://github.com/domdfcoding/cawdrey@master --user