Data walker (in dot notation style) & filter (Xpath analog) for yaml look data structure
Project description
YamlWalker introduction
Provide comfortable interface for operate yaml data
Containing 2 main features:
YQuery
YDict
YQuery
Allow querying of Yaml file in Xpath/XQuery
look alike style
Comfortable when path sub elements not pre-defined
YDict
Allow operate yaml data with dot notation style with extension to Ypath list items by property value Suitable when path to desired sub element are static or well known
Installation
From PIP
[Link to PYPI] (https://pypi.org/project/yaml_walker/)
pip.exe install YamlWalker
From GitHub
[Lint to GiHub] (https://github.com/doguz2509/YamlWalker)
Usage
file.yaml
---
node:
nd_1:
data:
- id: 0
name: node1
type: str
value: any value
- id: 2
name: node2
type: str
value: any str
sub_data:
item: any
value: four
python
import yaml
from yaml_walker import api
with open(file.yaml) as fr:
yaml_data = yaml.load(fr)
# YDict example
yaml_dict = api.YDict(yaml_data)
yaml_result = yaml_dict.node.hd_1.data['id>0']
# YQuery example
y_query = api.YQuery('yaml_data.node.hd_1.data[id>0]')
yaml_result = y_query(yaml_data)
shell script
python -m yaml_walker 'yaml_data.node.hd_1.data[id>0]' file.yaml
Result in all cases:
{
id: 2
name: node2
type: str
value: any str
sub_data:
item: any
value: four
}
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
yaml_walker-1.0.21.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for yaml_walker-1.0.21-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3517e43fb71f1ecb47464cabc5ce2a9f07bec1ba32cfa111a9b7d59fa9a3df9e |
|
MD5 | 2fe321510dd9f8b1ee7acd673926d2af |
|
BLAKE2b-256 | c81e715787e542f3603ebdc45e3dbed8f1953e1214d419afdd3564709e0d4253 |