#NEWLINE# def __enter__( self ) : #NEWLINE# #INDENT# if self . _paths_to_add : #NEWLINE# #INDENT# os . environ [ 'PATH' ] = ( '%s%s%s' % ( os . environ [ 'PATH' ] , os . pathsep , os . pathsep . join ( env . _paths_to_add ) ) ) #NEWLINE# #UNINDENT# if self . _cmds_to_remove : #NEWLINE# #INDENT# for cmd in self . _cmds_to_remove : #NEWLINE# #INDENT# self . _paths_to_remove . extend ( which ( cmd ) ) #NEWLINE# #UNINDENT# #UNINDENT# if self . _paths_to_remove : #NEWLINE# #INDENT# env = os . environ [ 'PATH' ] . split ( os . pathsep ) #NEWLINE# os . environ [ 'PATH' ] = os . pathsep . join ( [ p for p in env if ( p not in self . _paths_to_remove ) ] )