(self, file_path, writable=False)
Initialize a BaseConfig for the DependencyManager.

    Args:
        writable: False: This config will be used to lookup information.
                  True: This config will be used to update information.

        file_path: Path to a file containing a json dictionary in the expected
                   json format for this config class. Base format expected:

                   { "config_type": config_type,
                     "dependencies": dependencies_dict }

                   config_type: must match the return value of GetConfigType.
                   dependencies: A dictionary with the information needed to
                       create dependency_info instances for the given
                       dependencies.

                   See dependency_info.py for more information.
Initialize a BaseConfig for the DependencyManager.
Initialize a BaseConfig for the DependencyManager .
def __init__(self, file_path, writable=False):
    """ Initialize a BaseConfig for the DependencyManager.

    Args:
        writable: False: This config will be used to lookup information.
                  True: This config will be used to update information.

        file_path: Path to a file containing a json dictionary in the expected
                   json format for this config class. Base format expected:

                   { "config_type": config_type,
                     "dependencies": dependencies_dict }

                   config_type: must match the return value of GetConfigType.
                   dependencies: A dictionary with the information needed to
                       create dependency_info instances for the given
                       dependencies.

                   See dependency_info.py for more information.
    """
    self._config_path = file_path
    self._writable = writable
    self._pending_uploads = []
    if not self._config_path:
      raise ValueError('Must supply config file path.')
    if not os.path.exists(self._config_path):
      if not writable:
        raise exceptions.EmptyConfigError(file_path)
      self._config_data = {}
      self._WriteConfigToFile(self._config_path, dependencies=self._config_data)
    else:
      with open(file_path, 'r') as f:
        config_data = json.load(f)
      if not config_data:
        raise exceptions.EmptyConfigError(file_path)
      config_type = config_data.pop('config_type', None)
      if config_type != self.GetConfigType():
        raise ValueError(
            'Supplied config_type (%s) is not the expected type (%s) in file '
            '%s' % (config_type, self.GetConfigType(), file_path))
      self._config_data = config_data.get('dependencies', {})
def __init__ ( self , file_path , writable = False ) : self . _config_path = file_path self . _writable = writable self . _pending_uploads = [ ] if not self . _config_path : raise ValueError ( 'Must supply config file path.' ) if not os . path . exists ( self . _config_path ) : if not writable : raise exceptions . EmptyConfigError ( file_path ) self . _config_data = { } self . _WriteConfigToFile ( self . _config_path , dependencies = self . _config_data ) else : with open ( file_path , 'r' ) as f : config_data = json . load ( f ) if not config_data : raise exceptions . EmptyConfigError ( file_path ) config_type = config_data . pop ( 'config_type' , None ) if config_type != self . GetConfigType ( ) : raise ValueError ( 'Supplied config_type (%s) is not the expected type (%s) in file ' '%s' % ( config_type , self . GetConfigType ( ) , file_path ) ) self . _config_data = config_data . get ( 'dependencies' , { } )