Skip to content

Commit

Permalink
Remove types-related code
Browse files Browse the repository at this point in the history
We're using pickling at the moment
  • Loading branch information
Flavien Raynaud committed Mar 27, 2018
1 parent a22c6b0 commit a5e7870
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions pyavro_rs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,33 +95,7 @@ def __new__(cls, schema_str):
)


def avro_null(_):
pass


def avro_boolean(b):
pass


def avro_long(n):
pass


def avro_double(x):
pass


class Writer(RustObject):
__types__ = {
NoneType: avro_null,
bool: avro_boolean,
int: avro_long,
float: avro_double,
list: 'list',
set: 'list',
dict: 'map',
}

def __new__(cls, schema, codec=CODEC_NULL):
return cls._from_objptr(
rustcall(
Expand All @@ -132,15 +106,6 @@ def __new__(cls, schema, codec=CODEC_NULL):
)

def append(self, datum):
avro_type = self.__types__.get(type(datum))
if avro_type is None:
raise AvroError(
err=1,
message='datum type {} not supported'.format(type(datum)),
)

avro_value = avro_type(datum)

pickled = dumps(datum)
buf = rustcall(lib.avro_byte_array_from_c_array, pickled, len(pickled))
return self._methodcall(lib.avro_writer_append, ffi.addressof(buf))
Expand Down

0 comments on commit a5e7870

Please sign in to comment.