Python Dynamic DSL for data access and manipulation
Project description
PynDD(Python Dynamic DSL)
from pyndd.parser import parse, translate
a = {'b': ...}
print(parse('a:#b', a=a) == a['b']) # True
a = {'b': [ ... ], 'c': [ ... ]}
print(parse('a:#b:[..]', a=a) == a['b']) # True
print(parse('a:#b:[1..3]', a=a) == a['b'][1:3]) # True
print(parse('a:[#b]', a=a) == [item['b'] for item in a]) # True
print(parse('a:3:[#b]', a=a) == a[3]['b']) # True
translate('a:#b < 2')
print(a['b'] == 2) # True
c = {'d': [ ... ]}
translate('a:[#b] < c:[#d]', a=a, c=c)
print(all([item_a['b'] == item_c['d'] for item_a, item_c in zip(a, c)])) # True
b = [ ... ]
d = {'e': [ ... ]}
translate('a:#b:[#c] < d:[#e]')
all([item_a['b']['c'] == item_d['e'] for item_a, item_d in zip(a, d)]) # True
print(parse('a:b', b=b) == [a[item] for item in b]) # True
translate('a:[#b] < b', a=a, b=b)
print([item['b'] for item in a] == b) # True
print(parse('a:[2..4]:[1..4]', a=a) == [item[1:4] for item in a[2:4]]) # True
e = {'abc': [ ... ], 'aabdc': [ ... ], 'acb': [ ... ]}
print(parse('e:*ab*c*', e=e) == {key: e[key] for key in ('abc', 'aabdc')}) # True
print(parse('e:*ab*c*:[1..3]', e=e) == {key: e[key][1:3] for key in ('abc', 'aabdc')}) # True
f = [ ... ]
translate('e:*ab*c* < f', e=e)
print(f == {key: e[key] for key in ('abc', 'aabdc')}) # True
translate('e:*ab*c*:[1..3] < f', e=e)
print(f == {key: e[key][1:3] for key in ('abc', 'aabdc')}) # True
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyndd-0.1.0.tar.gz
(3.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pyndd-0.1.0-py3-none-any.whl
(4.1 kB
view details)
File details
Details for the file pyndd-0.1.0.tar.gz.
File metadata
- Download URL: pyndd-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a76e6584731ccca258f8869775a233d9fe606c8d6e020f09724101676d1ac0b
|
|
| MD5 |
c5154a2f8170d8ac0cf356464d655c69
|
|
| BLAKE2b-256 |
38bae7c720345a2473c9795d0421023f4abb86eba7f599428ccd35cc9e867cb2
|
File details
Details for the file pyndd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyndd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a691f898ec3aaafc2a00e0bd24a2613c5f54f5a4c70036e1d510a9788a6648d
|
|
| MD5 |
ed60ccb6a6b45a13e18177a8d87aef8b
|
|
| BLAKE2b-256 |
8baface471ebc29802c1956ccea9e7aa818a90e6398156afd29f8b597938ba4c
|