You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/08/19 13:37:32 UTC

[tinkerpop] 28/33: Cleaned up enum derser for python graphbinary a bit further

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 221c2a41a931852f7b59080d14d03395cf2adf25
Author: Stephen Mallette <sp...@genoprime.com>
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):