Case Insensitive Dict
Typed Python Case Insensitive Dictionary
Install
Install and update using pip.
$ pip install -U case-insensitive-dictionary
API Reference
| Method | Description |
|---|---|
| clear() | Removes all elements from the dictionary. |
| copy() | Returns a copy of the dictionary. |
| get(key, default) | Returns the value (case-insensitively), of the item specified with the key. Falls back to the default value if the specified key does not exist. |
| fromkeys(iterable, value) | Returns a dictionary with the specified keys and the specified value. |
| keys() | Returns the dictionary's keys. |
| values() | Returns the dictionary's values. |
| items() | Returns the key-value pairs. |
| pop(key) | Remove the specified item (case-insensitively). The value of the removed item is the return value. |
| popitem() | Remove the last item that was inserted into the dictionary. For Python version <3.7, popitem() removes a random item. |
Example
CaseInsensitiveDict:
>>> from typing import Union
>>> from case_insensitive_dict import CaseInsensitiveDict
>>> case_insensitive_dict = CaseInsensitiveDict[Union[str, int], str](data={"Aa": "b", 1: "c"})
>>> case_insensitive_dict["aa"]
'b'
>>> case_insensitive_dict[1]
'c'
which also supports json encoding/decoding:
>>> import json
>>> from case_insensitive_dict import CaseInsensitiveDict, CaseInsensitiveDictJSONEncoder, case_insensitive_dict_json_decoder
>>> case_insensitive_dict = CaseInsensitiveDict[str, str](data={"Aa": "b"})
>>> json_string = json.dumps(obj=case_insensitive_dict, cls=CaseInsensitiveDictJSONEncoder)
>>> json_string
'{"Aa": "b"}'
>>> case_insensitive_dict = json.loads(s=json_string, object_hook=case_insensitive_dict_json_decoder)
>>> case_insensitive_dict
CaseInsensitiveDict({'Aa': 'b'})
Contributing
Contributions are welcome via pull requests.
First time setup
$ git clone git@github.com:DeveloperRSquared/case-insensitive-dict.git
$ cd case-insensitive-dict
$ poetry install
$ poetry shell
Tools including black, mypy etc. will run automatically if you install pre-commit using the instructions below
$ pre-commit install
$ pre-commit run --all-files
Running tests
$ poetry run pytest
Links
- Source Code: https://github.com/DeveloperRSquared/case-insensitive-dict/
- PyPI Releases: https://pypi.org/project/case-insensitive-dictionary/
- Issue Tracker: https://github.com/DeveloperRSquared/case-insensitive-dict/issues/
Metadata
Release files for case-insensitive-dictionary 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| case-insensitive-dictionary-0.2.1.tar.gz | 5.9 kB | Without provenance | Details for case-insensitive-dictionary-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| case_insensitive_dictionary-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for case_insensitive_dictionary-0.2.1-py3-none-any.whl |
Total release size: 12.0 kB
Release files / case-insensitive-dictionary-0.2.1.tar.gz
| Download URL | case-insensitive-dictionary-0.2.1.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e94726f97eb2c0ceac53209971db50ffc996def663e5e5080d0a1acb4a42280
|
|
BLAKE2b-256 checksum How to use checksums |
015e8de464e77e2bb6f0b47f2ac94f75cd46f4f14ba55529619e68ae5e81443e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.7 Linux/5.15.0-1021-azure
|
Release files / case_insensitive_dictionary-0.2.1-py3-none-any.whl
| Download URL | case_insensitive_dictionary-0.2.1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8971780be1ba25e363db259515f0a2f003013465f82552e2f9aed08d5a9ca28
|
|
BLAKE2b-256 checksum How to use checksums |
9e942a5f43133bfd07d8c826f5fe277d54fb6c45c0c2ac5df3bc71c2ba8ff4ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.7 Linux/5.15.0-1021-azure
|
Security for case-insensitive-dictionary 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.