A simple wrapper around contextlib.suppress
Project description
Suppres
Decorator to ignore exceptions. A simple wrapper around contextlib.suppress.
Install
pip install suppress
Usage
import asyncio
from suppress import suppress
@suppress(ZeroDivisionError)
def zero_division_error_function():
return 1 / 0
@suppress(ZeroDivisionError)
async def zero_division_error_async_function():
return 1 / 0
async def main():
zero_division_error_function()
print('First print')
await zero_division_error_async_function()
print('Second print')
if __name__ == '__main__':
asyncio.run(main())
Output:
First print
Second print
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
suppress-0.2.0.tar.gz
(2.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file suppress-0.2.0.tar.gz.
File metadata
- Download URL: suppress-0.2.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc74f87a8f5a43ba868cbd2c8d2a57bfcb9b07043df8cd93c7adb69c88ad65f3
|
|
| MD5 |
fb379461723519f6ebcefc89d7a78644
|
|
| BLAKE2b-256 |
736de41416d28f13a16f361b201091ffa9da2851706104bddbaa55183bd6aaa6
|
File details
Details for the file suppress-0.2.0-py2.py3-none-any.whl.
File metadata
- Download URL: suppress-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3ab9df397c6a801d8c7eb4ff5ad8b38a1c0f5c0610bf9768d6b2f61c12477bc
|
|
| MD5 |
6479c920afc3cd3e40956afaad4c21b8
|
|
| BLAKE2b-256 |
7ab566d8b47e99fa6d932cf9e998f5cb03be101b0da4217d4ef270174757db93
|