Skip to main content

Useful utilities for Python

Project description

🍧 snowcone

Code style: black Python CI PyPI - Downloads PyPi version

Set of useful utilities for Python inspired by other libraries and languages

Requirements

  • Python 3.6 or newer

🛠 Installation

To install the package, run the following command from a terminal:

$   pip install snowcone

🚀 Usage

JavaScript style arrays

Manipulate Python lists using a more object-oriented style JavaScript array syntax:

from snowcone.containers import Array

array = [
    [
        {"category": "A", "value": 0},
        {"category": "A", "value": 2},
        {"category": "A", "value": 4},
    ],
    [
        {"category": "B", "value": 7},
        {"category": "B", "value": 3},
        {"category": "B", "value": 9},
    ]
]

values = (
    Array(array)
        .flatten()
        .filter(lambda x: x["category"] == "A")
        .map(lambda x: x["value"] * 5)
        .all()
)
print(values)
>>> [0, 10, 20, 35, 15, 45]

📚 Documentation

Documentation can be built using the command make docs, which uses the Makefile and the make binary.

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

snowcone-0.3.0.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

snowcone-0.3.0-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page