Skip to main content

basic-return

Manage function returns with a generic class

PyPI version Build status GitHub stars Support Python versions

Getting started

You can get basic-return from PyPI, which means it's easily installable with pip:

python -m pip install basic-return

Example usage

from basic_return.BasicReturn import BasicReturn
def function(a, b, c=30, d=50):
    br = BasicReturn()

    if a < 10:
        br.status = 10
        br.message = "param a is less than 10"
        br.payload = {"something": 123456789}
        return br

    if b > 20:
        br.status = -10
        br.message = "param b is bigger than 20"
        return br

    br.status = 20
    br.message = "param a is less than 10"
    return br

br = function(10, 20, d=40)
if br.status < 0:
    print(br.owner_call)  # function(a=10, b=20, c=30, d=40); this is how the function was called so we can replicate the error
    raise Exception(f"Something bad happens: [{br.status}] - {br.message}")

Changelog

Refer to the CHANGELOG.md file.

Metadata

Release files for basic-return 0.1.0.11

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

Source distribution (sdist)

Source distribution for basic-return 0.1.0.11
File Size Uploaded Provenance
basic_return-0.1.0.11.tar.gz 5.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for basic-return 0.1.0.11
File Interpreter ABI Platform
basic_return-0.1.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / basic_return-0.1.0.11.tar.gz

Download URL basic_return-0.1.0.11.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c6393c881a573e40a6653d329aa6cc8529037cb1288f1a6bb50dee4bd6397121
BLAKE2b-256 checksum
How to use checksums
bb7cd29836208e32683d40658b8eb69bb2e39048b2313583c0fefff2b5c3b87a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.2 Linux/5.15.0-1033-azure

Release files / basic_return-0.1.0.11-py3-none-any.whl

Download URL basic_return-0.1.0.11-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61b92a85fe8be4f73f71e07a76a1d1d782ceb73aa951a404f36aa5ece52a440b
BLAKE2b-256 checksum
How to use checksums
b5e1bb806083bc62abc947c4ebd7c21d922cb2dbd5e8d100f187017c27c76b26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.2 Linux/5.15.0-1033-azure

Security for basic-return 0.1.0.11

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.

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