tools/json_schema_compiler/idl_schema.py
def cast_from_json_type(self, json_type, string_value):
    '''Casts from string |string_value| to a real Python type based on a JSON
    Schema type |json_type|. For example, a string value of '42' and a JSON
    Schema type 'integer' will cast to int('42') ==> 42.
    '''
    if json_type == 'integer':
      return int(string_value)
    if json_type == 'number':
      return float(string_value)
    # Add more as necessary.
    assert json_type == 'string', (
           'No rule exists to cast JSON Schema type "%s" to its equivalent '
           'Python type for value "%s". You must add a new rule here.' %
           (json_type, string_value))
    return string_value
Casts from string |string_value| to a real Python type based on a JSON
    Schema type |json_type|. For example, a string value of '42' and a JSON
    Schema type 'integer' will cast to int('42') ==> 42.
    
Casts from string |string_value| to a real Python type based on a JSON
Schema type |json_type|.
Casts from string |string_value| to a real Python type based on a JSON Schema type |json_type| .
def cast_from_json_type(self, json_type, string_value):
    if json_type == 'integer':
      return int(string_value)
    if json_type == 'number':
      return float(string_value)
    assert json_type == 'string', (
           'No rule exists to cast JSON Schema type "%s" to its equivalent '
           'Python type for value "%s". You must add a new rule here.' %
           (json_type, string_value))
    return string_value
def cast_from_json_type ( self , json_type , string_value ) : if json_type == 'integer' : return int ( string_value ) if json_type == 'number' : return float ( string_value ) assert json_type == 'string' , ( 'No rule exists to cast JSON Schema type "%s" to its equivalent ' 'Python type for value "%s". You must add a new rule here.' % ( json_type , string_value ) ) return string_value
Casts from string |string_value| to a real Python type based on a JSON
Schema type |json_type|.
Casts from string |string_value| to a real Python type based on a JSON Schema type |json_type| .
'''Casts from string |string_value| to a real Python type based on a JSON
    Schema type |json_type|. For example, a string value of '42' and a JSON
    Schema type 'integer' will cast to int('42') ==> 42.
    ''' # Add more as necessary.
self
json_type
string_value