(self, params)
Initializes Config. This is a separate method as it raises an exception
    if there is a parse error.
Initializes Config. This is a separate method as it raises an exception
    if there is a parse error.
Initializes Config . This is a separate method as it raises an exception if there is a parse error .
def Init(self, params):
    """Initializes Config. This is a separate method as it raises an exception
    if there is a parse error."""
    generator_flags = params.get('generator_flags', {})
    config_path = generator_flags.get('config_path', None)
    if not config_path:
      return
    try:
      f = open(config_path, 'r')
      config = json.load(f)
      f.close()
    except IOError:
      raise Exception('Unable to open file ' + config_path)
    except ValueError as e:
      raise Exception('Unable to parse config file ' + config_path + str(e))
    if not isinstance(config, dict):
      raise Exception('config_path must be a JSON file containing a dictionary')
    self.files = config.get('files', [])
    self.targets = set(config.get('targets', []))
def Init ( self , params ) : generator_flags = params . get ( 'generator_flags' , { } ) config_path = generator_flags . get ( 'config_path' , None ) if not config_path : return try : f = open ( config_path , 'r' ) config = json . load ( f ) f . close ( ) except IOError : raise Exception ( 'Unable to open file ' + config_path ) except ValueError as e : raise Exception ( 'Unable to parse config file ' + config_path + str ( e ) ) if not isinstance ( config , dict ) : raise Exception ( 'config_path must be a JSON file containing a dictionary' ) self . files = config . get ( 'files' , [ ] ) self . targets = set ( config . get ( 'targets' , [ ] ) )