@contextlib.contextmanager
def check_warnings(*filters, **kwargs):
 quiet = kwargs.get('quiet')
 if (not filters):
  filters = (('', Warning),)
  if (quiet is None):
   quiet = True
 return _filterwarnings(filters, quiet)

@ contextlib . contextmanager def check_warnings ( * filters , ** kwargs ) : quiet = kwargs . get ( 'quiet' ) if ( not filters ) : filters = ( ( '' , Warning ) , ) if ( quiet is None ) : quiet = True return _filterwarnings ( filters , quiet )
context manager to silence warnings .