Created
August 27, 2020 06:28
-
-
Save ch-yx/31bd4cca8a4259246d046e0275ab5c90 to your computer and use it in GitHub Desktop.
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
class ignore(): | |
def __init__(s,*e): | |
s.e=e | |
def __enter__(s): | |
pass | |
def __exit__(s,c,e,t): | |
try: | |
raise e | |
except s.e: | |
return 1 | |
except: | |
return 0 | |
def __call__(s,f): | |
import functools | |
@functools.wraps(f) | |
def _f(*x,**y): | |
with s: | |
return f(*x,**y) | |
return _f | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment