You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by da...@apache.org on 2016/09/15 16:15:40 UTC

[1/5] tinkerpop git commit: Added compatibility support for Python 2/3 in gremlin-python glv

Repository: tinkerpop
Updated Branches:
  refs/heads/master 2790dbbad -> 687ae742d


Added compatibility support for Python 2/3 in gremlin-python glv


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

Branch: refs/heads/master
Commit: b61f0d827ee76b2bde3404d143c01a5edadbae18
Parents: cf8f6f7
Author: davebshow <da...@apache.org>
Authored: Wed Sep 14 12:20:16 2016 -0400
Committer: davebshow <da...@apache.org>
Committed: Wed Sep 14 12:20:16 2016 -0400

----------------------------------------------------------------------
 .../python/GraphTraversalSourceGenerator.groovy |  5 +--
 .../python/TraversalSourceGenerator.groovy      |  5 ++-
 .../src/main/jython/gremlin_python/compat.py    | 34 ++++++++++++++++++++
 .../driver/driver_remote_connection.py          |  2 +-
 .../gremlin_python/driver/remote_connection.py  |  2 +-
 .../gremlin_python/process/graph_traversal.py   |  3 +-
 .../jython/gremlin_python/process/traversal.py  |  6 +++-
 .../gremlin_python/structure/io/graphson.py     | 10 +++---
 .../driver/test_driver_remote_connection.py     | 13 ++++----
 .../jython/tests/structure/io/test_graphson.py  | 16 ++++++---
 .../main/jython/tests/structure/test_graph.py   | 11 ++++---
 11 files changed, 80 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
index 9187302..55f977c 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
@@ -60,7 +60,8 @@ under the License.
         pythonClass.append("from .traversal import TraversalStrategies\n")
         pythonClass.append("from .traversal import Bytecode\n")
         pythonClass.append("from ..driver.remote_connection import RemoteStrategy\n")
-        pythonClass.append("from .. import statics\n\n")
+        pythonClass.append("from .. import statics\n")
+        pythonClass.append("from ..compat import long\n\n")
 
 //////////////////////////
 // GraphTraversalSource //
@@ -128,7 +129,7 @@ under the License.
     if isinstance(index, int):
         return self.range(long(index), long(index + 1))
     elif isinstance(index, slice):
-        return self.range(0L if index.start is None else long(index.start), long(sys.maxint) if index.stop is None else long(index.stop))
+        return self.range(long(0) if index.start is None else long(index.start), long(sys.maxsize) if index.stop is None else long(index.stop))
     else:
         raise TypeError("Index must be int or slice")
   def __getattr__(self, key):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/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 79a1a4e..35e5b2f 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
@@ -57,6 +57,7 @@ under the License.
         pythonClass.append("import six\n")
         pythonClass.append("from aenum import Enum\n")
         pythonClass.append("from .. import statics\n")
