#NEWLINE# @ contextmanager #NEWLINE# def env_vars( **variables ) : #NEWLINE# #INDENT# orig = dict ( os . environ ) #NEWLINE# for ( name , value ) in dict ( variables ) . items ( ) : #NEWLINE# #INDENT# if ( value is None ) : #NEWLINE# #INDENT# os . environ . pop ( name , 0 ) #NEWLINE# del variables [ name ] #NEWLINE# #UNINDENT# #UNINDENT# os . environ . update ( variables ) #NEWLINE# try : #NEWLINE# #INDENT# ( yield ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# os . environ . clear ( ) #NEWLINE# os . environ . update ( orig )