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/13 21:03:04 UTC
[tinkerpop] branch TINKERPOP-2279 updated: 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
The following commit(s) were added to refs/heads/TINKERPOP-2279 by this push:
new 317ad54 Cleaned up enum derser for python graphbinary a bit further
317ad54 is described below
commit 317ad548dd99c8a0d2d28b75fb8168796cdc488b
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):