def speed_avrolight_read(): gc.disable() schema, value = SCHEMAS_TO_VALIDATE[-1] parsed_schema = avrolight.Schema(json.loads(schema)) buffer = io.BytesIO() avrolight.write(parsed_schema, buffer, value) for _ in timeit("avrolight, reading"): avrolight.read(parsed_schema, buffer.getvalue())
def test_read(): import avro.schema for schema, value in SCHEMAS_TO_VALIDATE: bytes = avro_write_datum(value, avro.schema.Parse(schema)) schema = json.loads(schema) assert_that(avrolight.read(schema, bytes), equal_to(value))
def deserialize(client, message): fp = io.BytesIO(message) schema = client.get(fp.read(32)) return avrolight.read(schema, fp)