melano
melano is JSON utility library
features
dict compare
>>> from melano import diff
>>> x, y = dict(x=1, y=2), dict(x=2, z=1)
>>> diff.compare(x, y)
[{'field': 'x', 'x': 1, 'type': 'MISMATCH', 'y': 2, 'message': 'x: 1 (int) != 2 (int)'}, {'field': 'y', 'x': 2, 'type': 'MISSING', 'message': 'y: not found'}, {'field': 'z', 'y': 1, 'type': 'MISSING', 'message': 'z: not found'}]
list of dict operations
sort
>>> from melano import sort
>>> items = [dict(x=1, y=5), dict(x=4, y=2), dict(x=2, y=3), dict(x=1, y=2)]
>>> sort(items, 'x', 'y')
[{'x': 1, 'y': 2}, {'x': 1, 'y': 5}, {'x': 2, 'y': 3}, {'x': 4, 'y': 2}]
group by
>>> from melano import group_by
>>> items = [dict(x=1, y=5, z=5), dict(x=4, y=2, z=3), dict(x=4, y=2, z=10)]
>>> group_by(items, 'x', 'y')
[{'x': 1, 'y': 5, 'items': [{'x': 1, 'y': 5, 'z': 5}]}, {'x': 4, 'y': 2, 'items': [{'x': 4, 'y': 2, 'z': 3}, {'x': 4, 'y': 2, 'z': 10}]}]
count
>>> from melano import count
>>> items = [dict(x=1, y=5, z=5), dict(x=4, y=2, z=3), dict(x=4, y=2, z=10)]
>>> count(items, 'x', 'y')
[{'x': 1, 'y': 5, 'count': 1}, {'x': 4, 'y': 2, 'count': 2}]
Metadata
Release files for melano 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| melano-0.1.0.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| melano-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / melano-0.1.0.tar.gz
| Download URL | melano-0.1.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e25e764d676b0236f8d4c0cebc286257a811377cf55c9873824dac3066afe443
|
|
BLAKE2b-256 checksum How to use checksums |
2c707474c6268d8b2c3aafdf4ff240e9f2a2da1b87bb215ffe13cfee10c2c7ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.2 Windows/10
|
Release files / melano-0.1.0-py3-none-any.whl
| Download URL | melano-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c2ac579be0f69f0ca8609361a37f14d196a925d1ca42172f9f77637a556f20b
|
|
BLAKE2b-256 checksum How to use checksums |
7621a3be91e65b3b9da86f0587a62c574f7f80b7446a2bde4354491d531ebbd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.2 Windows/10
|