A case-insensitive list for Python
Project description
nocasedict - A case-insensitive ordered dictionary for Python
Overview
Class 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 class supports the functionality of the built-in dict class of Python 3.14 on all Python versions it supports (except for being case-insensitive, of course).
The case-insensitivity is achieved by matching any key values as their casefolded values. By default, the casefolding is performed with str.casefold() for unicode string keys and with 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 mixin class: Adds case-insensitive hashability.
- 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.
Documentation
Change History
Contributing
For information on how to contribute to the nocasedict project, see Contributing.
License
The nocasedict project is provided under the GNU Lesser General Public License (LGPL) version 2.1, or (at your option) any later version.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nocasedict-2.2.0.tar.gz.
File metadata
- Download URL: nocasedict-2.2.0.tar.gz
- Upload date:
- Size: 135.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f2b608602b0568cd06ff46e2a0f231d2a0c247d6dc120672c381cb29169e1e7
|
|
| MD5 |
d4848aa4bda25adf8689354478f7a0e7
|
|
| BLAKE2b-256 |
c0b3430e1cf279b34807c37304c9c50576523c5ca3a514e964e7e376d0cfc6c9
|
Provenance
The following attestation bundles were made for nocasedict-2.2.0.tar.gz:
Publisher:
publish.yml on pywbem/nocasedict
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nocasedict-2.2.0.tar.gz -
Subject digest:
6f2b608602b0568cd06ff46e2a0f231d2a0c247d6dc120672c381cb29169e1e7 - Sigstore transparency entry: 790850786
- Sigstore integration time:
-
Permalink:
pywbem/nocasedict@1d9c7cc09f05c81d5d7dc398934d30ce2892cad7 -
Branch / Tag:
refs/tags/2.2.0 - Owner: https://github.com/pywbem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d9c7cc09f05c81d5d7dc398934d30ce2892cad7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nocasedict-2.2.0-py3-none-any.whl.
File metadata
- Download URL: nocasedict-2.2.0-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca46fd37843c94ca21c7933abd59b8c3ec6f50310c699e0db1eaa208452c155a
|
|
| MD5 |
4236f23c6262b59c9b39da9a59d0b217
|
|
| BLAKE2b-256 |
a7f0c1dfe5943bb51b93c7045ffc4f56c85eb56c14f9afc28ba1429e903d9d89
|
Provenance
The following attestation bundles were made for nocasedict-2.2.0-py3-none-any.whl:
Publisher:
publish.yml on pywbem/nocasedict
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nocasedict-2.2.0-py3-none-any.whl -
Subject digest:
ca46fd37843c94ca21c7933abd59b8c3ec6f50310c699e0db1eaa208452c155a - Sigstore transparency entry: 790850789
- Sigstore integration time:
-
Permalink:
pywbem/nocasedict@1d9c7cc09f05c81d5d7dc398934d30ce2892cad7 -
Branch / Tag:
refs/tags/2.2.0 - Owner: https://github.com/pywbem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d9c7cc09f05c81d5d7dc398934d30ce2892cad7 -
Trigger Event:
push
-
Statement type: