What is it
A set of dictionary classes that allow an aliasing of keys to other keys consistently, and a follow up implementation that does the same thing without concern for the case of string keys while preserving case for output and iteration.
Neither implementation assumes string keys, so anything Hashable should remain compatible for all keys in the API.
It's still directly comparable (==, in, .get(), etc) and access compatible with dict(), and offers a mild framework for implementing key-transforming dictionaries somewhat painlessly with a decent test backing.
Does it work?
Yes, check this out.
from mmdict import MultiDict
data = {"test": "ok"}
alternatives = {"test": ["also", "as well"]}
d = MultiDict(data, aliases=alternatives)
# True
d["also"] == "ok"
# True
d["as well"] == d["test"]
from mmdict import CaselessMultiDict
d = CaselessMultiDict({"Test": "not ok"})
# A super valid write, because we're a regular dict() right?
d["Test"] = "ok"
# Oh wow, `True`, because `"Test"` and `"test"` are caselessly the same
d["test"] == "ok"
# True, because, the case of the initial write is preserved for iteration
list(d.keys()) == ["Test"]
Development Setup
*nix
python -mvenv .venv
. .venv/bin/activate
PowerShell
python -mvenv .venv
.\.venv\Scripts\Activate.ps1
Then, for both platforms
python -m ensurepip --upgrade
python -m pip install --upgrade pip
pip install -e .
Running tests
With the virtual environment activated, use the multi-platform script to run the test suite.
script/test.sh.ps1
It's a very thin thin wrapper around bootstrapping the test run with python.
Release files for mmdict 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mmdict-0.0.1.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mmdict-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / mmdict-0.0.1.tar.gz
| Download URL | mmdict-0.0.1.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8eac6ac449086496cd54f8999aa922a6b48fc517ded3a1e29ffdd3e8192547cb
|
|
BLAKE2b-256 checksum How to use checksums |
0141b42b506f992ec25531e68aabeb9ad3db18a50fd46cfd008f78ad0a3978cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / mmdict-0.0.1-py3-none-any.whl
| Download URL | mmdict-0.0.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e3e76eca79b93054ec1aac59e5cc4fabae63e9118ea1c67e017d69b4aa2ae40
|
|
BLAKE2b-256 checksum How to use checksums |
62e150e4bb4928319211027ab619b377f4443350a9483f8640b7bad6db871c88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|