You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/08/23 17:37:37 UTC

[1/2] tinkerpop git commit: Cleanup of Python code in groovy traversal generator

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1278 1cdf2d9a3 -> d25e29b41


Cleanup of Python code in groovy traversal generator


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

Branch: refs/heads/TINKERPOP-1278
Commit: e1a558dd79f70848df73149dc8a369c7d3ea02b0
Parents: e6f4cfd
Author: davebshow <da...@gmail.com>
Authored: Tue Aug 23 12:00:53 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Tue Aug 23 12:00:53 2016 -0400

----------------------------------------------------------------------
 .../gremlin/python/TraversalSourceGenerator.groovy      | 12 +++++-------
 .../src/main/jython/gremlin_python/process/traversal.py | 10 ++++------
 2 files changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e1a558dd/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
index 4bab256..742c609 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
@@ -53,7 +53,8 @@ specific language governing permissions and limitations
 under the License.
 '''
 """)
-        pythonClass.append("from abc import abstractmethod\n")
+        pythonClass.append("import abc\n")
+        pythonClass.append("import six\n")
         pythonClass.append("from aenum import Enum\n")
         pythonClass.append("from .. import statics\n")
 
@@ -189,17 +190,16 @@ class TraversalStrategies(object):
     global_cache = {}
     def __init__(self, traversal_strategies=None):
         self.traversal_strategies = traversal_strategies.traversal_strategies if traversal_strategies is not None else []
-        return
     def add_strategies(self, traversal_strategies):
         self.traversal_strategies = self.traversal_strategies + traversal_strategies
     def apply_strategies(self, traversal):
         for traversal_strategy in self.traversal_strategies:
             traversal_strategy.apply(traversal)
-        return
 
 
+@six.add_metaclass(abc.ABCMeta)
 class TraversalStrategy(object):
-    @abstractmethod
+    @abc.abstractmethod
     def apply(self, traversal):
         return
 
@@ -220,13 +220,11 @@ class Bytecode(object):
         for arg in args:
             instruction.append(self.__convertArgument(arg))
         self.source_instructions.append(instruction)
-        return
     def add_step(self, step_name, *args):
         instruction = [step_name]
         for arg in args:
             instruction.append(self.__convertArgument(arg))
         self.step_instructions.append(instruction)
-        return
     def __convertArgument(self,arg):
         if isinstance(arg, Traversal):
             self.bindings.update(arg.bytecode.bindings)
@@ -264,4 +262,4 @@ class Binding(object):
         file.delete()
         pythonClass.eachLine { file.append(it + "\n") }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e1a558dd/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
index 4aa8e4d..2531efb 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -16,7 +16,8 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 '''
-from abc import abstractmethod
+import abc
+import six
 from aenum import Enum
 from .. import statics
 
@@ -247,17 +248,16 @@ class TraversalStrategies(object):
     global_cache = {}
     def __init__(self, traversal_strategies=None):
         self.traversal_strategies = traversal_strategies.traversal_strategies if traversal_strategies is not None else []
-        return
     def add_strategies(self, traversal_strategies):
         self.traversal_strategies = self.traversal_strategies + traversal_strategies
     def apply_strategies(self, traversal):
         for traversal_strategy in self.traversal_strategies:
             traversal_strategy.apply(traversal)
-        return
 
 
+@six.add_metaclass(abc.ABCMeta)
 class TraversalStrategy(object):
-    @abstractmethod
+    @abc.abstractmethod
     def apply(self, traversal):
         return
 
@@ -278,13 +278,11 @@ class Bytecode(object):
         for arg in args:
             instruction.append(self.__convertArgument(arg))
         self.source_instructions.append(instruction)
-        return
     def add_step(self, step_name, *args):
         instruction = [step_name]
         for arg in args:
             instruction.append(self.__convertArgument(arg))
         self.step_instructions.append(instruction)
-        return
     def __convertArgument(self,arg):
         if isinstance(arg, Traversal):
             self.bindings.update(arg.bytecode.bindings)


[2/2] tinkerpop git commit: Merge branch 'cleanup_python_traversal_generator' of https://github.com/davebshow/tinkerpop into TINKERPOP-1278

Posted by ok...@apache.org.
Merge branch 'cleanup_python_traversal_generator' of https://github.com/davebshow/tinkerpop into TINKERPOP-1278


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

Branch: refs/heads/TINKERPOP-1278
Commit: d25e29b418ca9a0bfe2ebdfa6e6b1006523dec75
Parents: 1cdf2d9 e1a558d
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Aug 23 11:37:27 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Aug 23 11:37:27 2016 -0600

----------------------------------------------------------------------
 .../gremlin/python/TraversalSourceGenerator.groovy      | 12 +++++-------
 .../src/main/jython/gremlin_python/process/traversal.py | 10 ++++------
 2 files changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------