# nocasedict - A case-insensitive ordered dictionary for Python
[![Version on Pypi](https://img.shields.io/pypi/v/nocasedict.svg)](https://pypi.python.org/pypi/nocasedict/)
[![Test status (master)](https://github.com/pywbem/nocasedict/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/pywbem/nocasedict/actions/workflows/test.yml?query=branch%3Amaster)
[![Docs status (master)](https://readthedocs.org/projects/nocasedict/badge/?version=latest)](https://readthedocs.org/projects/nocasedict/builds/)
[![Test coverage (master)](https://coveralls.io/repos/github/pywbem/nocasedict/badge.svg?branch=master)](https://coveralls.io/github/pywbem/nocasedict?branch=master)
# Overview
Class
[NocaseDict](https://nocasedict.readthedocs.io/en/stable/reference.html#nocasedict.NocaseDict)
is a case-insensitive ordered dictionary that preserves the original
lexical case of its keys.
Example:
$ python
>>> from nocasedict import NocaseDict
>>> dict1 = NocaseDict({'Alpha': 1, 'Beta': 2})
>>> dict1['ALPHA'] # Lookup by key is case-insensitive
1
>>> print(dict1) # Keys are returned with the original lexical case
NocaseDict({'Alpha': 1, 'Beta': 2})
The
[NocaseDict](https://nocasedict.readthedocs.io/en/stable/reference.html#nocasedict.NocaseDict)
class supports the functionality of the built-in
[dict class of Python 3.8](https://docs.python.org/3.8/library/stdtypes.html#dict)
on all Python versions it supports.
Limitation: Any functionalities added to the `dict` class in Python 3.9 or
later are not yet supported. These are:
* `d | other` - Added in Python 3.9.
* `d |= other` - Added in Python 3.9.
The case-insensitivity is achieved by matching any key values as their
casefolded values. By default, the casefolding is performed with
[str.casefold()](https://docs.python.org/3/library/stdtypes.html#str.casefold)
for unicode string keys and with
[bytes.lower()](https://docs.python.org/3/library/stdtypes.html#bytes.lower)
for byte string keys. The default casefolding can be overridden with a
user-defined casefold method.
Functionality can be added using mixin classes:
- [HashableMixin](https://nocasedict.readthedocs.io/en/stable/reference.html#nocasedict.HashableMixin)
mixin class: Adds case-insensitive hashability.
- [KeyableByMixin](https://nocasedict.readthedocs.io/en/stable/reference.html#nocasedict.KeyableByMixin)
mixin generator function: Adds ability to get the key from an
attribute of the value object.
Why yet another case-insensitive dictionary: We found that all
previously existing case-insensitive dictionary packages on Pypi either
had flaws, were not well maintained, or did not support the Python
versions we needed.
# Installation
To install the latest released version of the nocasedict package into
your active Python environment:
$ pip install nocasedict
This will also install any prerequisite Python packages.
For more details and alternative ways to install, see
[Installation](https://nocasedict.readthedocs.io/en/stable/intro.html#installation).
# Documentation
- [Documentation](https://nocasedict.readthedocs.io/en/stable/)
# Change History
- [Change history](https://nocasedict.readthedocs.io/en/stable/changes.html)
# Contributing
For information on how to contribute to the nocasedict project, see
[Contributing](https://nocasedict.readthedocs.io/en/stable/development.html#contributing).
# License
The nocasedict project is provided under the
[GNU Lesser General Public License (LGPL) version 2.1](https://raw.githubusercontent.com/pywbem/nocasedict/master/LICENSE),
or (at your option) any later version.
Raw data
{
"_id": null,
"home_page": "https://github.com/pywbem/nocasedict",
"name": "nocasedict",
"maintainer": "Andreas Maier",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "andreas.r.maier@gmx.de",
"keywords": null,
"author": "Andreas Maier",
"author_email": "andreas.r.maier@gmx.de",
"download_url": "https://files.pythonhosted.org/packages/5c/31/13a4c15a0265f8ecb2779e338be7371e28d36a454f7174e6e2bfdb3f1341/nocasedict-2.0.4.tar.gz",
"platform": "any",
"description": "# nocasedict - A case-insensitive ordered dictionary for Python\n\n[![Version on Pypi](https://img.shields.io/pypi/v/nocasedict.svg)](https://pypi.python.org/pypi/nocasedict/)\n[![Test status (master)](https://github.com/pywbem/nocasedict/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/pywbem/nocasedict/actions/workflows/test.yml?query=branch%3Amaster)\n[![Docs status (master)](https://readthedocs.org/projects/nocasedict/badge/?version=latest)](https://readthedocs.org/projects/nocasedict/builds/)\n[![Test coverage (master)](https://coveralls.io/repos/github/pywbem/nocasedict/badge.svg?branch=master)](https://coveralls.io/github/pywbem/nocasedict?branch=master)\n\n# Overview\n\nClass\n[NocaseDict](https://nocasedict.readthedocs.io/en/stable/reference.html#nocasedict.NocaseDict)\nis a case-insensitive ordered dictionary that preserves the original\nlexical case of its keys.\n\nExample:\n\n $ python\n >>> from nocasedict import NocaseDict\n\n >>> dict1 = NocaseDict({'Alpha': 1, 'Beta': 2})\n\n >>> dict1['ALPHA'] # Lookup by key is case-insensitive\n 1\n\n >>> print(dict1) # Keys are returned with the original lexical case\n NocaseDict({'Alpha': 1, 'Beta': 2})\n\nThe\n[NocaseDict](https://nocasedict.readthedocs.io/en/stable/reference.html#nocasedict.NocaseDict)\nclass supports the functionality of the built-in\n[dict class of Python 3.8](https://docs.python.org/3.8/library/stdtypes.html#dict)\non all Python versions it supports.\n\nLimitation: Any functionalities added to the `dict` class in Python 3.9 or\nlater are not yet supported. These are:\n\n* `d | other` - Added in Python 3.9.\n* `d |= other` - Added in Python 3.9.\n\nThe case-insensitivity is achieved by matching any key values as their\ncasefolded values. By default, the casefolding is performed with\n[str.casefold()](https://docs.python.org/3/library/stdtypes.html#str.casefold)\nfor unicode string keys and with\n[bytes.lower()](https://docs.python.org/3/library/stdtypes.html#bytes.lower)\nfor byte string keys. The default casefolding can be overridden with a\nuser-defined casefold method.\n\nFunctionality can be added using mixin classes:\n\n- [HashableMixin](https://nocasedict.readthedocs.io/en/stable/reference.html#nocasedict.HashableMixin)\n mixin class: Adds case-insensitive hashability.\n- [KeyableByMixin](https://nocasedict.readthedocs.io/en/stable/reference.html#nocasedict.KeyableByMixin)\n mixin generator function: Adds ability to get the key from an\n attribute of the value object.\n\nWhy yet another case-insensitive dictionary: We found that all\npreviously existing case-insensitive dictionary packages on Pypi either\nhad flaws, were not well maintained, or did not support the Python\nversions we needed.\n\n# Installation\n\nTo install the latest released version of the nocasedict package into\nyour active Python environment:\n\n $ pip install nocasedict\n\nThis will also install any prerequisite Python packages.\n\nFor more details and alternative ways to install, see\n[Installation](https://nocasedict.readthedocs.io/en/stable/intro.html#installation).\n\n# Documentation\n\n- [Documentation](https://nocasedict.readthedocs.io/en/stable/)\n\n# Change History\n\n- [Change history](https://nocasedict.readthedocs.io/en/stable/changes.html)\n\n# Contributing\n\nFor information on how to contribute to the nocasedict project, see\n[Contributing](https://nocasedict.readthedocs.io/en/stable/development.html#contributing).\n\n# License\n\nThe nocasedict project is provided under the\n[GNU Lesser General Public License (LGPL) version 2.1](https://raw.githubusercontent.com/pywbem/nocasedict/master/LICENSE),\nor (at your option) any later version.\n",
"bugtrack_url": null,
"license": "GNU Lesser General Public License v2 or later (LGPLv2+)",
"summary": "A case-insensitive ordered dictionary for Python",
"version": "2.0.4",
"project_urls": {
"Bug Tracker": "https://github.com/pywbem/nocasedict/issues",
"Documentation": "https://nocasedict.readthedocs.io/en/latest/",
"Homepage": "https://github.com/pywbem/nocasedict",
"Source Code": "https://github.com/pywbem/nocasedict"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "50b3f16fefeb9de5466ccc8c6cc25bf3a040f830e5ceec2d55b5aae10f3752aa",
"md5": "669d428867ab8f349d834a65ce181c26",
"sha256": "edba9abdbc8da50ac39d80caceff69ad1846d45f3bbd3b9bf857426e13a6168c"
},
"downloads": -1,
"filename": "nocasedict-2.0.4-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "669d428867ab8f349d834a65ce181c26",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 23424,
"upload_time": "2024-08-18T13:38:31",
"upload_time_iso_8601": "2024-08-18T13:38:31.189301Z",
"url": "https://files.pythonhosted.org/packages/50/b3/f16fefeb9de5466ccc8c6cc25bf3a040f830e5ceec2d55b5aae10f3752aa/nocasedict-2.0.4-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5c3113a4c15a0265f8ecb2779e338be7371e28d36a454f7174e6e2bfdb3f1341",
"md5": "fc339136f7fa499932ff5f40cdee2a42",
"sha256": "4ca934f65df57b10d0fcab5f0c39e9dccb93577ff9f22bef98265ddbf12f8af1"
},
"downloads": -1,
"filename": "nocasedict-2.0.4.tar.gz",
"has_sig": false,
"md5_digest": "fc339136f7fa499932ff5f40cdee2a42",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 41025,
"upload_time": "2024-08-18T13:38:32",
"upload_time_iso_8601": "2024-08-18T13:38:32.483553Z",
"url": "https://files.pythonhosted.org/packages/5c/31/13a4c15a0265f8ecb2779e338be7371e28d36a454f7174e6e2bfdb3f1341/nocasedict-2.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-18 13:38:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pywbem",
"github_project": "nocasedict",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "nocasedict"
}