pyschema_extensions/avro.py
def from_json_compatible(schema, dct):
    "Load from json-encodable"
    kwargs = {}

    for key in dct:
        field_type = schema._fields.get(key)
        if field_type is None:
            warnings.warn("Unexpected field encountered in line for record %s: %r" % (schema.__name__, key))
            continue
        kwargs[key] = field_type.avro_load(dct[key])

    return schema(**kwargs)
def from_json_compatible(schema, dct):
    "Load from json-encodable"
    kwargs = {}

    for key in dct:
        field_type = schema._fields.get(key)
        if field_type is None:
            warnings.warn("Unexpected field encountered in line for record %s: %r" % (schema.__name__, key))
            continue
        kwargs[key] = field_type.avro_load(dct[key])

    return schema(**kwargs)
def from_json_compatible ( schema , dct ) : kwargs = { } for key in dct : field_type = schema . _fields . get ( key ) if field_type is None : warnings . warn ( "Unexpected field encountered in line for record %s: %r" % ( schema . __name__ , key ) ) continue kwargs [ key ] = field_type . avro_load ( dct [ key ] ) return schema ( * * kwargs )
Load from json-encodable
Load from json - encodable