parameters: (mode=0o600)
docstring: Context manager that can be use to modify a config object
  
      On exit of the context manager, the config will be written back to disk, 
      by default with 600 permissions.
docstring_summary: Context manager that can be use to modify a config object
docstring_tokens: Context manager that can be use to modify a config object
function: def persist_config(mode=0o600):
      """Context manager that can be use to modify a config object
  
      On exit of the context manager, the config will be written back to disk, 
      by default with 600 permissions.
      """
  
      loader = JSONFileConfigLoader('jupyter_notebook_config.json', jupyter_config_dir())
      try:
          config = loader.load_config()
      except ConfigFileNotFound:
          config = Config()
  
      yield config
  
      filepath = os.path.join(jupyter_config_dir(), 'jupyter_notebook_config.json')
      with io.open(filepath, 'w') as f:
          f.write(six.u(json.dumps(config, indent=2)))
      try:
          os.chmod(filepath, mode)
      except Exception:
          traceback.print_exc()
  
          print("Something went wrong changing file permissions")
function_tokens: def persist_config ( mode = 0o600 ) : loader = JSONFileConfigLoader ( 'jupyter_notebook_config.json' , jupyter_config_dir ( ) ) try : config = loader . load_config ( ) except ConfigFileNotFound : config = Config ( ) yield config filepath = os . path . join ( jupyter_config_dir ( ) , 'jupyter_notebook_config.json' ) with io . open ( filepath , 'w' ) as f : f . write ( six . u ( json . dumps ( config , indent = 2 ) ) ) try : os . chmod ( filepath , mode ) except Exception : traceback . print_exc ( ) print ( "Something went wrong changing file permissions" )