Skip to content

Instantly share code, notes, and snippets.

@ch-yx
Created August 27, 2020 06:28
Show Gist options
  • Save ch-yx/31bd4cca8a4259246d046e0275ab5c90 to your computer and use it in GitHub Desktop.
Save ch-yx/31bd4cca8a4259246d046e0275ab5c90 to your computer and use it in GitHub Desktop.
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