tools/json_schema_compiler/cpp_bundle_generator.py
def _PrefixSchemaWithNamespace(schema):
  """Modifies |schema| in place to prefix all types and references with a
  namespace, if they aren't already qualified. That is, in the tabs API, this
  will turn type Tab into tabs.Tab, but will leave the fully-qualified
  windows.Window as-is.
  """
  assert isinstance(schema, dict), "Schema is unexpected type"
  namespace = schema['namespace']
  def prefix(obj, key, mandatory):
    if not key in obj:
      assert not mandatory, (
             'Required key "%s" is not present in object.' % key)
      return
    assert type(obj[key]) is str or (sys.version_info.major == 2 and
                                     isinstance(obj[key], basestring))
    if obj[key].find('.') == -1:
      obj[key] = '%s.%s' % (namespace, obj[key])

  if 'types' in schema:
    assert isinstance(schema['types'], list)
    for t in schema['types']:
      assert isinstance(t, dict), "Type entry is unexpected type"
      prefix(t, 'id', True)
      prefix(t, 'customBindings', False)

  def prefix_refs(val):
    if type(val) is list:
      for sub_val in val:
        prefix_refs(sub_val)
    elif type(val) is dict or type(val) is collections.OrderedDict:
      prefix(val, '$ref', False)
      for key, sub_val in val.items():
        prefix_refs(sub_val)
  prefix_refs(schema)
  return schema
Modifies |schema| in place to prefix all types and references with a
  namespace, if they aren't already qualified. That is, in the tabs API, this
  will turn type Tab into tabs.Tab, but will leave the fully-qualified
  windows.Window as-is.
  
Modifies |schema| in place to prefix all types and references with a
namespace, if they aren't already qualified. That is, in the tabs API, this
will turn type Tab into tabs.Tab, but will leave the fully-qualified
windows.Window as-is.
Modifies |schema| in place to prefix all types and references with a namespace if they aren ' t already qualified . That is in the tabs API this will turn type Tab into tabs . Tab but will leave the fully - qualified windows . Window as - is .
def _PrefixSchemaWithNamespace(schema):
  assert isinstance(schema, dict), "Schema is unexpected type"
  namespace = schema['namespace']
  def prefix(obj, key, mandatory):
    if not key in obj:
      assert not mandatory, (
             'Required key "%s" is not present in object.' % key)
      return
    assert type(obj[key]) is str or (sys.version_info.major == 2 and
                                     isinstance(obj[key], basestring))
    if obj[key].find('.') == -1:
      obj[key] = '%s.%s' % (namespace, obj[key])
  if 'types' in schema:
    assert isinstance(schema['types'], list)
    for t in schema['types']:
      assert isinstance(t, dict), "Type entry is unexpected type"
      prefix(t, 'id', True)
      prefix(t, 'customBindings', False)
  def prefix_refs(val):
    if type(val) is list:
      for sub_val in val:
        prefix_refs(sub_val)
    elif type(val) is dict or type(val) is collections.OrderedDict:
      prefix(val, '$ref', False)
      for key, sub_val in val.items():
        prefix_refs(sub_val)
  prefix_refs(schema)
  return schema
def _PrefixSchemaWithNamespace ( schema ) : assert isinstance ( schema , dict ) , "Schema is unexpected type" namespace = schema [ 'namespace' ] def prefix ( obj , key , mandatory ) : if not key in obj : assert not mandatory , ( 'Required key "%s" is not present in object.' % key ) return assert type ( obj [ key ] ) is str or ( sys . version_info . major == 2 and isinstance ( obj [ key ] , basestring ) ) if obj [ key ] . find ( '.' ) == - 1 : obj [ key ] = '%s.%s' % ( namespace , obj [ key ] ) if 'types' in schema : assert isinstance ( schema [ 'types' ] , list ) for t in schema [ 'types' ] : assert isinstance ( t , dict ) , "Type entry is unexpected type" prefix ( t , 'id' , True ) prefix ( t , 'customBindings' , False ) def prefix_refs ( val ) : if type ( val ) is list : for sub_val in val : prefix_refs ( sub_val ) elif type ( val ) is dict or type ( val ) is collections . OrderedDict : prefix ( val , '$ref' , False ) for key , sub_val in val . items ( ) : prefix_refs ( sub_val ) prefix_refs ( schema ) return schema
Modifies |schema| in place to prefix all types and references with a
namespace, if they aren't already qualified.
Modifies |schema| in place to prefix all types and references with a namespace if they aren ' t already qualified .
"""Modifies |schema| in place to prefix all types and references with a
  namespace, if they aren't already qualified. That is, in the tabs API, this
  will turn type Tab into tabs.Tab, but will leave the fully-qualified
  windows.Window as-is.
  """
schema