Processing nested data structure with ease
from sympath import Sympath
a = {
"nested": {
"key1": "Captain",
"key2": "Picard"
}
}
b = {
"nested": {
"key1": "Venetian",
"key2": "Trobones",
"key3": "Really"
}
}
sydestructure = Sympath().nested.select(name="key1", last_name="key2")
sydestructure(a)
>>> {"name": "Captain", "last_name": "Picard"}
sydestructure(b)
>>> {"name": "Venetian", "last_name": "Trombone"}
sysdestructure({})
>>> None
- Install
poetry
if you don't have it:pipx install poetry
. - Clone this repo, go into the repo's folder.
- Install the dependencies with
poetry install
and spawn a shell in your new virtual environment withpoetry shell
. - To run tests type
pytest
.
Philipp Kessling under the MIT license, 2022.