#NEWLINE# def change_flags( **kwargs ) : #NEWLINE# #INDENT# '\n    Use this as a decorator to change the value of Theano config variable.\n\n    Useful during tests.\n    ' #NEWLINE# def change_flags_exec( f ) : #NEWLINE# #INDENT# def inner( * args , **kwargs_ ) : #NEWLINE# #INDENT# old_val = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for k in kwargs : #NEWLINE# #INDENT# l = [ v for v in theano . configparser . _config_var_list if ( v . fullname == k ) ] #NEWLINE# assert ( len ( l ) == 1 ) #NEWLINE# old_val [ k ] = l [ 0 ] . __get__ ( True , None ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# for k in kwargs : #NEWLINE# #INDENT# l = [ v for v in theano . configparser . _config_var_list if ( v . fullname == k ) ] #NEWLINE# assert ( len ( l ) == 1 ) #NEWLINE# l [ 0 ] . __set__ ( None , kwargs [ k ] ) #NEWLINE# #UNINDENT# return f ( * args , ** kwargs_ ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# for k in kwargs : #NEWLINE# #INDENT# l = [ v for v in theano . configparser . _config_var_list if ( v . fullname == k ) ] #NEWLINE# assert ( len ( l ) == 1 ) #NEWLINE# l [ 0 ] . __set__ ( None , old_val [ k ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# inner . __name__ = f . __name__ #NEWLINE# return inner #NEWLINE# #UNINDENT# return kwargs