case-insensitive-dictionary-0.2.1
توضیحات
Typed Python Case Insensitive Dictionary
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | case-insensitive-dictionary-0.2.1 |
| نام | case-insensitive-dictionary |
| نسخه کتابخانه | 0.2.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | rikhilrai |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/DeveloperRSquared/case-insensitive-dict |
| آدرس اینترنتی | https://pypi.org/project/case-insensitive-dictionary/ |
| مجوز | MIT |
# Case Insensitive Dict
Typed Python Case Insensitive Dictionary
[](https://github.com/DeveloperRSquared/case-insensitive-dict/actions/workflows/publish.yml)
[](#case-insensitive-dict)
[](LICENSE)
[](https://pypi.org/project/case-insensitive-dictionary)
[](https://github.com/DeveloperRSquared/case-insensitive-dict/actions/workflows/codeql-analysis.yml)
[](https://codecov.io/gh/DeveloperRSquared/case-insensitive-dict)
[](https://results.pre-commit.ci/latest/github/DeveloperRSquared/case-insensitive-dict/main)
[](https://pycqa.github.io/isort/)
[](https://github.com/psf/black)
[](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/>
نیازمندی
| مقدار | نام |
|---|---|
| <4.3) | importlib-metadata |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7,<4.0 | Python |
نحوه نصب
نصب پکیج whl case-insensitive-dictionary-0.2.1:
pip install case-insensitive-dictionary-0.2.1.whl
نصب پکیج tar.gz case-insensitive-dictionary-0.2.1:
pip install case-insensitive-dictionary-0.2.1.tar.gz