1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
# convertertools
**Documentation**: <a href="https://convertertools.readthedocs.io" target="_blank">https://convertertools.readthedocs.io </a>
**Source Code**: <a href="https://github.com/bluetooth-devices/convertertools" target="_blank">https://github.com/bluetooth-devices/convertertools </a>
---
Tools for converting python data types
These are very simple tools for manipulating python data structures
to avoid writing out the same code many times in libraries.
## Installation
Install this via pip (or your favourite package manager):
`pip install convertertools`
## Usage
Note that specific types are required for maximum performance.
```python
from convertertools import del_dict_tuple, del_dict_set, pop_dict_tuple, pop_dict_set
# del_dict* raise KeyError on missing keys
del_dict_tuple(d, ("a", "b"))
del_dict_set(d, {"a", "b"})
# pop_dict* ignores missing keys
pop_dict_tuple(d, ("a", "b"))
pop_dict_set(d, {"a", "b"})
# pop_dict_set_if_none ignores missing keys and only
# removes them if their value is None
pop_dict_set_if_none(d, {"a", "b"})
```
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- prettier-ignore-start -->
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
<!-- prettier-ignore-end -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
## Credits
This package was created with
[Copier](https://copier.readthedocs.io/) and the
[browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)
project template.
|