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/05/31 22:23:03 UTC

incubator-tinkerpop git commit: lots of code cleanup. The pattern is there and various tests pass.. the problem is just having to copy all the methods over from GraphTravesal. We really need Groovy instospection on interface methods and this will all be

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1278 be4a54eef -> 750486375


lots of code cleanup. The pattern is there and various tests pass.. the problem is just having to copy all the methods over from GraphTravesal. We really need Groovy instospection on interface methods and this will all be ALOT easier.


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

Branch: refs/heads/TINKERPOP-1278
Commit: 7504863750d5f9d25d0f1da8170d50a01a2b2791
Parents: be4a54e
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue May 31 16:22:54 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue May 31 16:22:54 2016 -0600

----------------------------------------------------------------------
 .../gremlin/process/ProcessStandardSuite.java   |   6 +-
 .../variant/JavaVariantGraphTraversal.groovy    | 112 -------------
 .../variant/VariantGraphTraversal.groovy        | 112 +++++++++++++
 .../python/GremlinPythonGenerator.groovy        | 159 ++++++++++++++++++
 .../python/GremlinPythonGenerator.groovy        | 161 -------------------
 .../process/variant/JavaVariantConverter.java   |  28 ----
 .../JavaVariantGraphTraversalSource.java        |  50 ------
 .../process/variant/VariantConverter.java       |  28 ++++
 .../variant/VariantGraphTraversalSource.java    |  50 ++++++
 .../variant/python/PythonVariantConverter.java  |  12 +-
 .../tinkerpop/gremlin/python/GremlinPython.java |  28 ----
 .../process/variant/VariantGraphProvider.java   |  31 +---
 .../process/variant/python/PythonProvider.java  |   4 +-
 pom.xml                                         |   1 +
 14 files changed, 361 insertions(+), 421 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
index 52e24a0..ccfb1ef 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
@@ -24,8 +24,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.BranchTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.ChooseTest;
-import org.apache.tinkerpop.gremlin.process.traversal.step.branch.OptionalTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.LocalTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.branch.OptionalTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.RepeatTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.UnionTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.AndTest;
@@ -106,7 +106,7 @@ public class ProcessStandardSuite extends AbstractGremlinSuite {
      */
     private static final Class<?>[] allTests = new Class<?>[]{
             // branch
-            /*BranchTest.Traversals.class,
+            BranchTest.Traversals.class,
             ChooseTest.Traversals.class,
             OptionalTest.Traversals.class,
             LocalTest.Traversals.class,
@@ -153,7 +153,7 @@ public class ProcessStandardSuite extends AbstractGremlinSuite {
             ProfileTest.Traversals.class,
             ProjectTest.Traversals.class,
             PropertiesTest.Traversals.class,
-            SelectTest.Traversals.class,*/
+            SelectTest.Traversals.class,
             VertexTest.Traversals.class,
             UnfoldTest.Traversals.class,
             ValueMapTest.Traversals.class,

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/JavaVariantGraphTraversal.groovy
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/JavaVariantGraphTraversal.groovy b/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/JavaVariantGraphTraversal.groovy
deleted file mode 100644
index 363e005..0000000
--- a/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/JavaVariantGraphTraversal.groovy
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.process.variant
-
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
-import org.apache.tinkerpop.gremlin.process.traversal.util.ScriptTraversal
-import org.apache.tinkerpop.gremlin.python.GremlinPythonGenerator
-import org.apache.tinkerpop.gremlin.structure.Edge
-import org.apache.tinkerpop.gremlin.structure.Graph
-import org.apache.tinkerpop.gremlin.structure.Vertex
-
-import javax.script.ScriptEngine
-import javax.script.ScriptEngineManager
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class JavaVariantGraphTraversal<S, E> extends DefaultGraphTraversal<S, E> {
-
-    protected String variantString;
-    protected JavaVariantConverter variantConverter;
-
-    public JavaVariantGraphTraversal(
-            final Graph graph, final String start, final JavaVariantConverter variantConverter) {
-        super(graph);
-        this.variantConverter = variantConverter;
-        this.variantString = start;
-    }
-
-
-    public GraphTraversal<S, Edge> bothE(final String... edgeLabels) {
-        this.variantString = this.variantString + this.variantConverter.step("bothE", edgeLabels);
-        return this;
-    }
-
-    public GraphTraversal<S, Edge> outE(final String... edgeLabels) {
-        this.variantString = this.variantString + this.variantConverter.step("outE", edgeLabels);
-        return this;
-    }
-
-    public GraphTraversal<S, Vertex> inV() {
-        this.variantString = this.variantString + this.variantConverter.step("inV");
-        return this;
-    }
-
-    public GraphTraversal<S, Vertex> otherV() {
-        this.variantString = this.variantString + this.variantConverter.step("otherV");
-        return this;
-    }
-
-    public GraphTraversal<S, Vertex> both(final String... edgeLabels) {
-        this.variantString = this.variantString + this.variantConverter.step("both", edgeLabels);
-        return this;
-    }
-
-    public GraphTraversal<S, Vertex> out(final String... edgeLabels) {
-        this.variantString = this.variantString + this.variantConverter.step("out", edgeLabels);
-        return this;
-    }
-
-    public GraphTraversal<S, Vertex> inE(final String... edgeLabels) {
-        this.variantString = this.variantString + this.variantConverter.step("inE", edgeLabels);
-        return this;
-    }
-
-    public GraphTraversal<S, E> values(final String... propertyNames) {
-        this.variantString = this.variantString + this.variantConverter.step("values", propertyNames);
-        return this;
-    }
-
-
-    @Override
-    public void applyStrategies() {
-        if (!this.locked) {
-            try {
-                GremlinPythonGenerator.create("/tmp");
-                ScriptEngine engine = new ScriptEngineManager().getEngineByName("jython");
-                engine.eval("execfile(\"/tmp/gremlin-python-3.2.1-SNAPSHOT.py\")");
-                engine.eval("g = PythonGraphTraversalSource(\"ws://localhost:8182/\", \"g\")");
-                System.out.println(this.variantString + "!!!!!!!!");
-                final ScriptTraversal<?, ?> traversal = new ScriptTraversal(new GraphTraversalSource(this.getGraph().get(), this.getStrategies()), "gremlin-groovy", engine.eval(this.variantString).toString());
-                traversal.applyStrategies();
-                traversal.getSideEffects().mergeInto(this.sideEffects);
-                traversal.getSteps().forEach { step -> this.addStep(step) };
-            } catch (final Exception e) {
-                throw new IllegalArgumentException(e.getMessage(), e);
-            }
-        }
-        super.applyStrategies();
-    }
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversal.groovy
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversal.groovy b/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversal.groovy
new file mode 100644
index 0000000..8d1890b
--- /dev/null
+++ b/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversal.groovy
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.process.variant
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
+import org.apache.tinkerpop.gremlin.process.traversal.util.ScriptTraversal
+import org.apache.tinkerpop.gremlin.process.variant.python.GremlinPythonGenerator
+import org.apache.tinkerpop.gremlin.structure.Edge
+import org.apache.tinkerpop.gremlin.structure.Graph
+import org.apache.tinkerpop.gremlin.structure.Vertex
+
+import javax.script.ScriptEngine
+import javax.script.ScriptEngineManager
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class VariantGraphTraversal<S, E> extends DefaultGraphTraversal<S, E> {
+
+    protected String variantString;
+    protected VariantConverter variantConverter;
+
+    public VariantGraphTraversal(
+            final Graph graph, final String start, final VariantConverter variantConverter) {
+        super(graph);
+        this.variantConverter = variantConverter;
+        this.variantString = start;
+    }
+
+
+    public GraphTraversal<S, Edge> bothE(final String... edgeLabels) {
+        this.variantString = this.variantString + this.variantConverter.step("bothE", edgeLabels);
+        return this;
+    }
+
+    public GraphTraversal<S, Edge> outE(final String... edgeLabels) {
+        this.variantString = this.variantString + this.variantConverter.step("outE", edgeLabels);
+        return this;
+    }
+
+    public GraphTraversal<S, Vertex> inV() {
+        this.variantString = this.variantString + this.variantConverter.step("inV");
+        return this;
+    }
+
+    public GraphTraversal<S, Vertex> otherV() {
+        this.variantString = this.variantString + this.variantConverter.step("otherV");
+        return this;
+    }
+
+    public GraphTraversal<S, Vertex> both(final String... edgeLabels) {
+        this.variantString = this.variantString + this.variantConverter.step("both", edgeLabels);
+        return this;
+    }
+
+    public GraphTraversal<S, Vertex> out(final String... edgeLabels) {
+        this.variantString = this.variantString + this.variantConverter.step("out", edgeLabels);
+        return this;
+    }
+
+    public GraphTraversal<S, Edge> inE(final String... edgeLabels) {
+        this.variantString = this.variantString + this.variantConverter.step("inE", edgeLabels);
+        return this;
+    }
+
+    public GraphTraversal<S, E> values(final String... propertyNames) {
+        this.variantString = this.variantString + this.variantConverter.step("values", propertyNames);
+        return this;
+    }
+
+
+    @Override
+    public void applyStrategies() {
+        if (!this.locked) {
+            try {
+                GremlinPythonGenerator.create("/tmp");
+                ScriptEngine engine = new ScriptEngineManager().getEngineByName("jython");
+                engine.eval("execfile(\"/tmp/gremlin-python-3.2.1-SNAPSHOT.py\")");
+                engine.eval("g = PythonGraphTraversalSource(\"g\")");
+                System.out.println(this.variantString + "!!!!!!!!");
+                final ScriptTraversal<?, ?> traversal = new ScriptTraversal(new GraphTraversalSource(this.getGraph().get(), this.getStrategies()), "gremlin-groovy", engine.eval(this.variantString).toString());
+                traversal.applyStrategies();
+                traversal.getSideEffects().mergeInto(this.sideEffects);
+                traversal.getSteps().forEach { step -> this.addStep(step) };
+            } catch (final Exception e) {
+                throw new IllegalArgumentException(e.getMessage(), e);
+            }
+        }
+        super.applyStrategies();
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/python/GremlinPythonGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/python/GremlinPythonGenerator.groovy b/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/python/GremlinPythonGenerator.groovy
new file mode 100644
index 0000000..ed0fe12
--- /dev/null
+++ b/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/process/variant/python/GremlinPythonGenerator.groovy
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.process.variant.python
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
+import org.apache.tinkerpop.gremlin.util.Gremlin
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+class GremlinPythonGenerator {
+
+    public static void create(final String outputFileLocation) {
+        final StringBuilder pythonClass = new StringBuilder()
+        pythonClass.append("""
+class Helper(object):
+  @staticmethod
+  def stringOrObject(arg):
+    if (type(arg) is str and
+       not(arg.startswith("P.")) and
+       not(arg.startswith("Order.")) and
+       not(arg.startswith("T.")) and
+       not(arg.startswith("Pop.")) and
+       not(arg.startswith("Column."))):
+      return "\\"" + arg + "\\""
+    elif type(arg) is bool:
+      return str(arg).lower()
+    else:
+      return str(arg)
+  @staticmethod
+  def stringify(*args):
+    if len(args) == 0:
+      return ""
+    elif len(args) == 1:
+      return Helper.stringOrObject(args[0])
+    else:
+      return ", ".join(Helper.stringOrObject(i) for i in args)
+""");
+
+//////////////////////////
+// GraphTraversalSource //
+//////////////////////////
+        Set<String> methods = GraphTraversalSource.getMethods().collect { it.name } as Set;
+        pythonClass.append(
+                """class PythonGraphTraversalSource(object):
+  def __init__(self, traversalSourceString):
+    self.traversalSourceString = traversalSourceString
+  def __repr__(self):
+    return "graphtraversalsource[" + self.traversalSourceString + "]"
+""")
+        methods.each { method ->
+            final Class<?> returnType = (GraphTraversalSource.getMethods() as Set).findAll {
+                it.name.equals(method)
+            }.collect {
+                it.returnType
+            }[0]
+            if (null != returnType && Traversal.isAssignableFrom(returnType)) {
+                pythonClass.append(
+                        """  def ${method}(self, *args):
+    return PythonGraphTraversal(self.traversalSourceString + ".${method}(" + Helper.stringify(*args) + ")")
+""")
+            } else {
+                pythonClass.append(
+                        """  def ${method}(self, *args):
+    return PythonGraphTraversalSource(self.traversalSourceString + ".${method}(" + Helper.stringify(*args) + ")")
+""")
+            }
+        }; []
+        pythonClass.append("\n\n")
+
+////////////////////
+// GraphTraversal //
+////////////////////
+        final Map<String, String> methodMap = [as: "_as", in: "_in", and: "_and", or: "_or", is: "_is", not: "_not", from: "_from"].withDefault {
+            it
+        }
+        final Map<String, String> invertedMethodMap = [_as: "as", _in: "in", _and: "and", _or: "or", _is: "is", _not: "not", _from: "from"].withDefault {
+            it
+        }
+        methods = GraphTraversal.getMethods().collect { methodMap[it.name] } as Set;
+        methods.remove("toList")
+        pythonClass.append(
+                """class PythonGraphTraversal(object):
+  def __init__(self, traversalString):
+    self.traversalString = traversalString
+  def __repr__(self):
+    return self.traversalString;
+  def __getitem__(self,index):
+    if type(index) is int:
+      return self.range(index,index+1)
+    elif type(index) is slice:
+      return self.range(index.start,index.stop)
+    else:
+      raise TypeError("index must be int or slice")
+  def __getattr__(self,key):
+    return self.values(key)
+  def toList(self):
+    return self.traversalString
+""")
+        methods.each { method ->
+            final Class<?> returnType = (GraphTraversal.getMethods() as Set).findAll {
+                it.name.equals(invertedMethodMap[method])
+            }.collect { it.returnType }[0]
+            if (null != returnType && Traversal.isAssignableFrom(returnType)) {
+                pythonClass.append(
+                        """  def ${method}(self, *args):
+    self.traversalString = self.traversalString + ".${invertedMethodMap[method]}(" + Helper.stringify(*args) + ")"
+    return self
+""")
+            } else {
+                pythonClass.append(
+                        """  def ${method}(self, *args):
+    self.traversalString = self.traversalString + ".${invertedMethodMap[method]}(" + Helper.stringify(*args) + ")"
+    return self.toList()
+""")
+            }
+        };
+        pythonClass.append("\n\n")
+
+////////////////////////
+// AnonymousTraversal //
+////////////////////////
+        methods = __.getMethods().collect { methodMap[it.name] } as Set; []
+        pythonClass.append("class __(object):\n");
+        methods.each { method ->
+            pythonClass.append(
+                    """  @staticmethod
+  def ${method}(*args):
+    return PythonGraphTraversal("__").${method}(*args)
+""")
+        };
+        pythonClass.append("\n\n")
+
+// save to a python file
+        final File file = new File("${outputFileLocation}/gremlin-python-${Gremlin.version()}.py");
+        file.delete()
+        pythonClass.eachLine { file.append(it + "\n") }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/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
deleted file mode 100644
index e810572..0000000
--- a/gremlin-variant/src/main/groovy/org/apache/tinkerpop/gremlin/python/GremlinPythonGenerator.groovy
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.python
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
-import org.apache.tinkerpop.gremlin.util.Gremlin
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-class GremlinPythonGenerator {
-
-    public static void create(final String outputFileLocation) {
-        final StringBuilder pythonClass = new StringBuilder()
-        pythonClass.append("""
-class Helper(object):
-  @staticmethod
-  def stringOrObject(arg):
-    if (type(arg) is str and
-       not(arg.startswith("P.")) and
-       not(arg.startswith("Order.")) and
-       not(arg.startswith("T.")) and
-       not(arg.startswith("Pop.")) and
-       not(arg.startswith("Column."))):
-      return "\\"" + arg + "\\""
-    elif type(arg) is bool:
-      return str(arg).lower()
-    else:
-      return str(arg)
-  @staticmethod
-  def stringify(*args):
-    if len(args) == 0:
-      return ""
-    elif len(args) == 1:
-      return Helper.stringOrObject(args[0])
-    else:
-      return ", ".join(Helper.stringOrObject(i) for i in args)
-""");
-
-//////////////////////////
-// GraphTraversalSource //
-//////////////////////////
-        Set<String> methods = GraphTraversalSource.getMethods().collect { it.name } as Set;
-        pythonClass.append(
-                """class PythonGraphTraversalSource(object):
-  def __init__(self, gremlinServerURI, traversalSourceString):
-    self.gremlinServerURI = gremlinServerURI
-    self.traversalSourceString = traversalSourceString
-  def __repr__(self):
-    return "graphtraversalsource[" + self.gremlinServerURI + ", " + self.traversalSourceString + "]"
-""")
-        methods.each { method ->
-            final Class<?> returnType = (GraphTraversalSource.getMethods() as Set).findAll {
-                it.name.equals(method)
-            }.collect {
-                it.returnType
-            }[0]
-            if (null != returnType && Traversal.isAssignableFrom(returnType)) {
-                pythonClass.append(
-                        """  def ${method}(self, *args):
-    return PythonGraphTraversal(self.traversalSourceString + ".${method}(" + Helper.stringify(*args) + ")", self.gremlinServerURI)
-""")
-            } else {
-                pythonClass.append(
-                        """  def ${method}(self, *args):
-    return PythonGraphTraversalSource(self.gremlinServerURI, self.traversalSourceString + ".${method}(" + Helper.stringify(*args) + ")")
-""")
-            }
-        }; []
-        pythonClass.append("\n\n")
-
-////////////////////
-// GraphTraversal //
-////////////////////
-        final Map<String, String> methodMap = [as: "_as", in: "_in", and: "_and", or: "_or", is: "_is", not: "_not", from: "_from"].withDefault {
-            it
-        }
-        final Map<String, String> invertedMethodMap = [_as: "as", _in: "in", _and: "and", _or: "or", _is: "is", _not: "not", _from: "from"].withDefault {
-            it
-        }
-        methods = GraphTraversal.getMethods().collect { methodMap[it.name] } as Set;
-        methods.remove("toList")
-        pythonClass.append(
-                """class PythonGraphTraversal(object):
-  def __init__(self, traversalString, gremlinServerURI=None):
-    self.traversalString = traversalString
-    self.gremlinServerURI = gremlinServerURI
-  def __repr__(self):
-    return self.traversalString;
-  def __getitem__(self,index):
-    if type(index) is int:
-      return self.range(index,index+1)
-    elif type(index) is slice:
-      return self.range(index.start,index.stop)
-    else:
-      raise TypeError("index must be int or slice")
-  def __getattr__(self,key):
-    return self.values(key)
-  def toList(self):
-    return IOLoop.current().run_sync(lambda: Helper.submit(self.gremlinServerURI, self.traversalString))
-""")
-        methods.each { method ->
-            final Class<?> returnType = (GraphTraversal.getMethods() as Set).findAll {
-                it.name.equals(invertedMethodMap[method])
-            }.collect { it.returnType }[0]
-            if (null != returnType && Traversal.isAssignableFrom(returnType)) {
-                pythonClass.append(
-                        """  def ${method}(self, *args):
-    self.traversalString = self.traversalString + ".${invertedMethodMap[method]}(" + Helper.stringify(*args) + ")"
-    return self
-""")
-            } else {
-                pythonClass.append(
-                        """  def ${method}(self, *args):
-    self.traversalString = self.traversalString + ".${invertedMethodMap[method]}(" + Helper.stringify(*args) + ")"
-    return self.toList()
-""")
-            }
-        };
-        pythonClass.append("\n\n")
-
-////////////////////////
-// AnonymousTraversal //
-////////////////////////
-        methods = __.getMethods().collect { methodMap[it.name] } as Set; []
-        pythonClass.append("class __(object):\n");
-        methods.each { method ->
-            pythonClass.append(
-                    """  @staticmethod
-  def ${method}(*args):
-    return PythonGraphTraversal("__").${method}(*args)
-""")
-        };
-        pythonClass.append("\n\n")
-
-// save to a python file
-        final File file = new File("${outputFileLocation}/gremlin-python-${Gremlin.version()}.py");
-        file.delete()
-        pythonClass.eachLine { file.append(it + "\n") }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/JavaVariantConverter.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/JavaVariantConverter.java b/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/JavaVariantConverter.java
deleted file mode 100644
index c43b7a9..0000000
--- a/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/JavaVariantConverter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.process.variant;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public interface JavaVariantConverter {
-
-    public String step(final String stepName, final Object... arguments);
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/JavaVariantGraphTraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/JavaVariantGraphTraversalSource.java b/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/JavaVariantGraphTraversalSource.java
deleted file mode 100644
index 8822be8..0000000
--- a/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/JavaVariantGraphTraversalSource.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.process.variant;
-
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.variant.python.PythonVariantConverter;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class JavaVariantGraphTraversalSource extends GraphTraversalSource {
-
-    public JavaVariantGraphTraversalSource(final GraphTraversalSource graphTraversalSource) {
-        this(graphTraversalSource.getGraph(), graphTraversalSource.getStrategies());
-    }
-
-    public JavaVariantGraphTraversalSource(final Graph graph, final TraversalStrategies traversalStrategies) {
-        super(graph, traversalStrategies);
-    }
-
-    public JavaVariantGraphTraversalSource(final Graph graph) {
-        super(graph);
-    }
-
-    public GraphTraversal<Vertex, Vertex> V(final Object... vertexIds) {
-        return new JavaVariantGraphTraversal<>(this.getGraph(), "g" + new PythonVariantConverter().step("V", vertexIds), new PythonVariantConverter());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/VariantConverter.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/VariantConverter.java b/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/VariantConverter.java
new file mode 100644
index 0000000..8b64aff
--- /dev/null
+++ b/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/VariantConverter.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.process.variant;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public interface VariantConverter {
+
+    public String step(final String stepName, final Object... arguments);
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSource.java b/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSource.java
new file mode 100644
index 0000000..14e23ce
--- /dev/null
+++ b/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSource.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.process.variant;
+
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.variant.python.PythonVariantConverter;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class VariantGraphTraversalSource extends GraphTraversalSource {
+
+    public VariantGraphTraversalSource(final GraphTraversalSource graphTraversalSource) {
+        this(graphTraversalSource.getGraph(), graphTraversalSource.getStrategies());
+    }
+
+    public VariantGraphTraversalSource(final Graph graph, final TraversalStrategies traversalStrategies) {
+        super(graph, traversalStrategies);
+    }
+
+    public VariantGraphTraversalSource(final Graph graph) {
+        super(graph);
+    }
+
+    public GraphTraversal<Vertex, Vertex> V(final Object... vertexIds) {
+        return new VariantGraphTraversal<>(this.getGraph(), "g" + new PythonVariantConverter().step("V", vertexIds), new PythonVariantConverter());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonVariantConverter.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonVariantConverter.java b/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonVariantConverter.java
index b8f0e03..358bd48 100644
--- a/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonVariantConverter.java
+++ b/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonVariantConverter.java
@@ -19,24 +19,22 @@
 
 package org.apache.tinkerpop.gremlin.process.variant.python;
 
-import org.apache.tinkerpop.gremlin.process.variant.JavaVariantConverter;
-
-import java.util.Arrays;
+import org.apache.tinkerpop.gremlin.process.variant.VariantConverter;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public class PythonVariantConverter implements JavaVariantConverter {
+public class PythonVariantConverter implements VariantConverter {
     @Override
     public String step(final String stepName, final Object... arguments) {
         if (arguments.length == 0)
             return "." + stepName + "()";
         else {
             String temp = "." + stepName + "(";
-            for(final Object object : arguments)  {
-                temp = temp + object.toString() + ",";
+            for (final Object object : arguments) {
+                temp = temp + (object instanceof String ? "\"" + object + "\"" : object) + ",";
             }
-            return temp.substring(0,temp.length() - 1) + ")";
+            return temp.substring(0, temp.length() - 1) + ")";
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/python/GremlinPython.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/python/GremlinPython.java b/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/python/GremlinPython.java
deleted file mode 100644
index 6c5310a..0000000
--- a/gremlin-variant/src/main/java/org/apache/tinkerpop/gremlin/python/GremlinPython.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tinkerpop.gremlin.python;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class GremlinPython {
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphProvider.java b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphProvider.java
index c3d6b6d..a41b8a0 100644
--- a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphProvider.java
+++ b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphProvider.java
@@ -22,14 +22,8 @@ package org.apache.tinkerpop.gremlin.process.variant;
 import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.AbstractGraphProvider;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
-import org.apache.tinkerpop.gremlin.TestHelper;
 import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.GraphTest;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.apache.tinkerpop.gremlin.structure.io.IoEdgeTest;
-import org.apache.tinkerpop.gremlin.structure.io.IoVertexTest;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedGraphTest;
-import org.apache.tinkerpop.gremlin.structure.util.star.StarGraphTest;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
@@ -69,14 +63,8 @@ public abstract class VariantGraphProvider extends AbstractGraphProvider {
             put(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, idMaker);
             put(TinkerGraph.GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, idMaker);
             put(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, idMaker);
-            if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName))
+            if (loadGraphWith == LoadGraphWith.GraphData.CREW)
                 put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name());
-            if (requiresPersistence(test, testMethodName)) {
-                put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
-                final File tempDir = TestHelper.makeTestDataPath(test, "temp");
-                put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION,
-                        tempDir.getAbsolutePath() + File.separator + testMethodName + ".kryo");
-            }
         }};
     }
 
@@ -99,23 +87,6 @@ public abstract class VariantGraphProvider extends AbstractGraphProvider {
     }
 
     /**
-     * Determines if a test requires TinkerGraph persistence to be configured with graph location and format.
-     */
-    protected static boolean requiresPersistence(final Class<?> test, final String testMethodName) {
-        return test == GraphTest.class && testMethodName.equals("shouldPersistDataOnClose");
-    }
-
-    /**
-     * Determines if a test requires a different cardinality as the default or not.
-     */
-    protected static boolean requiresListCardinalityAsDefault(final LoadGraphWith.GraphData loadGraphWith,
-                                                              final Class<?> test, final String testMethodName) {
-        return loadGraphWith == LoadGraphWith.GraphData.CREW
-                || (test == StarGraphTest.class && testMethodName.equals("shouldAttachWithCreateMethod"))
-                || (test == DetachedGraphTest.class && testMethodName.equals("testAttachableCreateMethod"));
-    }
-
-    /**
      * Test that load with specific graph data can be configured with a specific id manager as the data type to
      * be used in the test for that graph is known.
      */

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
index ba4a4ca..e3c9548 100644
--- a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
+++ b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
@@ -20,7 +20,7 @@
 package org.apache.tinkerpop.gremlin.process.variant.python;
 
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.variant.JavaVariantGraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.variant.VariantGraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.variant.VariantGraphProvider;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 
@@ -30,7 +30,7 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 public class PythonProvider extends VariantGraphProvider {
 
     public GraphTraversalSource traversal(final Graph graph) {
-        return new JavaVariantGraphTraversalSource(graph.traversal());
+        return new VariantGraphTraversalSource(graph.traversal());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75048637/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 35254b6..870025c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -289,6 +289,7 @@ limitations under the License.
                         <exclude>**/goal.txt</exclude>
                         <exclude>**/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/script/*.txt</exclude>
                         <exclude>**/src/main/resources/META-INF/services/**</exclude>
+                        <exclude>**/src/test/resources/META-INF/services/**</exclude>
                         <exclude>**/src/main/ext/**</exclude>
                         <exclude>**/src/main/static/**</exclude>
                         <exclude>**/_bsp/**</exclude>