small lib for inflate and compress dict using double underscore or proccess string using the format double undescore
how to used with dict
import chibi_donkey as donkey
example = {
'a': {
'aa': {
'aaa': 'aaa',
'aab': 'aab',
'aac': 'aac'
},
'ab': 'ab',
'ac': None,
},
'b': {
'ba': [ 1, 2, 3 ],
'bb': 'bb',
'bc': None,
}
}
example_compress= {
'a__aa__aaa': 'aaa',
'a__aa__aab': 'aab',
'a__aa__aac': 'aac',
'a__ab': 'ab',
'a__ac': None,
'b__ba': [ 1, 2, 3 ],
'b__bb': 'bb',
'b__bc': None,
}
assert donkey.compress( example ) == example_compress
assert donkey.inflate( example_compress ) == example
assert donkey.get( 'a__aa__aaa', example ) == 'aaa'
assert donkey.get( 'a__ba', example ) == [ 1, 2, 3 ]
donkey.setter( 'a__aa__aaa', example, 'asdf' )
assert donkey.get( 'a__aa__aaa', example ) == 'asdf'
how to use with strings
import chibi_donkey as donkey
assert donkey.init( 'a__b__c' ) == 'a'
assert donkey.last( 'a__b__c' ) == 'c'
assert donkey.key( 'a', 'b', 'c' ) == 'a__b__c'
assert donkey.partition( 'a__b__c' ) == [ 'a', 'b', 'c' ]
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chibi_donkey-1.0.2.tar.gz
(3.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
File details
Details for the file chibi_donkey-1.0.2.tar.gz.
File metadata
- Download URL: chibi_donkey-1.0.2.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/1.14.0 pkginfo/1.11.1 requests/2.32.3 setuptools/69.0.3 requests-toolbelt/1.0.0 tqdm/4.66.5 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39b5c196480119e05432ccfa500225d26ebd910db1725d0b7d9ffd0870142f09
|
|
| MD5 |
6903a7a7a0413fc8996b58850c0e2a61
|
|
| BLAKE2b-256 |
8a1bbc2ee32c4680b05054444c75162525058e522ec1c6df7c4f8eaaa5d025e7
|
File details
Details for the file chibi_donkey-1.0.2-py2.py3-none-any.whl.
File metadata
- Download URL: chibi_donkey-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/1.14.0 pkginfo/1.11.1 requests/2.32.3 setuptools/69.0.3 requests-toolbelt/1.0.0 tqdm/4.66.5 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b714d75ecfb55c3eea20f8cf28ef7ba18fdcc87585552415462eb05400de0448
|
|
| MD5 |
16e75d508d59e5027104feb0e81875b1
|
|
| BLAKE2b-256 |
849ad1c97d887fbfda3556730541dff0853cb2cb142c42cf673b8b351f26a6bf
|