basic-return


Namebasic-return JSON
Version 0.1.0.10 PyPI version JSON
download
home_pagehttps://github.com/henriquelino/basic_return
Summary
upload_time2022-12-13 20:44:05
maintainer
docs_urlNone
authorhenrique lino
requires_python>=3.9,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # basic-return

> Manage function returns with a generic class

[![PyPI version][pypi-image]][pypi-url]
[![Build status][build-image]][build-url]
[![GitHub stars][stars-image]][stars-url]
[![Support Python versions][versions-image]][versions-url]



## Getting started

You can [get `basic-return` from PyPI](https://pypi.org/project/basic-return),
which means it's easily installable with `pip`:

```bash
python -m pip install basic-return
```


## Example usage

```python

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](https://github.com/henriquelino/basic_return/blob/main/CHANGELOG.md) file.



<!-- Badges -->

[pypi-image]: https://img.shields.io/pypi/v/basic-return
[pypi-url]: https://pypi.org/project/basic-return/

[build-image]: https://github.com/henriquelino/basic_return/actions/workflows/build.yaml/badge.svg
[build-url]: https://github.com/henriquelino/basic_return/actions/workflows/build.yaml

[stars-image]: https://img.shields.io/github/stars/henriquelino/basic_return
[stars-url]: https://github.com/henriquelino/basic_return

[versions-image]: https://img.shields.io/pypi/pyversions/basic_return
[versions-url]: https://pypi.org/project/basic_return/


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/henriquelino/basic_return",
    "name": "basic-return",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "henrique lino",
    "author_email": "henrique.lino97@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/09/6d/bbbb460bbc847a12b9b8822c240071b06aef32c5f6d3cf0937f9fc95fcaf/basic_return-0.1.0.10.tar.gz",
    "platform": null,
    "description": "# basic-return\n\n> Manage function returns with a generic class\n\n[![PyPI version][pypi-image]][pypi-url]\n[![Build status][build-image]][build-url]\n[![GitHub stars][stars-image]][stars-url]\n[![Support Python versions][versions-image]][versions-url]\n\n\n\n## Getting started\n\nYou can [get `basic-return` from PyPI](https://pypi.org/project/basic-return),\nwhich means it's easily installable with `pip`:\n\n```bash\npython -m pip install basic-return\n```\n\n\n## Example usage\n\n```python\n\nfrom basic_return.BasicReturn import BasicReturn\ndef function(a, b, c=30, d=50):\n    br = BasicReturn()\n\n    if a < 10:\n        br.status = 10\n        br.message = \"param a is less than 10\"\n        br.payload = {\"something\": 123456789}\n        return br\n\n    if b > 20:\n        br.status = -10\n        br.message = \"param b is bigger than 20\"\n        return br\n\n    br.status = 20\n    br.message = \"param a is less than 10\"\n    return br\n\nbr = function(10, 20, d=40)\nif br.status < 0:\n    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\n    raise Exception(f\"Something bad happens: [{br.status}] - {br.message}\")\n\n\n```\n\n\n\n## Changelog\n\nRefer to the [CHANGELOG.md](https://github.com/henriquelino/basic_return/blob/main/CHANGELOG.md) file.\n\n\n\n<!-- Badges -->\n\n[pypi-image]: https://img.shields.io/pypi/v/basic-return\n[pypi-url]: https://pypi.org/project/basic-return/\n\n[build-image]: https://github.com/henriquelino/basic_return/actions/workflows/build.yaml/badge.svg\n[build-url]: https://github.com/henriquelino/basic_return/actions/workflows/build.yaml\n\n[stars-image]: https://img.shields.io/github/stars/henriquelino/basic_return\n[stars-url]: https://github.com/henriquelino/basic_return\n\n[versions-image]: https://img.shields.io/pypi/pyversions/basic_return\n[versions-url]: https://pypi.org/project/basic_return/\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "",
    "version": "0.1.0.10",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "a75117267ff7eaf273cb5bd79c23e0bc",
                "sha256": "990adbccab6b8fe8ec46bc4533e5e91478c782aab03eb719dded3d3a84fa9938"
            },
            "downloads": -1,
            "filename": "basic_return-0.1.0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a75117267ff7eaf273cb5bd79c23e0bc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 4877,
            "upload_time": "2022-12-13T20:44:03",
            "upload_time_iso_8601": "2022-12-13T20:44:03.725592Z",
            "url": "https://files.pythonhosted.org/packages/69/79/ab1375476a9227899be94e079f15452e5f7ca19d99ea51d24a2932a64503/basic_return-0.1.0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "bfdbd849cf1f2a864da28fce94ecaafa",
                "sha256": "4de77498e5bde5e7f4179b1dc3185ac9358b06cf6a8d325706bf891bdccef3f6"
            },
            "downloads": -1,
            "filename": "basic_return-0.1.0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "bfdbd849cf1f2a864da28fce94ecaafa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 4590,
            "upload_time": "2022-12-13T20:44:05",
            "upload_time_iso_8601": "2022-12-13T20:44:05.121806Z",
            "url": "https://files.pythonhosted.org/packages/09/6d/bbbb460bbc847a12b9b8822c240071b06aef32c5f6d3cf0937f9fc95fcaf/basic_return-0.1.0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-13 20:44:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "henriquelino",
    "github_project": "basic_return",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "basic-return"
}
        
Elapsed time: 0.03863s