Skip to main content

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}]

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

melano-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

melano-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file melano-0.1.0.tar.gz.

File metadata

  • Download URL: melano-0.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.2 Windows/10

File hashes

Hashes for melano-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e25e764d676b0236f8d4c0cebc286257a811377cf55c9873824dac3066afe443
MD5 d5803b68da4583b48761a05c3d1a7a96
BLAKE2b-256 2c707474c6268d8b2c3aafdf4ff240e9f2a2da1b87bb215ffe13cfee10c2c7ac

See more details on using hashes here.

File details

Details for the file melano-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: melano-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.2 Windows/10

File hashes

Hashes for melano-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c2ac579be0f69f0ca8609361a37f14d196a925d1ca42172f9f77637a556f20b
MD5 fbd3d653dc1650ee5e350e2e3e9113ad
BLAKE2b-256 7621a3be91e65b3b9da86f0587a62c574f7f80b7446a2bde4354491d531ebbd7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page