semvec/pypi-packages huggingface dataset:
sampleproject-evan860126-1 2.0.1
A sample Python project
Requires Python: >=3.6, <4
Keywords: sample,setuptools,development

# A sample Python project

![Python Logo](https://www.python.org/static/community_logos/python-logo.png "Sample inline image")

A sample project that exists as an aid to the [Python Packaging User
Guide][packaging guide]'s [Tutorial on Packaging and Distributing
Projects][distribution tutorial].

This project does not aim to cover best practices for Python project
development as a whole. For example, it does not provide guidance or tool
recommendations for version control, documentation, or testing.

[The source for this project is available here][src].

Most of the configuration for a Python project is done in the `setup.py` file,
an example of which is included in this project. You should edit this file
accordingly to adapt this sample project to your needs.

----

This is the README file for the project.

The file should use UTF-8 encoding and can be written using
[reStructuredText][rst] or [markdown][md use] with the appropriate [key set][md
use]. It will be used to generate the project webpage on PyPI and will be
displayed as the project homepage on common code-hosting services, and should be
written for that purpose.

Typical contents for this file would include an overview of the project, basic
usage examples, etc. Generally, including the project changelog in here is not a
good idea, although a simple “What's New” section for the most recent version
may be appropriate.

[packaging guide]: https://packaging.python.org
[distribution tutorial]: https://packaging.python.org/tutorials/packaging-projects/
[src]: https://github.com/pypa/sampleproject
[rst]: http://docutils.sourceforge.net/rst.html
[md]: https://tools.ietf.org/html/rfc7764#section-3.5 "CommonMark variant"
[md use]: https://packaging.python.org/specifications/core-metadata/#description-content-type-optional
noraise 0.0.16
noraise
Requires Python: >=3.4

# noraise

![PyPI - package version](https://img.shields.io/pypi/v/noraise?logo=pypi&style=flat-square)
![PyPI - license](https://img.shields.io/pypi/l/noraise?label=package%20license&style=flat-square)
![PyPI - python version](https://img.shields.io/pypi/pyversions/noraise?logo=pypi&style=flat-square)
![PyPI - downloads](https://img.shields.io/pypi/dm/noraise?logo=pypi&style=flat-square)

![GitHub - last commit](https://img.shields.io/github/last-commit/kkristof200/py_noraise?style=flat-square)
![GitHub - commit activity](https://img.shields.io/github/commit-activity/m/kkristof200/py_noraise?style=flat-square)

![GitHub - code size in bytes](https://img.shields.io/github/languages/code-size/kkristof200/py_noraise?style=flat-square)
![GitHub - repo size](https://img.shields.io/github/repo-size/kkristof200/py_noraise?style=flat-square)
![GitHub - lines of code](https://img.shields.io/tokei/lines/github/kkristof200/py_noraise?style=flat-square)

![GitHub - license](https://img.shields.io/github/license/kkristof200/py_noraise?label=repo%20license&style=flat-square)

## Description

Lightweight utility package, that provides a function decorator to easily catch and print exceptions

## Supported Args

| name                 | type                      | default value | description                                                                     |
|----------------------|---------------------------|---------------|---------------------------------------------------------------------------------|
| print_exc            | bool                      | True          | If True, prints stacktrace                                                      |
| return_exception     | bool                      | False         | If True, returns caught exception                                               |
| default_return_value | Optional[any]             | None          | What to return upon caught exception if<br>'return_exception' is False          |
| ignored_error_types  | Optional[List[Exception]] | None          | In which cases should the stacktrace print<br>be skipped if 'print_exc' is True |

## Install

~~~~bash
pip install noraise
# or
pip3 install noraise
~~~~

## Usage

~~~~python
from noraise import noraise

@noraise(print_exc=True, return_exception=True, ignored_error_types=[ZeroDivisionError])
def f2():
    return 1/0

res = f2()
print(type(res), res)

# This will not catch the crash, and print
# 
# 
# < ------------------------------------- Caught with @noraise ------------------------------------ >
#
# Traceback (most recent call last):
#   File "/Users/kristofk/github/py_noraise/noraise/noraise.py", line 32, in wrapper
#     return function(*args, **kwargs)
#   File "demo.py", line 5, in f2
#     return 1/0
# ZeroDivisionError: division by zero
# 
# < ----------------------------------------------------------------------------------------------- >
# 
# 
# <class 'ZeroDivisionError'> division by zero
~~~~

## Dependencies