No project description provided
Project description
basic-return
Manage function returns with a generic class
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
basic_return-0.1.0.11.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file basic_return-0.1.0.11.tar.gz
.
File metadata
- Download URL: basic_return-0.1.0.11.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.2 Linux/5.15.0-1033-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6393c881a573e40a6653d329aa6cc8529037cb1288f1a6bb50dee4bd6397121 |
|
MD5 | 1d5d1504fdbadf19daa54f6d18f76d95 |
|
BLAKE2b-256 | bb7cd29836208e32683d40658b8eb69bb2e39048b2313583c0fefff2b5c3b87a |
File details
Details for the file basic_return-0.1.0.11-py3-none-any.whl
.
File metadata
- Download URL: basic_return-0.1.0.11-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.2 Linux/5.15.0-1033-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61b92a85fe8be4f73f71e07a76a1d1d782ceb73aa951a404f36aa5ece52a440b |
|
MD5 | 27e67eef2969bba81731af04d48c3c00 |
|
BLAKE2b-256 | b5e1bb806083bc62abc947c4ebd7c21d922cb2dbd5e8d100f187017c27c76b26 |