https://github.com/chrisantonellis/delimited
Delimited defines classes that allow for accessing and modifying nested data
https://github.com/chrisantonellis/delimited
nested-data nested-dicts
Last synced: 3 months ago
JSON representation
Delimited defines classes that allow for accessing and modifying nested data
- Host: GitHub
- URL: https://github.com/chrisantonellis/delimited
- Owner: chrisantonellis
- License: other
- Created: 2017-10-12T23:00:52.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-04T21:14:33.000Z (about 7 years ago)
- Last Synced: 2025-03-08T09:35:31.433Z (3 months ago)
- Topics: nested-data, nested-dicts
- Language: Python
- Homepage: https://chrisantonellis.github.io/delimited/
- Size: 12.8 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Delimited
[](https://img.shields.io/travis/USER/REPO.svg)
[](https://coveralls.io/github/chrisantonellis/delimited)
[](https://pypi.python.org/pypi/delimited/)
Delimited defines classes that allow for accessing and modifying nested data.
## Installation
```
pip install delimited
```## Documentation
[https://chrisantonellis.github.io/delimited/](https://chrisantonellis.github.io/delimited/)
## Abstract
**Nested data** can be easily expressed in python but not easily accessed or modified. Using builtin methods, accessing nested data requires chaining `dict.get()` calls.
``` python
mydict = {
"key1": {
"key2": {
"key3": "value"
}
}
}mydict.get("key1", {}).get("key2", {}).get("key3", {})
```
This is overly verbose and lacks the functionality needed to effectively interact with the data. Delimited provides classes that emulate native types and make accessing and modifying nested data easier.``` python
from delimited import DelimitedDict as ddict
mydict = ddict({
"key1": {
"key2": {
"key3": "value"
}
}
})mydict.get("key1.key2.key3")
# returns "value"
mydict.collapse()
# returns {"key1.key2.key3": "value"}
```Delimited provides `Path` classes to represent paths to nested data using tuples or strings, and `NestedContainer` classes that emulate the native `dict` type. Check out the [documentation](https://chrisantonellis.github.io/delimited/) to learn more.