tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject tinkerpop git commit: crazy, I thought I didn't need addSpawnStep in Python translator -- but I do. Thus, Translator in Java and Python are identical.
Date Wed, 15 Jun 2016 19:09:19 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1278 db3ee9636 -> a0533e262


crazy, I thought I didn't need addSpawnStep in Python translator -- but I do. Thus, Translator
in Java and Python are identical.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a0533e26
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a0533e26
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a0533e26

Branch: refs/heads/TINKERPOP-1278
Commit: a0533e26275c652d09a7e639badee499b6d6d644
Parents: db3ee96
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Wed Jun 15 13:09:16 2016 -0600
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Wed Jun 15 13:09:16 2016 -0600

----------------------------------------------------------------------
 .../gremlin/python/GremlinPythonGenerator.groovy        |  2 +-
 .../src/main/jython/gremlin_python/gremlin_python.py    |  8 ++++----
 .../src/main/jython/gremlin_python/groovy_translator.py | 12 ++++++++----
 .../src/main/jython/gremlin_python/translator.py        |  4 ++++
 4 files changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a0533e26/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/python/GremlinPythonGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/python/GremlinPythonGenerator.groovy
b/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/python/GremlinPythonGenerator.groovy
index 26ea1bb..ea18da8 100644
--- a/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/python/GremlinPythonGenerator.groovy
+++ b/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/python/GremlinPythonGenerator.groovy
@@ -120,7 +120,7 @@ class B(object):
                     pythonClass.append(
                             """  def ${method}(self, *args):
     traversal = PythonGraphTraversal(self.translator, self.remote_connection)
-    traversal.translator.addStep(traversal, "${method}", *args)
+    traversal.translator.addSpawnStep(traversal, "${method}", *args)
     return traversal
 """)
                 } else if (TraversalSource.isAssignableFrom(returnType)) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a0533e26/gremlin-variant/src/main/jython/gremlin_python/gremlin_python.py
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/jython/gremlin_python/gremlin_python.py b/gremlin-variant/src/main/jython/gremlin_python/gremlin_python.py
index da54ebd..bc716a8 100644
--- a/gremlin-variant/src/main/jython/gremlin_python/gremlin_python.py
+++ b/gremlin-variant/src/main/jython/gremlin_python/gremlin_python.py
@@ -48,19 +48,19 @@ class PythonGraphTraversalSource(object):
       return "graphtraversalsource[" + str(self.remote_connection) + ", " + self.translator.traversal_script
+ "]"
   def E(self, *args):
     traversal = PythonGraphTraversal(self.translator, self.remote_connection)
-    traversal.translator.addStep(traversal, "E", *args)
+    traversal.translator.addSpawnStep(traversal, "E", *args)
     return traversal
   def V(self, *args):
     traversal = PythonGraphTraversal(self.translator, self.remote_connection)
-    traversal.translator.addStep(traversal, "V", *args)
+    traversal.translator.addSpawnStep(traversal, "V", *args)
     return traversal
   def addV(self, *args):
     traversal = PythonGraphTraversal(self.translator, self.remote_connection)
-    traversal.translator.addStep(traversal, "addV", *args)
+    traversal.translator.addSpawnStep(traversal, "addV", *args)
     return traversal
   def inject(self, *args):
     traversal = PythonGraphTraversal(self.translator, self.remote_connection)
-    traversal.translator.addStep(traversal, "inject", *args)
+    traversal.translator.addSpawnStep(traversal, "inject", *args)
     return traversal
   def withBulk(self, *args):
     source = PythonGraphTraversalSource(self.translator, self.remote_connection)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a0533e26/gremlin-variant/src/main/jython/gremlin_python/groovy_translator.py
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/jython/gremlin_python/groovy_translator.py b/gremlin-variant/src/main/jython/gremlin_python/groovy_translator.py
index 660fa5d..24d7690 100644
--- a/gremlin-variant/src/main/jython/gremlin_python/groovy_translator.py
+++ b/gremlin-variant/src/main/jython/gremlin_python/groovy_translator.py
@@ -36,11 +36,15 @@ class GroovyTranslator(Translator):
         Translator.__init__(self, alias, script_engine)
 
     def addStep(self, traversal, step_name, *args):
-        newTraversal = GroovyTranslator(self.alias, self.script_engine)
-        newTraversal.traversal_script = self.traversal_script
-        newTraversal.traversal_script = newTraversal.traversal_script + "." + GroovyTranslator.mapMethod(
+        self.traversal_script = self.traversal_script + "." + GroovyTranslator.mapMethod(
             step_name) + "(" + GroovyTranslator.stringify(*args) + ")"
-        traversal.translator = newTraversal
+
+    def addSpawnStep(self, traversal, step_name, *args):
+        newTranslator = GroovyTranslator(self.alias, self.script_engine)
+        newTranslator.traversal_script = self.traversal_script
+        newTranslator.traversal_script = newTranslator.traversal_script + "." + GroovyTranslator.mapMethod(
+            step_name) + "(" + GroovyTranslator.stringify(*args) + ")"
+        traversal.translator = newTranslator
 
     def addSource(self, traversal_source, source_name, *args):
         newTranslator = GroovyTranslator(self.alias, self.script_engine)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a0533e26/gremlin-variant/src/main/jython/gremlin_python/translator.py
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/jython/gremlin_python/translator.py b/gremlin-variant/src/main/jython/gremlin_python/translator.py
index 089701e..9a90176 100644
--- a/gremlin-variant/src/main/jython/gremlin_python/translator.py
+++ b/gremlin-variant/src/main/jython/gremlin_python/translator.py
@@ -32,6 +32,10 @@ class Translator(object):
         return
 
     @abstractmethod
+    def addSpawnStep(self, traversal, step_name, *args):
+        return
+
+    @abstractmethod
     def addSource(self, traversal_source, source_name, *args):
         return
 


Mime
View raw message