This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch TINKERPOP-2279 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 3c48dac742e66628633fb628f2e4a4066006bda7 Author: Stephen Mallette <[email protected]> AuthorDate: Tue Aug 13 17:02:31 2019 -0400 Cleaned up enum derser for python graphbinary a bit further --- .../src/main/jython/gremlin_python/structure/io/graphbinaryV1.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py index d9844e9..5261952 100644 --- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py +++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py @@ -595,12 +595,17 @@ class _EnumIO(_GraphBinaryTypeIO): @classmethod def dictify(cls, obj, writer, as_value=False, nullable=True): ba = bytearray() - ba.extend(cls.string_as_bytes(cls.unmangleKeyword(str(obj.name)))) + ba.extend(StringIO.dictify(cls.unmangleKeyword(str(obj.name)), writer)) return cls.as_bytes(cls.write_as_value(cls.graphbinary_type, as_value), None, nullable, ba) @classmethod def objectify(cls, buff, reader, nullable=True): - return cls.is_null(buff, reader, lambda b, r: cls.python_type[cls.read_string(b)], nullable) + return cls.is_null(buff, reader, cls._read_enumval, nullable) + + @classmethod + def _read_enumval(cls, b, r): + enum_name = r.toObject(b) + return cls.python_type[enum_name] class BarrierIO(_EnumIO):
