# Case Insensitive Dict
Typed Python Case Insensitive Dictionary
[![Publish](https://github.com/DeveloperRSquared/case-insensitive-dict/actions/workflows/publish.yml/badge.svg)](https://github.com/DeveloperRSquared/case-insensitive-dict/actions/workflows/publish.yml)
[![Python 3.7+](https://img.shields.io/badge/python-3.7+-brightgreen.svg)](#case-insensitive-dict)
[![PyPI - License](https://img.shields.io/pypi/l/case-insensitive-dictionary.svg)](LICENSE)
[![PyPI - Version](https://img.shields.io/pypi/v/case-insensitive-dictionary.svg)](https://pypi.org/project/case-insensitive-dictionary)
[![CodeQL](https://github.com/DeveloperRSquared/case-insensitive-dict/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/DeveloperRSquared/case-insensitive-dict/actions/workflows/codeql-analysis.yml)
[![codecov](https://codecov.io/gh/DeveloperRSquared/case-insensitive-dict/branch/main/graph/badge.svg?token=45JCHX8KT9)](https://codecov.io/gh/DeveloperRSquared/case-insensitive-dict)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/DeveloperRSquared/case-insensitive-dict/main.svg)](https://results.pre-commit.ci/latest/github/DeveloperRSquared/case-insensitive-dict/main)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
## Install
Install and update using [pip](https://pypi.org/project/case-insensitive-dictionary/).
```sh
$ 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.<br>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).<br>The value of the removed item is the return value. |
| popitem() | Remove the last item that was inserted into the dictionary.<br>For Python version <3.7, popitem() removes a random item. |
## Example
CaseInsensitiveDict:
```py
>>> 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:
```py
>>> 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
```sh
$ 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](https://pre-commit.com) using the instructions below
```sh
$ pre-commit install
$ pre-commit run --all-files
```
### Running tests
```sh
$ 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/>
Raw data
{
"_id": null,
"home_page": "https://github.com/DeveloperRSquared/case-insensitive-dict",
"name": "case-insensitive-dictionary",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "python,python3,dict,development,tooling,utils",
"author": "rikhilrai",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/01/5e/8de464e77e2bb6f0b47f2ac94f75cd46f4f14ba55529619e68ae5e81443e/case-insensitive-dictionary-0.2.1.tar.gz",
"platform": null,
"description": "# Case Insensitive Dict\n\nTyped Python Case Insensitive Dictionary\n\n[![Publish](https://github.com/DeveloperRSquared/case-insensitive-dict/actions/workflows/publish.yml/badge.svg)](https://github.com/DeveloperRSquared/case-insensitive-dict/actions/workflows/publish.yml)\n\n[![Python 3.7+](https://img.shields.io/badge/python-3.7+-brightgreen.svg)](#case-insensitive-dict)\n[![PyPI - License](https://img.shields.io/pypi/l/case-insensitive-dictionary.svg)](LICENSE)\n[![PyPI - Version](https://img.shields.io/pypi/v/case-insensitive-dictionary.svg)](https://pypi.org/project/case-insensitive-dictionary)\n\n[![CodeQL](https://github.com/DeveloperRSquared/case-insensitive-dict/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/DeveloperRSquared/case-insensitive-dict/actions/workflows/codeql-analysis.yml)\n[![codecov](https://codecov.io/gh/DeveloperRSquared/case-insensitive-dict/branch/main/graph/badge.svg?token=45JCHX8KT9)](https://codecov.io/gh/DeveloperRSquared/case-insensitive-dict)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/DeveloperRSquared/case-insensitive-dict/main.svg)](https://results.pre-commit.ci/latest/github/DeveloperRSquared/case-insensitive-dict/main)\n\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n\n## Install\n\nInstall and update using [pip](https://pypi.org/project/case-insensitive-dictionary/).\n\n```sh\n$ pip install -U case-insensitive-dictionary\n```\n\n## API Reference\n\n| Method | Description |\n| :------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------- |\n| clear() | Removes all elements from the dictionary. |\n| copy() | Returns a copy of the dictionary. |\n| get(key, default) | Returns the value (case-insensitively), of the item specified with the key.<br>Falls back to the default value if the specified key does not exist. |\n| fromkeys(iterable, value) | Returns a dictionary with the specified keys and the specified value. |\n| keys() | Returns the dictionary's keys. |\n| values() | Returns the dictionary's values. |\n| items() | Returns the key-value pairs. |\n| pop(key) | Remove the specified item (case-insensitively).<br>The value of the removed item is the return value. |\n| popitem() | Remove the last item that was inserted into the dictionary.<br>For Python version <3.7, popitem() removes a random item. |\n\n## Example\n\nCaseInsensitiveDict:\n\n```py\n>>> from typing import Union\n\n>>> from case_insensitive_dict import CaseInsensitiveDict\n\n>>> case_insensitive_dict = CaseInsensitiveDict[Union[str, int], str](data={\"Aa\": \"b\", 1: \"c\"})\n>>> case_insensitive_dict[\"aa\"]\n'b'\n>>> case_insensitive_dict[1]\n'c'\n\n```\n\nwhich also supports json encoding/decoding:\n\n```py\n>>> import json\n\n>>> from case_insensitive_dict import CaseInsensitiveDict, CaseInsensitiveDictJSONEncoder, case_insensitive_dict_json_decoder\n\n>>> case_insensitive_dict = CaseInsensitiveDict[str, str](data={\"Aa\": \"b\"})\n>>> json_string = json.dumps(obj=case_insensitive_dict, cls=CaseInsensitiveDictJSONEncoder)\n>>> json_string\n'{\"Aa\": \"b\"}'\n\n>>> case_insensitive_dict = json.loads(s=json_string, object_hook=case_insensitive_dict_json_decoder)\n>>> case_insensitive_dict\nCaseInsensitiveDict({'Aa': 'b'})\n```\n\n## Contributing\n\nContributions are welcome via pull requests.\n\n### First time setup\n\n```sh\n$ git clone git@github.com:DeveloperRSquared/case-insensitive-dict.git\n$ cd case-insensitive-dict\n$ poetry install\n$ poetry shell\n```\n\nTools including black, mypy etc. will run automatically if you install [pre-commit](https://pre-commit.com) using the instructions below\n\n```sh\n$ pre-commit install\n$ pre-commit run --all-files\n```\n\n### Running tests\n\n```sh\n$ poetry run pytest\n```\n\n## Links\n\n- Source Code: <https://github.com/DeveloperRSquared/case-insensitive-dict/>\n- PyPI Releases: <https://pypi.org/project/case-insensitive-dictionary/>\n- Issue Tracker: <https://github.com/DeveloperRSquared/case-insensitive-dict/issues/>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Typed Python Case Insensitive Dictionary",
"version": "0.2.1",
"split_keywords": [
"python",
"python3",
"dict",
"development",
"tooling",
"utils"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "5313704303c37b76107ffff9b1eb0e20",
"sha256": "a8971780be1ba25e363db259515f0a2f003013465f82552e2f9aed08d5a9ca28"
},
"downloads": -1,
"filename": "case_insensitive_dictionary-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5313704303c37b76107ffff9b1eb0e20",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 6060,
"upload_time": "2022-10-18T10:35:31",
"upload_time_iso_8601": "2022-10-18T10:35:31.701752Z",
"url": "https://files.pythonhosted.org/packages/9e/94/2a5f43133bfd07d8c826f5fe277d54fb6c45c0c2ac5df3bc71c2ba8ff4ea/case_insensitive_dictionary-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "75e1749d95e2c38d8c493f6830b8076f",
"sha256": "7e94726f97eb2c0ceac53209971db50ffc996def663e5e5080d0a1acb4a42280"
},
"downloads": -1,
"filename": "case-insensitive-dictionary-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "75e1749d95e2c38d8c493f6830b8076f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 5938,
"upload_time": "2022-10-18T10:35:30",
"upload_time_iso_8601": "2022-10-18T10:35:30.298711Z",
"url": "https://files.pythonhosted.org/packages/01/5e/8de464e77e2bb6f0b47f2ac94f75cd46f4f14ba55529619e68ae5e81443e/case-insensitive-dictionary-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-10-18 10:35:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "DeveloperRSquared",
"github_project": "case-insensitive-dict",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "case-insensitive-dictionary"
}