Set of utilities and accessory methods to work with Python dicts.
Project description
# dict-utils
dict-utils is a set of utilities and accessory methods usable
with Python dicts.
## Examples
1. Search for a value in a dictionary, passing a key:
```python
from dict_utils import dict_utils
dict_1 = {'first_level': {'second_level': {'name': 'Joe', 'age': 30}}}
found_value = dict_utils.dict_search_value(dict_1, 'name')
```
**found_value** will contain **'Joe'**
2. Compare two different dictionaries having the same keys
```python
from dict_utils import dict_utils
dict_1 = {'first_level': {'second_level': {'name': 'Joe', 'age': 30}}}
dict_2 = {'level_1': {'level_2': {'name': 'Joe', 'age': 30}}}
dict_utils.compare_assert_dicts(self, ['name', 'age'], dict_1, dict_2)
```
## Running Tests
```
python setup.py test
```
## Continuous integration status
[![Travis-CI Status](https://secure.travis-ci.org/glowdigitalmedia/dict-utils.png?branch=master)](http://travis-ci.org/#!/glowdigitalmedia/dict-utils)
dict-utils is a set of utilities and accessory methods usable
with Python dicts.
## Examples
1. Search for a value in a dictionary, passing a key:
```python
from dict_utils import dict_utils
dict_1 = {'first_level': {'second_level': {'name': 'Joe', 'age': 30}}}
found_value = dict_utils.dict_search_value(dict_1, 'name')
```
**found_value** will contain **'Joe'**
2. Compare two different dictionaries having the same keys
```python
from dict_utils import dict_utils
dict_1 = {'first_level': {'second_level': {'name': 'Joe', 'age': 30}}}
dict_2 = {'level_1': {'level_2': {'name': 'Joe', 'age': 30}}}
dict_utils.compare_assert_dicts(self, ['name', 'age'], dict_1, dict_2)
```
## Running Tests
```
python setup.py test
```
## Continuous integration status
[![Travis-CI Status](https://secure.travis-ci.org/glowdigitalmedia/dict-utils.png?branch=master)](http://travis-ci.org/#!/glowdigitalmedia/dict-utils)
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
dict-utils-0.1.1.tar.gz
(2.5 kB
view hashes)
Built Distribution
dict-utils-0.1.1.linux-x86_64.exe
(64.1 kB
view hashes)
Close
Hashes for dict-utils-0.1.1.linux-x86_64.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | 705120f69f4ad3d26164356cb217b92606b0325bce2bf3437ca139b1ed8bc81f |
|
MD5 | 2a868834d5ca39ff85570833b8a21642 |
|
BLAKE2b-256 | f3d917aef1877ed2d82c2a03156a8b0af7f8cb3f73609792f916d320c9abdf53 |