Skip to main content

Library for advanced continuous handling of anything

Project description

Pyhandling

Library for advanced continuous handling of anything

Provides tools to extend single call logic on a nearly unlimited scale
You can even integrate the entire program logic into one call

Installation

pip install pyhandling

Usage examples

Basic example

from functools import partial
from typing import Callable

from random import randint

from pyhandling import *


main: dirty[Callable[[int], str]] = showly(
    on_condition(
        lambda number: not 0 <= number <= 10,
        (
            "Input number must be positive and less than 11 but it is {}".format
            |then>> ValueError
            |then>> raise_
        ),
        else_=return_
    )
    |then>> mergely(take(execute_operation), return_, take('<<'), return_)
    |then>> mergely(
        take("{number} is {comparison_word} than 255".format),
        number=return_,
        comparison_word=lambda numebr: 'less' if numebr < 255 else 'more'
    )
)

if __name__ == '__main__':
    main(randint(-5, 10))

output

4
4
64
64 is less than 255

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

Pyhandling-2.0.0.tar.gz (34.1 kB view hashes)

Uploaded Source

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