#NEWLINE# def _collect_warnings( observe_warning , f , * args , **kwargs ) : #NEWLINE# #INDENT# def show_warning( message , category , filename , lineno , file = None , line = None ) : #NEWLINE# #INDENT# assert isinstance ( message , Warning ) #NEWLINE# observe_warning ( _Warning ( message . args [ 0 ] , category , filename , lineno ) ) #NEWLINE# #UNINDENT# for v in sys . modules . values ( ) : #NEWLINE# #INDENT# if ( v is not None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# v . __warningregistry__ = None #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# orig_filters = warnings . filters [ : ] #NEWLINE# orig_show = warnings . showwarning #NEWLINE# warnings . simplefilter ( 'always' ) #NEWLINE# try : #NEWLINE# #INDENT# warnings . showwarning = show_warning #NEWLINE# result = f ( * args , ** kwargs ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# warnings . filters [ : ] = orig_filters #NEWLINE# warnings . showwarning = observe_warning #NEWLINE# #UNINDENT# return result