Case Insensitive Dictionary
Project description
Case Insensitive Dict
Case Insensitive Dictionary
Install
Install and update using pip.
$ pip install -U case-insensitive-dictionary
Example
CaseInsensitiveDict:
>>> from case_insensitive_dict import CaseInsensitiveDict
>>> case_insensitive_dict = CaseInsensitiveDict[str, str](data={"Aa": "b"})
>>> case_insensitive_dict.get("aa")
'b'
>>> case_insensitive_dict.get("Aa")
'b'
also supports generic keys:
>>> 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'
and 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/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file case-insensitive-dictionary-0.1.1.tar.gz
.
File metadata
- Download URL: case-insensitive-dictionary-0.1.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.10.2 Linux/5.11.0-1027-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46fd80b0dd253c84a7c6c015813ff4e9c956de3306ccec8cdbd2d70ac0193be6 |
|
MD5 | c92d338d5eae922177dffa0c20b53261 |
|
BLAKE2b-256 | 7b2914c15b88901b44ff6d00bbed8a09440b56a6d24096a8d1e1f731d039530e |
File details
Details for the file case_insensitive_dictionary-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: case_insensitive_dictionary-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.10.2 Linux/5.11.0-1027-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7307ae8292574e1e4fca0cd53d288cb7780e30da941e76dd1010eae39d4d550c |
|
MD5 | 0ebc2a0f3e22b55624e3fd34ab5e3a0c |
|
BLAKE2b-256 | 717bc4a1d9553e0043e5bf249360f9b2630aecde33ca264a51aa1da4cdc44623 |