parameters: ()
docstring: Context in which imported modules are saved.
  
      Translates exceptions internal to the context into the equivalent exception
      outside the context.
docstring_summary: Context in which imported modules are saved.
docstring_tokens: Context in which imported modules are saved .
function: def save_modules():
      """
      Context in which imported modules are saved.
  
      Translates exceptions internal to the context into the equivalent exception
      outside the context.
      """
      saved = sys.modules.copy()
      with ExceptionSaver() as saved_exc:
          yield saved
  
      sys.modules.update(saved)
      # remove any modules imported since
      del_modules = (
          mod_name for mod_name in sys.modules
          if mod_name not in saved
          # exclude any encodings modules. See #285
          and not mod_name.startswith('encodings.')
      )
      _clear_modules(del_modules)
  
      saved_exc.resume()
function_tokens: def save_modules ( ) : saved = sys . modules . copy ( ) with ExceptionSaver ( ) as saved_exc : yield saved sys . modules . update ( saved ) # remove any modules imported since del_modules = ( mod_name for mod_name in sys . modules if mod_name not in saved # exclude any encodings modules. See #285 and not mod_name . startswith ( 'encodings.' ) ) _clear_modules ( del_modules ) saved_exc . resume ( )