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/09/04 13:22:49 UTC

[tinkerpop] 39/40: Factor away varargs in as_bytes in GraphBinary for python

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 0667219b9cd0b5090a3085eaff394a04602b9e9d
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Mon Aug 26 13:38:14 2019 -0400

    Factor away varargs in as_bytes in GraphBinary for python
---
 .../main/jython/gremlin_python/structure/io/graphbinaryV1.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 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 bec5d94..c287fe0 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
@@ -193,17 +193,17 @@ class _GraphBinaryTypeIO(object):
                  "filter_": "filter", "id_": "id", "max_": "max", "min_": "min", "sum_": "sum"}
 
     @classmethod
-    def as_bytes(cls, graphbin_type, as_value=False, nullable=True, *args):
+    def as_bytes(cls, graphbin_type, as_value=False, nullable=True, bytes_to_write=bytes()):
         ba = bytearray() if as_value else bytearray([graphbin_type.value])
 
         if nullable:
             ba.extend(struct.pack(">b", 0))
 
-        for arg in args:
-            if isinstance(arg, (bytes, bytearray)):
-                ba.extend(arg)
-            else:
-                raise Exception("MISSING")
+        if isinstance(bytes_to_write, (bytes, bytearray)):
+            ba.extend(bytes_to_write)
+        else:
+            raise Exception("MISSING")
+
         return ba
 
     @classmethod