Example #1
0
def Load(filename):
    try:
        with open(filename, 'r') as handle:
            schemas = json_parse.Parse(handle.read())
        return schemas
    except:
        print('FAILED: Exception encountered while loading "%s"' % filename)
        raise
 def Load(self):
     """Loads and parses the source from each input file and puts the result in
 self._json."""
     for f in self._source_files:
         abs_source_file = os.path.join(self._chrome_root, f)
         try:
             with open(abs_source_file, 'r') as f:
                 f_json = json_parse.Parse(f.read())
         except:
             print('FAILED: Exception encountered while loading "%s"' %
                   abs_source_file)
             raise
         dupes = set(f_json) & set(self._json)
         assert not dupes, 'Duplicate keys found: %s' % list(dupes)
         self._json.update(f_json)
Example #3
0
 def _GetNamespace(self, fake_content, filename, is_idl):
   """Returns a namespace object for the given content"""
   api_def = (idl_schema.Process(fake_content, filename) if is_idl
       else json_parse.Parse(fake_content))
   m = model.Model()
   return m.AddNamespace(api_def[0], filename)
Example #4
0
def Load(filename):
  with open(filename, 'r') as handle:
    schemas = json_parse.Parse(handle.read())
  return schemas
Example #5
0
def Load(filename):
    with open(filename, 'r') as handle:
        schemas = json_parse.Parse(handle.read())
    schema_util.PrefixSchemasWithNamespace(schemas)
    return schemas