+        pythonClass.append("from ..compat import long\n\n")
 
         pythonClass.append("""
 class Traversal(object):
@@ -182,7 +183,9 @@ TRAVERSER
 '''
 
 class Traverser(object):
-    def __init__(self, object, bulk=1L):
+    def __init__(self, object, bulk=None):
+        if bulk is None:
+            bulk = long(1)
         self.object = object
         self.bulk = bulk
     def __repr__(self):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/gremlin-python/src/main/jython/gremlin_python/compat.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/compat.py b/gremlin-python/src/main/jython/gremlin_python/compat.py
new file mode 100644
index 0000000..8089d85
--- /dev/null
+++ b/gremlin-python/src/main/jython/gremlin_python/compat.py
@@ -0,0 +1,34 @@
+'''
+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.
+'''
+
+from types import FunctionType
+
+import six
+
+
+if six.PY3:
+    class long(int): pass
+    FloatType = float
+    IntType = int
+    LongType = long
+else:
+    long = long
+    from types import FloatType
+    from types import IntType
+    from types import LongType

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
index 7aca638..cac5e73 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
@@ -174,7 +174,7 @@ class Response:
         if self._closed:
             return
         recv_message = yield self._websocket.read_message()
-        recv_message = json.loads(recv_message)
+        recv_message = json.loads(recv_message.decode('utf-8'))
         status_code = recv_message["status"]["code"]
         aggregateTo = recv_message["result"]["meta"].get("aggregateTo", "list")
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py b/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
index 491fffd..0b84a26 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
@@ -42,7 +42,7 @@ class RemoteConnection(object):
 
     @abc.abstractmethod
     def submit(self, bytecode):
-        print "sending " + bytecode + " to GremlinServer..."
+        print("sending " + bytecode + " to GremlinServer...")
         return RemoteTraversal(iter([]), TraversalSideEffects())
 
     def __repr__(self):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index 96985b7..974e127 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -22,6 +22,7 @@ from .traversal import TraversalStrategies
 from .traversal import Bytecode
 from ..driver.remote_connection import RemoteStrategy
 from .. import statics
+from ..compat import long
 
 class GraphTraversalSource(object):
   def __init__(self, graph, traversal_strategies, bytecode=None):
@@ -91,7 +92,7 @@ class GraphTraversal(Traversal):
     if isinstance(index, int):
         return self.range(long(index), long(index + 1))
     elif isinstance(index, slice):
-        return self.range(0L if index.start is None else long(index.start), long(sys.maxint) if index.stop is None else long(index.stop))
+        return self.range(long(0) if index.start is None else long(index.start), long(sys.maxsize) if index.stop is None else long(index.stop))
     else:
         raise TypeError("Index must be int or slice")
   def __getattr__(self, key):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/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 0302047..338c61b 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -20,6 +20,8 @@ import abc
 import six
 from aenum import Enum
 from .. import statics
+from ..compat import long
+
 
 class Traversal(object):
     def __init__(self, graph, traversal_strategies, bytecode):
@@ -240,7 +242,9 @@ TRAVERSER
 '''
 
 class Traverser(object):
-    def __init__(self, object, bulk=1L):
+    def __init__(self, object, bulk=None):
+        if bulk is None:
+            bulk = long(1)
         self.object = object
         self.bulk = bulk
     def __repr__(self):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
index fd13ae9..3eece23 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
@@ -22,12 +22,12 @@ __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
 import json
 from abc import abstractmethod
 from aenum import Enum
-from types import FloatType
-from types import FunctionType
-from types import IntType
-from types import LongType
+
+import six
 
 from gremlin_python import statics
+from gremlin_python.compat import (
+    FloatType, FunctionType, IntType, LongType, long)
 from gremlin_python.process.traversal import Binding
 from gremlin_python.process.traversal import Bytecode
 from gremlin_python.process.traversal import P
@@ -171,7 +171,7 @@ class LambdaSerializer(GraphSONSerializer):
             if not script.strip().startswith("lambda"):
                 script = "lambda " + script
                 dict["script"] = script
-            dict["arguments"] = eval(dict["script"]).func_code.co_argcount
+            dict["arguments"] = six.get_function_code(eval(dict["script"])).co_argcount
         else:
             dict["arguments"] = -1
         return _SymbolHelper.objectify("Lambda", dict)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 7855c74..46e2e1f 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -19,10 +19,12 @@ under the License.
 
 __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
 
+import pytest
 import unittest
 from unittest import TestCase
 
 from gremlin_python import statics
+from gremlin_python.compat import long
 from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
 from gremlin_python.process.traversal import Traverser
 from gremlin_python.structure.graph import Graph
@@ -34,18 +36,17 @@ class TestDriverRemoteConnection(TestCase):
         statics.load_statics(globals())
         connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
         assert "remoteconnection[ws://localhost:8182/gremlin,g]" == str(connection)
-        #
         g = Graph().traversal().withRemote(connection)
-        #
-        assert 6L == g.V().count().toList()[0]
+
+        assert long(6) == g.V().count().toList()[0]
         #
         assert Vertex(1) == g.V(1).next()
         assert 1 == g.V(1).id().next()
         assert Traverser(Vertex(1)) == g.V(1).nextTraverser()
         assert 1 == len(g.V(1).toList())
         assert isinstance(g.V(1).toList(), list)
-        #
-        results = g.V().repeat(out()).times(2).name.toList()
+        results = g.V().repeat(out()).times(2).name
+        results = results.toList()
         assert 2 == len(results)
         assert "lop" in results
         assert "ripple" in results
@@ -125,7 +126,7 @@ if __name__ == '__main__':
         test = True
         connection.close()
     except:
-        print "GremlinServer is not running and this test case will not execute: " + __file__
+        print("GremlinServer is not running and this test case will not execute: " + __file__)
 
     if test:
         unittest.main()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
index cae1a53..fbd8438 100644
--- a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
+++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
@@ -23,6 +23,9 @@ import json
 import unittest
 from unittest import TestCase
 
+import six
+
+from gremlin_python.compat import long
 from gremlin_python.structure.graph import Vertex
 from gremlin_python.structure.graph import Path
 from gremlin_python.structure.io.graphson import GraphSONReader
@@ -43,7 +46,7 @@ class TestGraphSONReader(TestCase):
             "@value": 31
         }))
         assert isinstance(x, long)
-        assert 31L == x
+        assert long(31) == x
         ##
         x = GraphSONReader.readObject(json.dumps({
             "@type": "g:Float",
@@ -73,7 +76,10 @@ class TestGraphSONReader(TestCase):
             """{"@type":"g:Path","@value":{"labels":[["a"],["b","c"],[]],"objects":[{"@type":"g:Vertex","@value":{"id":{"@type":"g:Int32","@value":1},"label":"person","properties":{"name":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":0},"value":"marko","label":"name"}}],"age":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":1},"value":{"@type":"g:Int32","@value":29},"label":"age"}}]}}},{"@type":"g:Vertex","@value":{"id":{"@type":"g:Int32","@value":3},"label":"software","properties":{"name":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":4},"value":"lop","label":"name"}}],"lang":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":5},"value":"java","label":"lang"}}]}}},"lop"]}}"""
         )
         assert isinstance(path, Path)
-        assert "[v[1], v[3], u'lop']" == str(path)
+        if six.PY3:
+            assert "[v[1], v[3], 'lop']" == str(path)
+        else:
+            assert "[v[1], v[3], u'lop']" == str(path)
         assert Vertex(1) == path[0]
         assert Vertex(1) == path["a"]
         assert "lop" == path[2]
@@ -82,9 +88,9 @@ class TestGraphSONReader(TestCase):
 
 class TestGraphSONWriter(TestCase):
     def test_numbers(self):
-        assert """{"@type":"g:Int32","@value":1}""" == GraphSONWriter.writeObject(1)
-        assert """{"@type":"g:Int64","@value":2}""" == GraphSONWriter.writeObject(2L)
-        assert """{"@type":"g:Float","@value":3.2}""" == GraphSONWriter.writeObject(3.2)
+        assert {"@type":"g:Int64","@value":2} == json.loads(GraphSONWriter.writeObject(long(2)))
+        assert {"@type":"g:Int32","@value":1} == json.loads(GraphSONWriter.writeObject(1))
+        assert {"@type":"g:Float","@value":3.2} == json.loads(GraphSONWriter.writeObject(3.2))
         assert """true""" == GraphSONWriter.writeObject(True)
 
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f0d82/gremlin-python/src/main/jython/tests/structure/test_graph.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/test_graph.py b/gremlin-python/src/main/jython/tests/structure/test_graph.py
index 72b4b79..63d9a1e 100644
--- a/gremlin-python/src/main/jython/tests/structure/test_graph.py
+++ b/gremlin-python/src/main/jython/tests/structure/test_graph.py
@@ -19,9 +19,11 @@ under the License.
 
 __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
 
+import sys
 import unittest
 from unittest import TestCase
 
+from gremlin_python.compat import long
 from gremlin_python.structure.graph import Edge
 from gremlin_python.structure.graph import Property
 from gremlin_python.structure.graph import Vertex
@@ -45,14 +47,14 @@ class TestGraph(TestCase):
         assert "phrase" == edge.inV.label
         assert edge.inV != edge.outV
         #
-        vertex_property = VertexProperty(24L, "name", "marko")
+        vertex_property = VertexProperty(long(24), "name", "marko")
         assert "vp[name->marko]" == str(vertex_property)
         assert "name" == vertex_property.label
         assert "name" == vertex_property.key
         assert "marko" == vertex_property.value
-        assert 24L == vertex_property.id
+        assert long(24) == vertex_property.id
         assert isinstance(vertex_property.id, long)
-        assert vertex_property == VertexProperty(24L, "name", "marko")
+        assert vertex_property == VertexProperty(long(24), "name", "marko")
         #
         property = Property("age", 29)
         assert "p[age->29]" == str(property)
@@ -60,7 +62,8 @@ class TestGraph(TestCase):
         assert 29 == property.value
         assert isinstance(property.value, int)
         assert property == Property("age", 29)
-        assert property != Property("age", 29L)
+        if not sys.version_info > (3,):
+            assert property != Property("age", long(29))
         #
         for i in [vertex, edge, vertex_property, property]:
             for j in [vertex, edge, vertex_property, property]:


[5/5] tinkerpop git commit: Merge branch 'TINKERPOP-1448'

Posted by da...@apache.org.
Merge branch 'TINKERPOP-1448'


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

Branch: refs/heads/master
Commit: 687ae742d974482881e52c5c05a608d99020383d
Parents: 2790dbb 1c5e698
Author: davebshow <da...@apache.org>
Authored: Thu Sep 15 12:14:54 2016 -0400
Committer: davebshow <da...@apache.org>
Committed: Thu Sep 15 12:14:54 2016 -0400

----------------------------------------------------------------------
 .../python/GraphTraversalSourceGenerator.groovy    |  5 +++--
 .../gremlin/python/TraversalSourceGenerator.groovy |  5 ++++-
 .../driver/driver_remote_connection.py             |  2 +-
 .../gremlin_python/driver/remote_connection.py     |  2 +-
 .../gremlin_python/process/graph_traversal.py      |  3 ++-
 .../jython/gremlin_python/process/traversal.py     |  6 +++++-
 .../src/main/jython/gremlin_python/statics.py      | 17 +++++++++++++++++
 .../jython/gremlin_python/structure/io/graphson.py | 10 +++++-----
 gremlin-python/src/main/jython/setup.py            | 11 ++++++++++-
 .../tests/driver/test_driver_remote_connection.py  | 12 ++++++------
 .../jython/tests/structure/io/test_graphson.py     | 16 +++++++++++-----
 .../src/main/jython/tests/structure/test_graph.py  | 12 ++++++++----
 12 files changed, 73 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/687ae742/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/687ae742/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/687ae742/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
----------------------------------------------------------------------
diff --cc gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
index 6f244f5,675b060..99c9a45
--- a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
+++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
@@@ -83,15 -88,11 +89,15 @@@ class TestGraphSONReader(TestCase)
  
  class TestGraphSONWriter(TestCase):
      def test_numbers(self):
-         assert """{"@type":"g:Int32","@value":1}""" == GraphSONWriter.writeObject(1)
-         assert """{"@type":"g:Int64","@value":2}""" == GraphSONWriter.writeObject(2L)
-         assert """{"@type":"g:Float","@value":3.2}""" == GraphSONWriter.writeObject(3.2)
+         assert {"@type":"g:Int64","@value":2} == json.loads(GraphSONWriter.writeObject(long(2)))
+         assert {"@type":"g:Int32","@value":1} == json.loads(GraphSONWriter.writeObject(1))
+         assert {"@type":"g:Float","@value":3.2} == json.loads(GraphSONWriter.writeObject(3.2))
          assert """true""" == GraphSONWriter.writeObject(True)
  
 +    def test_P(self):
 +        assert """{"@type":"g:P","@value":{"predicate":"and","value":[{"@type":"g:P","@value":{"predicate":"or","value":[{"@type":"g:P","@value":{"predicate":"lt","value":"b"}},{"@type":"g:P","@value":{"predicate":"gt","value":"c"}}]}},{"@type":"g:P","@value":{"predicate":"neq","value":"d"}}]}}""" == GraphSONWriter.writeObject(
 +            P.lt("b").or_(P.gt("c")).and_(P.neq("d")))
 +
  
  if __name__ == '__main__':
      unittest.main()


[2/5] tinkerpop git commit: fixed small import typos, using six for version info

Posted by da...@apache.org.
fixed small import typos, using six for version info


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

Branch: refs/heads/master
Commit: a1f4497d9bf9a1cbe7b560c481d079025bdd3beb
Parents: b61f0d8
Author: davebshow <da...@apache.org>
Authored: Wed Sep 14 12:37:45 2016 -0400
Committer: davebshow <da...@apache.org>
Committed: Wed Sep 14 12:37:45 2016 -0400

----------------------------------------------------------------------
 .../main/jython/tests/driver/test_driver_remote_connection.py   | 1 -
 gremlin-python/src/main/jython/tests/structure/test_graph.py    | 5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a1f4497d/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 46e2e1f..6ec8183 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -19,7 +19,6 @@ under the License.
 
 __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
 
-import pytest
 import unittest
 from unittest import TestCase
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a1f4497d/gremlin-python/src/main/jython/tests/structure/test_graph.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/test_graph.py b/gremlin-python/src/main/jython/tests/structure/test_graph.py
index 63d9a1e..9e3a681 100644
--- a/gremlin-python/src/main/jython/tests/structure/test_graph.py
+++ b/gremlin-python/src/main/jython/tests/structure/test_graph.py
@@ -19,10 +19,11 @@ under the License.
 
 __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
 
-import sys
 import unittest
 from unittest import TestCase
 
+import six
+
 from gremlin_python.compat import long
 from gremlin_python.structure.graph import Edge
 from gremlin_python.structure.graph import Property
@@ -62,7 +63,7 @@ class TestGraph(TestCase):
         assert 29 == property.value
         assert isinstance(property.value, int)
         assert property == Property("age", 29)
-        if not sys.version_info > (3,):
+        if not six.PY3:
             assert property != Property("age", long(29))
         #
         for i in [vertex, edge, vertex_property, property]:


[3/5] tinkerpop git commit: moved numeric types compat code to statics module

Posted by da...@apache.org.
moved numeric types compat code to statics module


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

Branch: refs/heads/master
Commit: c7d3da2f5eaa2ef3b20dc467bab6e3fe4ecfb5f4
Parents: a1f4497
Author: davebshow <da...@apache.org>
Authored: Wed Sep 14 13:44:15 2016 -0400
Committer: davebshow <da...@apache.org>
Committed: Wed Sep 14 13:44:15 2016 -0400

----------------------------------------------------------------------
 .../python/GraphTraversalSourceGenerator.groovy |  2 +-
 .../python/TraversalSourceGenerator.groovy      |  2 +-
 .../src/main/jython/gremlin_python/compat.py    | 34 --------------------
 .../gremlin_python/process/graph_traversal.py   |  2 +-
 .../jython/gremlin_python/process/traversal.py  |  2 +-
 .../src/main/jython/gremlin_python/statics.py   | 17 ++++++++++
 .../gremlin_python/structure/io/graphson.py     |  2 +-
 .../driver/test_driver_remote_connection.py     |  2 +-
 .../jython/tests/structure/io/test_graphson.py  |  2 +-
 .../main/jython/tests/structure/test_graph.py   |  2 +-
 10 files changed, 25 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c7d3da2f/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
index 55f977c..cdca686 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
@@ -61,7 +61,7 @@ under the License.
         pythonClass.append("from .traversal import Bytecode\n")
         pythonClass.append("from ..driver.remote_connection import RemoteStrategy\n")
         pythonClass.append("from .. import statics\n")
-        pythonClass.append("from ..compat import long\n\n")
+        pythonClass.append("from ..statics import long\n\n")
 
 //////////////////////////
 // GraphTraversalSource //

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c7d3da2f/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 35e5b2f..d78d804 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
@@ -57,7 +57,7 @@ under the License.
         pythonClass.append("import six\n")
         pythonClass.append("from aenum import Enum\n")
         pythonClass.append("from .. import statics\n")
-        pythonClass.append("from ..compat import long\n\n")
+        pythonClass.append("from ..statics import long\n\n")
 
         pythonClass.append("""
 class Traversal(object):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c7d3da2f/gremlin-python/src/main/jython/gremlin_python/compat.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/compat.py b/gremlin-python/src/main/jython/gremlin_python/compat.py
deleted file mode 100644
index 8089d85..0000000
--- a/gremlin-python/src/main/jython/gremlin_python/compat.py
+++ /dev/null
@@ -1,34 +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.
-'''
-
-from types import FunctionType
-
-import six
-
-
-if six.PY3:
-    class long(int): pass
-    FloatType = float
-    IntType = int
-    LongType = long
-else:
-    long = long
-    from types import FloatType
-    from types import IntType
-    from types import LongType

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c7d3da2f/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index 974e127..35b9b71 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -22,7 +22,7 @@ from .traversal import TraversalStrategies
 from .traversal import Bytecode
 from ..driver.remote_connection import RemoteStrategy
 from .. import statics
-from ..compat import long
+from ..statics import long
 
 class GraphTraversalSource(object):
   def __init__(self, graph, traversal_strategies, bytecode=None):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c7d3da2f/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 338c61b..554b694 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -20,7 +20,7 @@ import abc
 import six
 from aenum import Enum
 from .. import statics
-from ..compat import long
+from ..statics import long
 
 
 class Traversal(object):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c7d3da2f/gremlin-python/src/main/jython/gremlin_python/statics.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/statics.py b/gremlin-python/src/main/jython/gremlin_python/statics.py
index 293ff93..c827020 100644
--- a/gremlin-python/src/main/jython/gremlin_python/statics.py
+++ b/gremlin-python/src/main/jython/gremlin_python/statics.py
@@ -16,8 +16,25 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 '''
+
+from types import FunctionType
+
+import six
 from aenum import Enum
 
+
+if six.PY3:
+    class long(int): pass
+    FloatType = float
+    IntType = int
+    LongType = long
+else:
+    long = long
+    from types import FloatType
+    from types import IntType
+    from types import LongType
+
+
 staticMethods = {}
 staticEnums = {}
 default_lambda_language = "gremlin-python"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c7d3da2f/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
index 3eece23..182a7b2 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
@@ -26,7 +26,7 @@ from aenum import Enum
 import six
 
 from gremlin_python import statics
-from gremlin_python.compat import (
+from gremlin_python.statics import (
     FloatType, FunctionType, IntType, LongType, long)
 from gremlin_python.process.traversal import Binding
 from gremlin_python.process.traversal import Bytecode

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c7d3da2f/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 6ec8183..b0efcf1 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -23,7 +23,7 @@ import unittest
 from unittest import TestCase
 
 from gremlin_python import statics
-from gremlin_python.compat import long
+from gremlin_python.statics import long
 from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
 from gremlin_python.process.traversal import Traverser
 from gremlin_python.structure.graph import Graph

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c7d3da2f/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
index fbd8438..675b060 100644
--- a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
+++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
@@ -25,7 +25,7 @@ from unittest import TestCase
 
 import six
 
-from gremlin_python.compat import long
+from gremlin_python.statics import long
 from gremlin_python.structure.graph import Vertex
 from gremlin_python.structure.graph import Path
 from gremlin_python.structure.io.graphson import GraphSONReader

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c7d3da2f/gremlin-python/src/main/jython/tests/structure/test_graph.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/test_graph.py b/gremlin-python/src/main/jython/tests/structure/test_graph.py
index 9e3a681..c619ad2 100644
--- a/gremlin-python/src/main/jython/tests/structure/test_graph.py
+++ b/gremlin-python/src/main/jython/tests/structure/test_graph.py
@@ -24,7 +24,7 @@ from unittest import TestCase
 
 import six
 
-from gremlin_python.compat import long
+from gremlin_python.statics import long
 from gremlin_python.structure.graph import Edge
 from gremlin_python.structure.graph import Property
 from gremlin_python.structure.graph import Vertex


[4/5] tinkerpop git commit: updated setup.py, added six as requirement (for python 3), also added some basic classifiers

Posted by da...@apache.org.
updated setup.py, added six as requirement (for python 3), also added some basic classifiers


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

Branch: refs/heads/master
Commit: 1c5e6989b2b452b14c958ed744fee3d4ebed965a
Parents: c7d3da2
Author: davebshow <da...@apache.org>
Authored: Wed Sep 14 18:23:42 2016 -0400
Committer: davebshow <da...@apache.org>
Committed: Wed Sep 14 18:23:42 2016 -0400

----------------------------------------------------------------------
 gremlin-python/src/main/jython/setup.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1c5e6989/gremlin-python/src/main/jython/setup.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/setup.py b/gremlin-python/src/main/jython/setup.py
index f2472b7..08cfe37 100644
--- a/gremlin-python/src/main/jython/setup.py
+++ b/gremlin-python/src/main/jython/setup.py
@@ -61,6 +61,15 @@ setup(
     ],
     install_requires=[
         'aenum==1.4.5',
-        'tornado==4.4.1'
+        'tornado==4.4.1',
+        'six==1.10.0'
+    ],
+    classifiers=[
+        "Intended Audience :: Developers",
+        "License :: OSI Approved :: Apache Software License",
+        "Natural Language :: English",
+        "Programming Language :: Python :: 2.7",
+        "Programming Language :: Python :: 3.4",
+        "Programming Language :: Python :: 3.5",
     ]
 )