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/TINKERPOP-1404 Commit: c7d3da2f5eaa2ef3b20dc467bab6e3fe4ecfb5f4 Parents: a1f4497 Author: davebshow <davebs...@apache.org> Authored: Wed Sep 14 13:44:15 2016 -0400 Committer: davebshow <davebs...@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