Created
September 8, 2021 14:46
-
-
Save DBoyara/3b895d0e19bab51ee48e0617a3d9d342 to your computer and use it in GitHub Desktop.
Python Simple Async-Decorator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import wraps | |
| def dec(fn): | |
| @wraps(fn) | |
| async def wrapper(*args, **kwargs): | |
| print(fn.__name__, args, kwargs) | |
| await asyncio.sleep(5) | |
| await fn(*args, **kwargs) | |
| return wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment