Library for transform data structures
Project description
HTL - Library for transform data structures
Example
from htl.htl import linear_to_hierarchical, hierarchical_to_linear
linear = [
{'name': 'Lorem', 'parent': None},
{'name': 'ipsum', 'parent': 'Lorem'},
{'name': 'dolor', 'parent': 'ipsum'},
{'name': 'sit', 'parent': 'dolor'},
{'name': 'amet', 'parent': 'ipsum'},
{'name': 'consectetur', 'parent': 'Lorem'},
{'name': 'adipisicing', 'parent': 'consectetur'}
]
hierarchical = linear_to_hierarchical(linear)
"""
hierarchical:
{
'name': 'Lorem',
'children': [
{
'name': 'ipsum',
'children': [
{
'name': 'dolor',
'children': [
{
'name': 'sit'
}
]
},
{
'name': 'amet'
}
]
},
{
'name': 'consectetur',
'children': [
{
'name': 'adipisicing'
}
]
}
]
}
"""
# To reverse conversion, use function hierarchical_to_linear
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
htl-1.0.0.tar.gz
(2.6 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
htl-1.0.0-py3-none-any.whl
(3.8 kB
view details)
File details
Details for the file htl-1.0.0.tar.gz.
File metadata
- Download URL: htl-1.0.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1bce6b371d11f45fc7efba76e440b0c57a207927af1240ed50813ece5aa0ea5
|
|
| MD5 |
35e16d0113066ccb87e91976ae473023
|
|
| BLAKE2b-256 |
e933f1ce0237e33aa4c167821c32945fc3d42985cb989c17c74cbb4d6ff87d14
|
File details
Details for the file htl-1.0.0-py3-none-any.whl.
File metadata
- Download URL: htl-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcfce49013ce61228dae4979875bb444ec241a7f00af04e8ea49861943099389
|
|
| MD5 |
b4bb4ea85515f89d0c5e598a2b5b29b2
|
|
| BLAKE2b-256 |
db82d38b7304eed0929f181cca2e990f957b3c4066ad786ced8852182b620a00
|