def ignore_warnings(obj=None, category=Warning):
 if callable(obj):
  return _IgnoreWarnings(category=category)(obj)
 else:
  return _IgnoreWarnings(category=category)

def ignore_warnings ( obj = None , category = Warning ) : if callable ( obj ) : return _IgnoreWarnings ( category = category ) ( obj ) else : return _IgnoreWarnings ( category = category )
context manager and decorator to ignore warnings .