Skip to main content

pituo

Go-styled errors in Python.

Installation

Using pip: pip install -U pituo

Usage

Import the function pituo from the package:

from pituo import pituo

Using decorator syntax

@pituo
def divide(dividend, divisor):
    """
    Return the result of the division between dividend and divisor.
    May raise a ZeroDivisionError if divisor is 0.
    """
    return dividend / divisor

quotient, err = divide(1, 0)

if err is not None:
    print(err)          # Prints "division by zero"
else:
    print(quotient)

Wrapping the function

def divide(dividend, divisor):
    """
    Return the result of the division between dividend and divisor.
    May raise a ZeroDivisionError if divisor is 0.
    """
    return dividend / divisor

divide = pituo(divide)

quotient, err = divide(4, 1)

if err is not None:
    print(err)
else:
    print(quotient)     # Prints 4

For more examples, see the tests folder.

License

This project is licensed under the MIT license.

Metadata

Release files for pituo 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pituo 0.0.2
File Size Uploaded Provenance Actions
pituo-0.0.2.tar.gz 1.8 kB Without provenance Details for pituo-0.0.2.tar.gz

Release files / pituo-0.0.2.tar.gz

Download URL pituo-0.0.2.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
18fac7d8c69fcf4552a5d0238a9e5f6131bd1858924d0973d54ccbbfd5513d87
BLAKE2b-256 checksum
How to use checksums
d28ff4ff0a7879e03034d5a215517169b27207237c9da0cf95c1be9c1e47aa6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.6.4

Security for pituo 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page