diff --git a/aiogremlin/__init__.py b/aiogremlin/__init__.py index 1c6df920bfa85a5a202192a931d73b8ddc7d2988..611f0b8065ee8aec24544b0ac217a4999902c540 100644 --- a/aiogremlin/__init__.py +++ b/aiogremlin/__init__.py @@ -1,5 +1,5 @@ from aiogremlin.driver.cluster import Cluster from aiogremlin.remote.driver_remote_connection import DriverRemoteConnection -from aiogremlin.gremlin_python.structure.graph import Graph +from aiogremlin.structure.graph import Graph __version__ = "3.2.4" diff --git a/aiogremlin/driver/aiohttp/transport.py b/aiogremlin/driver/aiohttp/transport.py index 8c15013ed8c7270e901c2dbea76b4cba12a95b8d..b9d011485a01537be80c1868828c9410f34a74b4 100644 --- a/aiogremlin/driver/aiohttp/transport.py +++ b/aiogremlin/driver/aiohttp/transport.py @@ -1,6 +1,6 @@ import aiohttp -from aiogremlin.gremlin_python.driver import transport +from gremlin_python.driver import transport class AiohttpTransport(transport.AbstractBaseTransport): diff --git a/aiogremlin/driver/client.py b/aiogremlin/driver/client.py index 73852b581c47d412552c5e4b69afb0c01ac38a26..4849223b809ac2157b04c2ed7818b3d7ac62cc53 100644 --- a/aiogremlin/driver/client.py +++ b/aiogremlin/driver/client.py @@ -1,8 +1,9 @@ """Client for the Tinkerpop 3 Gremlin Server.""" from aiogremlin import exception -from aiogremlin.gremlin_python.driver import request -from aiogremlin.gremlin_python.process import traversal + +from gremlin_python.driver import request +from gremlin_python.process import traversal class Client: @@ -58,8 +59,8 @@ class Client: **coroutine** Submit a script and bindings to the Gremlin Server. :param message: Can be an instance of - `Message<aiogremlin.gremlin_python.request.RequestMessage>` or - `Bytecode<aiogremlin.gremlin_python.process.traversal.Bytecode>` + `Message<gremlin_python.request.RequestMessage>` or + `Bytecode<gremlin_python.process.traversal.Bytecode>` or a `str` representing a raw Gremlin script :param dict bindings: Optional bindings used with raw Grelmin :returns: :py:class:`ResultSet<aiogremlin.driver.resultset.ResultSet>` diff --git a/aiogremlin/driver/cluster.py b/aiogremlin/driver/cluster.py index bf049ae4b3091380059268a8883cf46cbd805f97..9895cda1003021f82b06c8a2b0d279b075fbf246 100644 --- a/aiogremlin/driver/cluster.py +++ b/aiogremlin/driver/cluster.py @@ -12,7 +12,7 @@ import yaml from aiogremlin import exception from aiogremlin import driver -from aiogremlin.gremlin_python.driver import serializer +from gremlin_python.driver import serializer def my_import(name): @@ -52,7 +52,7 @@ class Cluster: 'min_conns': 1, 'max_times_acquired': 16, 'max_inflight': 64, - 'message_serializer': 'aiogremlin.gremlin_python.driver.serializer.GraphSONMessageSerializer', + 'message_serializer': 'gremlin_python.driver.serializer.GraphSONMessageSerializer', 'provider': 'aiogremlin.driver.provider.TinkerGraph' } diff --git a/aiogremlin/driver/connection.py b/aiogremlin/driver/connection.py index 4ca67c2c3b988217c46604c1d2187d2634bfa726..d0c04e13fc0fef8630da2e6e81c88b8a96ae3406 100644 --- a/aiogremlin/driver/connection.py +++ b/aiogremlin/driver/connection.py @@ -15,7 +15,7 @@ except ImportError: from aiogremlin.driver import provider, resultset from aiogremlin.driver.protocol import GremlinServerWSProtocol from aiogremlin.driver.aiohttp.transport import AiohttpTransport -from aiogremlin.gremlin_python.driver import serializer +from gremlin_python.driver import serializer logger = logging.getLogger(__name__) @@ -28,9 +28,9 @@ class Connection: :py:meth:`Connection.open<aiogremlin.connection.Connection.open>`. :param str url: url for host Gremlin Server - :param aiogremlin.gremlin_python.driver.transport.AbstractBaseTransport transport: + :param gremlin_python.driver.transport.AbstractBaseTransport transport: Transport implementation - :param aiogremlin.gremlin_python.driver.protocol.AbstractBaseProtocol protocol: + :param gremlin_python.driver.protocol.AbstractBaseProtocol protocol: Protocol implementation :param asyncio.BaseEventLoop loop: :param str username: Username for database auth @@ -74,7 +74,7 @@ class Connection: :param str url: url for host Gremlin Server :param asyncio.BaseEventLoop loop: - :param aiogremlin.gremlin_python.driver.protocol.AbstractBaseProtocol protocol: + :param gremlin_python.driver.protocol.AbstractBaseProtocol protocol: Protocol implementation :param func transport_factory: Factory function for transports :param ssl.SSLContext ssl_context: @@ -125,7 +125,7 @@ class Connection: """ Submit a script and bindings to the Gremlin Server - :param `RequestMessage<aiogremlin.gremlin_python.driver.request.RequestMessage>` message: + :param `RequestMessage<gremlin_python.driver.request.RequestMessage>` message: :returns: :py:class:`ResultSet<aiogremlin.driver.resultset.ResultSet>` object """ diff --git a/aiogremlin/driver/protocol.py b/aiogremlin/driver/protocol.py index f82e28834e374c30232248af310e3a1f54cd895b..2dd85fe8dc212d59a6a7067b5262cc2f48c29afc 100644 --- a/aiogremlin/driver/protocol.py +++ b/aiogremlin/driver/protocol.py @@ -9,7 +9,7 @@ try: except ImportError: import json -from aiogremlin.gremlin_python.driver import protocol, request, serializer +from gremlin_python.driver import protocol, request, serializer __author__ = 'David M. Brown (davebshow@gmail.com)' diff --git a/aiogremlin/gremlin_python/__init__.py b/aiogremlin/gremlin_python/__init__.py deleted file mode 100644 index a2a5a4bd6bd921bfa65b3665da8858bc7b9846cd..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/__init__.py +++ /dev/null @@ -1,25 +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. -''' -'''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' -__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' - -from aiogremlin.gremlin_python.statics import * -from aiogremlin.gremlin_python.process.graph_traversal import __ -from aiogremlin.gremlin_python.process.strategies import * -from aiogremlin.gremlin_python.process.traversal import Binding, Cardinality diff --git a/aiogremlin/gremlin_python/driver/__init__.py b/aiogremlin/gremlin_python/driver/__init__.py deleted file mode 100644 index 7626550738f12ccd5e18b8c06a8d68aaab882066..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/driver/__init__.py +++ /dev/null @@ -1,20 +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. -''' - -__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' diff --git a/aiogremlin/gremlin_python/driver/protocol.py b/aiogremlin/gremlin_python/driver/protocol.py deleted file mode 100644 index af88ba8eda170a5e3982f7add2ebe392af89d4ec..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/driver/protocol.py +++ /dev/null @@ -1,45 +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. -""" -import abc -import base64 -import collections -import uuid - -try: - import ujson as json -except ImportError: - import json - - -__author__ = 'David M. Brown (davebshow@gmail.com)' - - -class AbstractBaseProtocol(metaclass=abc.ABCMeta): - - @abc.abstractmethod - def connection_made(self, transport): - self._transport = transport - - @abc.abstractmethod - def data_received(self, message): - pass - - @abc.abstractmethod - def write(self, request_id, request_message): - pass diff --git a/aiogremlin/gremlin_python/driver/remote_connection.py b/aiogremlin/gremlin_python/driver/remote_connection.py deleted file mode 100644 index 4101a8c7b1340e69c743c2d05e56b57c11f1d44d..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/driver/remote_connection.py +++ /dev/null @@ -1,75 +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. -''' -'''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' -import abc -import collections - -from aiogremlin.gremlin_python.driver import request -from aiogremlin.gremlin_python.process import traversal - -__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' - - -class RemoteConnection(metaclass=abc.ABCMeta): - def __init__(self, url, traversal_source): - self._url = url - self._traversal_source = traversal_source - - @property - def url(self): - return self._url - - @property - def traversal_source(self): - return self._traversal_source - - @abc.abstractmethod - def submit(self, bytecode): - pass - - def __repr__(self): - return "remoteconnection[" + self._url + "," + self._traversal_source + "]" - - -class RemoteTraversal(traversal.Traversal): - def __init__(self, traversers, side_effects): - super(RemoteTraversal, self).__init__(None, None, None) - self.traversers = traversers - self._side_effects = side_effects - - @property - def side_effects(self): - return self._side_effects - - @side_effects.setter - def side_effects(self, val): - self._side_effects = val - - -class RemoteStrategy(traversal.TraversalStrategy): - def __init__(self, remote_connection): - self.remote_connection = remote_connection - - async def apply(self, traversal): - if traversal.traversers is None: - remote_traversal = await self.remote_connection.submit( - traversal.bytecode) - traversal.remote_results = remote_traversal - traversal.side_effects = remote_traversal.side_effects - traversal.traversers = remote_traversal.traversers diff --git a/aiogremlin/gremlin_python/driver/request.py b/aiogremlin/gremlin_python/driver/request.py deleted file mode 100644 index ac7b845c659013ac13ace9c6dca1f75076b86ee8..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/driver/request.py +++ /dev/null @@ -1,25 +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. -""" -import collections - -__author__ = 'David M. Brown (davebshow@gmail.com)' - - -RequestMessage = collections.namedtuple( - 'RequestMessage', ['processor', 'op', 'args']) diff --git a/aiogremlin/gremlin_python/driver/serializer.py b/aiogremlin/gremlin_python/driver/serializer.py deleted file mode 100644 index f6c1e86ace1db586bc55f1525bf9d73cd5e23529..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/driver/serializer.py +++ /dev/null @@ -1,130 +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. -""" -'''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' -try: - import ujson as json -except ImportError: - import json - -from aiogremlin.gremlin_python.structure.io import graphson - -__author__ = 'David M. Brown (davebshow@gmail.com)' - - -class Processor: - """Base class for OpProcessor serialization system.""" - - def __init__(self, writer): - self._graphson_writer = writer - - def get_op_args(self, op, args): - op_method = getattr(self, op, None) - if not op_method: - raise Exception("Processor does not support op: {}".format(op)) - return op_method(args) - - -class Standard(Processor): - - def authentication(self, args): - return args - - def eval(self, args): - return args - - -class Traversal(Processor): - - def authentication(self, args): - return args - - def bytecode(self, args): - gremlin = args['gremlin'] - args['gremlin'] = self._graphson_writer.toDict(gremlin) - aliases = args.get('aliases', '') - if not aliases: - aliases = {'g': 'g'} - args['aliases'] = aliases - return args - - def close(self, args): - return self.keys(args) - - def gather(self, args): - side_effect = args['sideEffect'] - args['sideEffect'] = {'@type': 'g:UUID', '@value': side_effect} - aliases = args.get('aliases', '') - if not aliases: - aliases = {'g': 'g'} - args['aliases'] = aliases - return args - - def keys(self, args): - side_effect = args['sideEffect'] - args['sideEffect'] = {'@type': 'g:UUID', '@value': side_effect} - return args - - -class GraphSONMessageSerializer: - """Message serializer for GraphSON""" - - def __init__(self, reader=None, writer=None): - if not reader: - reader = graphson.GraphSONReader() - self._graphson_reader = reader - if not writer: - writer = graphson.GraphSONWriter() - self.standard = Standard(writer) - self.traversal = Traversal(writer) - - def get_processor(self, processor): - processor = getattr(self, processor, None) - if not processor: - raise Exception("Unknown processor") - return processor - - def serialize_message(self, request_id, request_message): - processor = request_message.processor - op = request_message.op - args = request_message.args - if not processor: - processor_obj = self.get_processor('standard') - else: - processor_obj = self.get_processor(processor) - args = processor_obj.get_op_args(op, args) - message = self.build_message(request_id, processor, op, args) - return message - - def build_message(self, request_id, processor, op, args): - message = { - 'requestId': {'@type': 'g:UUID', '@value': request_id}, - 'processor': processor, - 'op': op, - 'args': args - } - return self.finalize_message(message, b"\x21", - b"application/vnd.gremlin-v2.0+json") - - def finalize_message(self, message, mime_len, mime_type): - message = json.dumps(message) - message = b''.join([mime_len, mime_type, message.encode('utf-8')]) - return message - - def deserialize_message(self, message): - return self._graphson_reader.toObject(message) diff --git a/aiogremlin/gremlin_python/driver/transport.py b/aiogremlin/gremlin_python/driver/transport.py deleted file mode 100644 index 000028383fc4e34880ce4a46625b7fd57a7aa2db..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/driver/transport.py +++ /dev/null @@ -1,45 +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. -""" -import abc - - -__author__ = 'David M. Brown (davebshow@gmail.com)' - - -class AbstractBaseTransport(metaclass=abc.ABCMeta): - - @abc.abstractmethod - def connect(self, url, *, ssl_context=None): - pass - - @abc.abstractmethod - def write(self, message): - pass - - @abc.abstractmethod - def read(self): - pass - - @abc.abstractmethod - def close(self): - pass - - @abc.abstractproperty - def closed(self): - pass diff --git a/aiogremlin/gremlin_python/process/__init__.py b/aiogremlin/gremlin_python/process/__init__.py deleted file mode 100644 index 7626550738f12ccd5e18b8c06a8d68aaab882066..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/process/__init__.py +++ /dev/null @@ -1,20 +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. -''' - -__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' diff --git a/aiogremlin/gremlin_python/process/graph_traversal.py b/aiogremlin/gremlin_python/process/graph_traversal.py deleted file mode 100644 index 0528178775b5c616d33e063a111dc05895c67767..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/process/graph_traversal.py +++ /dev/null @@ -1,1129 +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. -''' -'''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' -import sys -from aiogremlin.gremlin_python.process.traversal import Traversal -from aiogremlin.gremlin_python.process.traversal import TraversalStrategies -from aiogremlin.gremlin_python.process.strategies import VertexProgramStrategy -from .traversal import Bytecode -from aiogremlin.gremlin_python.driver.remote_connection import RemoteStrategy -from aiogremlin.gremlin_python import statics -from aiogremlin.gremlin_python.statics import long - -class GraphTraversalSource(object): - def __init__(self, graph, traversal_strategies, bytecode=None): - self.graph = graph - self.traversal_strategies = traversal_strategies - if bytecode is None: - bytecode = Bytecode() - self.bytecode = bytecode - def __repr__(self): - return "graphtraversalsource[" + str(self.graph) + "]" - def withBulk(self, *args): - source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode)) - source.bytecode.add_source("withBulk", *args) - return source - def withPath(self, *args): - source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode)) - source.bytecode.add_source("withPath", *args) - return source - def withSack(self, *args): - source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode)) - source.bytecode.add_source("withSack", *args) - return source - def withSideEffect(self, *args): - source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode)) - source.bytecode.add_source("withSideEffect", *args) - return source - def withStrategies(self, *args): - source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode)) - source.bytecode.add_source("withStrategies", *args) - return source - def withoutStrategies(self, *args): - source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode)) - source.bytecode.add_source("withoutStrategies", *args) - return source - def withRemote(self, remote_connection): - source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode)) - source.traversal_strategies.add_strategies([RemoteStrategy(remote_connection)]) - return source - def withComputer(self,graph_computer=None, workers=None, result=None, persist=None, vertices=None, edges=None, configuration=None): - return self.withStrategies(VertexProgramStrategy(graph_computer,workers,result,persist,vertices,edges,configuration)) - def E(self, *args): - traversal = GraphTraversal(self.graph, self.traversal_strategies, Bytecode(self.bytecode)) - traversal.bytecode.add_step("E", *args) - return traversal - def V(self, *args): - traversal = GraphTraversal(self.graph, self.traversal_strategies, Bytecode(self.bytecode)) - traversal.bytecode.add_step("V", *args) - return traversal - def addV(self, *args): - traversal = GraphTraversal(self.graph, self.traversal_strategies, Bytecode(self.bytecode)) - traversal.bytecode.add_step("addV", *args) - return traversal - def inject(self, *args): - traversal = GraphTraversal(self.graph, self.traversal_strategies, Bytecode(self.bytecode)) - traversal.bytecode.add_step("inject", *args) - return traversal - - -class GraphTraversal(Traversal): - def __init__(self, graph, traversal_strategies, bytecode): - Traversal.__init__(self, graph, traversal_strategies, bytecode) - def __getitem__(self, index): - if isinstance(index, int): - return self.range(long(index), long(index + 1)) - elif isinstance(index, slice): - 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): - return self.values(key) - def V(self, *args): - self.bytecode.add_step("V", *args) - return self - def addE(self, *args): - self.bytecode.add_step("addE", *args) - return self - def addInE(self, *args): - self.bytecode.add_step("addInE", *args) - return self - def addOutE(self, *args): - self.bytecode.add_step("addOutE", *args) - return self - def addV(self, *args): - self.bytecode.add_step("addV", *args) - return self - def aggregate(self, *args): - self.bytecode.add_step("aggregate", *args) - return self - def and_(self, *args): - self.bytecode.add_step("and", *args) - return self - def as_(self, *args): - self.bytecode.add_step("as", *args) - return self - def barrier(self, *args): - self.bytecode.add_step("barrier", *args) - return self - def both(self, *args): - self.bytecode.add_step("both", *args) - return self - def bothE(self, *args): - self.bytecode.add_step("bothE", *args) - return self - def bothV(self, *args): - self.bytecode.add_step("bothV", *args) - return self - def branch(self, *args): - self.bytecode.add_step("branch", *args) - return self - def by(self, *args): - self.bytecode.add_step("by", *args) - return self - def cap(self, *args): - self.bytecode.add_step("cap", *args) - return self - def choose(self, *args): - self.bytecode.add_step("choose", *args) - return self - def coalesce(self, *args): - self.bytecode.add_step("coalesce", *args) - return self - def coin(self, *args): - self.bytecode.add_step("coin", *args) - return self - def constant(self, *args): - self.bytecode.add_step("constant", *args) - return self - def count(self, *args): - self.bytecode.add_step("count", *args) - return self - def cyclicPath(self, *args): - self.bytecode.add_step("cyclicPath", *args) - return self - def dedup(self, *args): - self.bytecode.add_step("dedup", *args) - return self - def drop(self, *args): - self.bytecode.add_step("drop", *args) - return self - def emit(self, *args): - self.bytecode.add_step("emit", *args) - return self - def filter(self, *args): - self.bytecode.add_step("filter", *args) - return self - def flatMap(self, *args): - self.bytecode.add_step("flatMap", *args) - return self - def fold(self, *args): - self.bytecode.add_step("fold", *args) - return self - def from_(self, *args): - self.bytecode.add_step("from", *args) - return self - def group(self, *args): - self.bytecode.add_step("group", *args) - return self - def groupCount(self, *args): - self.bytecode.add_step("groupCount", *args) - return self - def groupV3d0(self, *args): - self.bytecode.add_step("groupV3d0", *args) - return self - def has(self, *args): - self.bytecode.add_step("has", *args) - return self - def hasId(self, *args): - self.bytecode.add_step("hasId", *args) - return self - def hasKey(self, *args): - self.bytecode.add_step("hasKey", *args) - return self - def hasLabel(self, *args): - self.bytecode.add_step("hasLabel", *args) - return self - def hasNot(self, *args): - self.bytecode.add_step("hasNot", *args) - return self - def hasValue(self, *args): - self.bytecode.add_step("hasValue", *args) - return self - def id(self, *args): - self.bytecode.add_step("id", *args) - return self - def identity(self, *args): - self.bytecode.add_step("identity", *args) - return self - def inE(self, *args): - self.bytecode.add_step("inE", *args) - return self - def inV(self, *args): - self.bytecode.add_step("inV", *args) - return self - def in_(self, *args): - self.bytecode.add_step("in", *args) - return self - def inject(self, *args): - self.bytecode.add_step("inject", *args) - return self - def is_(self, *args): - self.bytecode.add_step("is", *args) - return self - def key(self, *args): - self.bytecode.add_step("key", *args) - return self - def label(self, *args): - self.bytecode.add_step("label", *args) - return self - def limit(self, *args): - self.bytecode.add_step("limit", *args) - return self - def local(self, *args): - self.bytecode.add_step("local", *args) - return self - def loops(self, *args): - self.bytecode.add_step("loops", *args) - return self - def map(self, *args): - self.bytecode.add_step("map", *args) - return self - def mapKeys(self, *args): - self.bytecode.add_step("mapKeys", *args) - return self - def mapValues(self, *args): - self.bytecode.add_step("mapValues", *args) - return self - def match(self, *args): - self.bytecode.add_step("match", *args) - return self - def max(self, *args): - self.bytecode.add_step("max", *args) - return self - def mean(self, *args): - self.bytecode.add_step("mean", *args) - return self - def min(self, *args): - self.bytecode.add_step("min", *args) - return self - def not_(self, *args): - self.bytecode.add_step("not", *args) - return self - def option(self, *args): - self.bytecode.add_step("option", *args) - return self - def optional(self, *args): - self.bytecode.add_step("optional", *args) - return self - def or_(self, *args): - self.bytecode.add_step("or", *args) - return self - def order(self, *args): - self.bytecode.add_step("order", *args) - return self - def otherV(self, *args): - self.bytecode.add_step("otherV", *args) - return self - def out(self, *args): - self.bytecode.add_step("out", *args) - return self - def outE(self, *args): - self.bytecode.add_step("outE", *args) - return self - def outV(self, *args): - self.bytecode.add_step("outV", *args) - return self - def pageRank(self, *args): - self.bytecode.add_step("pageRank", *args) - return self - def path(self, *args): - self.bytecode.add_step("path", *args) - return self - def peerPressure(self, *args): - self.bytecode.add_step("peerPressure", *args) - return self - def profile(self, *args): - self.bytecode.add_step("profile", *args) - return self - def program(self, *args): - self.bytecode.add_step("program", *args) - return self - def project(self, *args): - self.bytecode.add_step("project", *args) - return self - def properties(self, *args): - self.bytecode.add_step("properties", *args) - return self - def property(self, *args): - self.bytecode.add_step("property", *args) - return self - def propertyMap(self, *args): - self.bytecode.add_step("propertyMap", *args) - return self - def range(self, *args): - self.bytecode.add_step("range", *args) - return self - def repeat(self, *args): - self.bytecode.add_step("repeat", *args) - return self - def sack(self, *args): - self.bytecode.add_step("sack", *args) - return self - def sample(self, *args): - self.bytecode.add_step("sample", *args) - return self - def select(self, *args): - self.bytecode.add_step("select", *args) - return self - def sideEffect(self, *args): - self.bytecode.add_step("sideEffect", *args) - return self - def simplePath(self, *args): - self.bytecode.add_step("simplePath", *args) - return self - def store(self, *args): - self.bytecode.add_step("store", *args) - return self - def subgraph(self, *args): - self.bytecode.add_step("subgraph", *args) - return self - def sum(self, *args): - self.bytecode.add_step("sum", *args) - return self - def tail(self, *args): - self.bytecode.add_step("tail", *args) - return self - def timeLimit(self, *args): - self.bytecode.add_step("timeLimit", *args) - return self - def times(self, *args): - self.bytecode.add_step("times", *args) - return self - def to(self, *args): - self.bytecode.add_step("to", *args) - return self - def toE(self, *args): - self.bytecode.add_step("toE", *args) - return self - def toV(self, *args): - self.bytecode.add_step("toV", *args) - return self - def tree(self, *args): - self.bytecode.add_step("tree", *args) - return self - def unfold(self, *args): - self.bytecode.add_step("unfold", *args) - return self - def union(self, *args): - self.bytecode.add_step("union", *args) - return self - def until(self, *args): - self.bytecode.add_step("until", *args) - return self - def value(self, *args): - self.bytecode.add_step("value", *args) - return self - def valueMap(self, *args): - self.bytecode.add_step("valueMap", *args) - return self - def values(self, *args): - self.bytecode.add_step("values", *args) - return self - def where(self, *args): - self.bytecode.add_step("where", *args) - return self - - -class __(object): - @staticmethod - def start(): - return GraphTraversal(None, None, Bytecode()) - @staticmethod - def __(*args): - return __.inject(*args) - @staticmethod - def V(*args): - return GraphTraversal(None, None, Bytecode()).V(*args) - @staticmethod - def addE(*args): - return GraphTraversal(None, None, Bytecode()).addE(*args) - @staticmethod - def addInE(*args): - return GraphTraversal(None, None, Bytecode()).addInE(*args) - @staticmethod - def addOutE(*args): - return GraphTraversal(None, None, Bytecode()).addOutE(*args) - @staticmethod - def addV(*args): - return GraphTraversal(None, None, Bytecode()).addV(*args) - @staticmethod - def aggregate(*args): - return GraphTraversal(None, None, Bytecode()).aggregate(*args) - @staticmethod - def and_(*args): - return GraphTraversal(None, None, Bytecode()).and_(*args) - @staticmethod - def as_(*args): - return GraphTraversal(None, None, Bytecode()).as_(*args) - @staticmethod - def barrier(*args): - return GraphTraversal(None, None, Bytecode()).barrier(*args) - @staticmethod - def both(*args): - return GraphTraversal(None, None, Bytecode()).both(*args) - @staticmethod - def bothE(*args): - return GraphTraversal(None, None, Bytecode()).bothE(*args) - @staticmethod - def bothV(*args): - return GraphTraversal(None, None, Bytecode()).bothV(*args) - @staticmethod - def branch(*args): - return GraphTraversal(None, None, Bytecode()).branch(*args) - @staticmethod - def cap(*args): - return GraphTraversal(None, None, Bytecode()).cap(*args) - @staticmethod - def choose(*args): - return GraphTraversal(None, None, Bytecode()).choose(*args) - @staticmethod - def coalesce(*args): - return GraphTraversal(None, None, Bytecode()).coalesce(*args) - @staticmethod - def coin(*args): - return GraphTraversal(None, None, Bytecode()).coin(*args) - @staticmethod - def constant(*args): - return GraphTraversal(None, None, Bytecode()).constant(*args) - @staticmethod - def count(*args): - return GraphTraversal(None, None, Bytecode()).count(*args) - @staticmethod - def cyclicPath(*args): - return GraphTraversal(None, None, Bytecode()).cyclicPath(*args) - @staticmethod - def dedup(*args): - return GraphTraversal(None, None, Bytecode()).dedup(*args) - @staticmethod - def drop(*args): - return GraphTraversal(None, None, Bytecode()).drop(*args) - @staticmethod - def emit(*args): - return GraphTraversal(None, None, Bytecode()).emit(*args) - @staticmethod - def filter(*args): - return GraphTraversal(None, None, Bytecode()).filter(*args) - @staticmethod - def flatMap(*args): - return GraphTraversal(None, None, Bytecode()).flatMap(*args) - @staticmethod - def fold(*args): - return GraphTraversal(None, None, Bytecode()).fold(*args) - @staticmethod - def group(*args): - return GraphTraversal(None, None, Bytecode()).group(*args) - @staticmethod - def groupCount(*args): - return GraphTraversal(None, None, Bytecode()).groupCount(*args) - @staticmethod - def groupV3d0(*args): - return GraphTraversal(None, None, Bytecode()).groupV3d0(*args) - @staticmethod - def has(*args): - return GraphTraversal(None, None, Bytecode()).has(*args) - @staticmethod - def hasId(*args): - return GraphTraversal(None, None, Bytecode()).hasId(*args) - @staticmethod - def hasKey(*args): - return GraphTraversal(None, None, Bytecode()).hasKey(*args) - @staticmethod - def hasLabel(*args): - return GraphTraversal(None, None, Bytecode()).hasLabel(*args) - @staticmethod - def hasNot(*args): - return GraphTraversal(None, None, Bytecode()).hasNot(*args) - @staticmethod - def hasValue(*args): - return GraphTraversal(None, None, Bytecode()).hasValue(*args) - @staticmethod - def id(*args): - return GraphTraversal(None, None, Bytecode()).id(*args) - @staticmethod - def identity(*args): - return GraphTraversal(None, None, Bytecode()).identity(*args) - @staticmethod - def inE(*args): - return GraphTraversal(None, None, Bytecode()).inE(*args) - @staticmethod - def inV(*args): - return GraphTraversal(None, None, Bytecode()).inV(*args) - @staticmethod - def in_(*args): - return GraphTraversal(None, None, Bytecode()).in_(*args) - @staticmethod - def inject(*args): - return GraphTraversal(None, None, Bytecode()).inject(*args) - @staticmethod - def is_(*args): - return GraphTraversal(None, None, Bytecode()).is_(*args) - @staticmethod - def key(*args): - return GraphTraversal(None, None, Bytecode()).key(*args) - @staticmethod - def label(*args): - return GraphTraversal(None, None, Bytecode()).label(*args) - @staticmethod - def limit(*args): - return GraphTraversal(None, None, Bytecode()).limit(*args) - @staticmethod - def local(*args): - return GraphTraversal(None, None, Bytecode()).local(*args) - @staticmethod - def loops(*args): - return GraphTraversal(None, None, Bytecode()).loops(*args) - @staticmethod - def map(*args): - return GraphTraversal(None, None, Bytecode()).map(*args) - @staticmethod - def mapKeys(*args): - return GraphTraversal(None, None, Bytecode()).mapKeys(*args) - @staticmethod - def mapValues(*args): - return GraphTraversal(None, None, Bytecode()).mapValues(*args) - @staticmethod - def match(*args): - return GraphTraversal(None, None, Bytecode()).match(*args) - @staticmethod - def max(*args): - return GraphTraversal(None, None, Bytecode()).max(*args) - @staticmethod - def mean(*args): - return GraphTraversal(None, None, Bytecode()).mean(*args) - @staticmethod - def min(*args): - return GraphTraversal(None, None, Bytecode()).min(*args) - @staticmethod - def not_(*args): - return GraphTraversal(None, None, Bytecode()).not_(*args) - @staticmethod - def optional(*args): - return GraphTraversal(None, None, Bytecode()).optional(*args) - @staticmethod - def or_(*args): - return GraphTraversal(None, None, Bytecode()).or_(*args) - @staticmethod - def order(*args): - return GraphTraversal(None, None, Bytecode()).order(*args) - @staticmethod - def otherV(*args): - return GraphTraversal(None, None, Bytecode()).otherV(*args) - @staticmethod - def out(*args): - return GraphTraversal(None, None, Bytecode()).out(*args) - @staticmethod - def outE(*args): - return GraphTraversal(None, None, Bytecode()).outE(*args) - @staticmethod - def outV(*args): - return GraphTraversal(None, None, Bytecode()).outV(*args) - @staticmethod - def path(*args): - return GraphTraversal(None, None, Bytecode()).path(*args) - @staticmethod - def project(*args): - return GraphTraversal(None, None, Bytecode()).project(*args) - @staticmethod - def properties(*args): - return GraphTraversal(None, None, Bytecode()).properties(*args) - @staticmethod - def property(*args): - return GraphTraversal(None, None, Bytecode()).property(*args) - @staticmethod - def propertyMap(*args): - return GraphTraversal(None, None, Bytecode()).propertyMap(*args) - @staticmethod - def range(*args): - return GraphTraversal(None, None, Bytecode()).range(*args) - @staticmethod - def repeat(*args): - return GraphTraversal(None, None, Bytecode()).repeat(*args) - @staticmethod - def sack(*args): - return GraphTraversal(None, None, Bytecode()).sack(*args) - @staticmethod - def sample(*args): - return GraphTraversal(None, None, Bytecode()).sample(*args) - @staticmethod - def select(*args): - return GraphTraversal(None, None, Bytecode()).select(*args) - @staticmethod - def sideEffect(*args): - return GraphTraversal(None, None, Bytecode()).sideEffect(*args) - @staticmethod - def simplePath(*args): - return GraphTraversal(None, None, Bytecode()).simplePath(*args) - @staticmethod - def store(*args): - return GraphTraversal(None, None, Bytecode()).store(*args) - @staticmethod - def subgraph(*args): - return GraphTraversal(None, None, Bytecode()).subgraph(*args) - @staticmethod - def sum(*args): - return GraphTraversal(None, None, Bytecode()).sum(*args) - @staticmethod - def tail(*args): - return GraphTraversal(None, None, Bytecode()).tail(*args) - @staticmethod - def timeLimit(*args): - return GraphTraversal(None, None, Bytecode()).timeLimit(*args) - @staticmethod - def times(*args): - return GraphTraversal(None, None, Bytecode()).times(*args) - @staticmethod - def to(*args): - return GraphTraversal(None, None, Bytecode()).to(*args) - @staticmethod - def toE(*args): - return GraphTraversal(None, None, Bytecode()).toE(*args) - @staticmethod - def toV(*args): - return GraphTraversal(None, None, Bytecode()).toV(*args) - @staticmethod - def tree(*args): - return GraphTraversal(None, None, Bytecode()).tree(*args) - @staticmethod - def unfold(*args): - return GraphTraversal(None, None, Bytecode()).unfold(*args) - @staticmethod - def union(*args): - return GraphTraversal(None, None, Bytecode()).union(*args) - @staticmethod - def until(*args): - return GraphTraversal(None, None, Bytecode()).until(*args) - @staticmethod - def value(*args): - return GraphTraversal(None, None, Bytecode()).value(*args) - @staticmethod - def valueMap(*args): - return GraphTraversal(None, None, Bytecode()).valueMap(*args) - @staticmethod - def values(*args): - return GraphTraversal(None, None, Bytecode()).values(*args) - @staticmethod - def where(*args): - return GraphTraversal(None, None, Bytecode()).where(*args) - - -def V(*args): - return __.V(*args) - -statics.add_static('V', V) - -def addE(*args): - return __.addE(*args) - -statics.add_static('addE', addE) - -def addInE(*args): - return __.addInE(*args) - -statics.add_static('addInE', addInE) - -def addOutE(*args): - return __.addOutE(*args) - -statics.add_static('addOutE', addOutE) - -def addV(*args): - return __.addV(*args) - -statics.add_static('addV', addV) - -def aggregate(*args): - return __.aggregate(*args) - -statics.add_static('aggregate', aggregate) - -def and_(*args): - return __.and_(*args) - -statics.add_static('and_', and_) - -def as_(*args): - return __.as_(*args) - -statics.add_static('as_', as_) - -def barrier(*args): - return __.barrier(*args) - -statics.add_static('barrier', barrier) - -def both(*args): - return __.both(*args) - -statics.add_static('both', both) - -def bothE(*args): - return __.bothE(*args) - -statics.add_static('bothE', bothE) - -def bothV(*args): - return __.bothV(*args) - -statics.add_static('bothV', bothV) - -def branch(*args): - return __.branch(*args) - -statics.add_static('branch', branch) - -def cap(*args): - return __.cap(*args) - -statics.add_static('cap', cap) - -def choose(*args): - return __.choose(*args) - -statics.add_static('choose', choose) - -def coalesce(*args): - return __.coalesce(*args) - -statics.add_static('coalesce', coalesce) - -def coin(*args): - return __.coin(*args) - -statics.add_static('coin', coin) - -def constant(*args): - return __.constant(*args) - -statics.add_static('constant', constant) - -def count(*args): - return __.count(*args) - -statics.add_static('count', count) - -def cyclicPath(*args): - return __.cyclicPath(*args) - -statics.add_static('cyclicPath', cyclicPath) - -def dedup(*args): - return __.dedup(*args) - -statics.add_static('dedup', dedup) - -def drop(*args): - return __.drop(*args) - -statics.add_static('drop', drop) - -def emit(*args): - return __.emit(*args) - -statics.add_static('emit', emit) - -def filter(*args): - return __.filter(*args) - -statics.add_static('filter', filter) - -def flatMap(*args): - return __.flatMap(*args) - -statics.add_static('flatMap', flatMap) - -def fold(*args): - return __.fold(*args) - -statics.add_static('fold', fold) - -def group(*args): - return __.group(*args) - -statics.add_static('group', group) - -def groupCount(*args): - return __.groupCount(*args) - -statics.add_static('groupCount', groupCount) - -def groupV3d0(*args): - return __.groupV3d0(*args) - -statics.add_static('groupV3d0', groupV3d0) - -def has(*args): - return __.has(*args) - -statics.add_static('has', has) - -def hasId(*args): - return __.hasId(*args) - -statics.add_static('hasId', hasId) - -def hasKey(*args): - return __.hasKey(*args) - -statics.add_static('hasKey', hasKey) - -def hasLabel(*args): - return __.hasLabel(*args) - -statics.add_static('hasLabel', hasLabel) - -def hasNot(*args): - return __.hasNot(*args) - -statics.add_static('hasNot', hasNot) - -def hasValue(*args): - return __.hasValue(*args) - -statics.add_static('hasValue', hasValue) - -def id(*args): - return __.id(*args) - -statics.add_static('id', id) - -def identity(*args): - return __.identity(*args) - -statics.add_static('identity', identity) - -def inE(*args): - return __.inE(*args) - -statics.add_static('inE', inE) - -def inV(*args): - return __.inV(*args) - -statics.add_static('inV', inV) - -def in_(*args): - return __.in_(*args) - -statics.add_static('in_', in_) - -def inject(*args): - return __.inject(*args) - -statics.add_static('inject', inject) - -def is_(*args): - return __.is_(*args) - -statics.add_static('is_', is_) - -def key(*args): - return __.key(*args) - -statics.add_static('key', key) - -def label(*args): - return __.label(*args) - -statics.add_static('label', label) - -def limit(*args): - return __.limit(*args) - -statics.add_static('limit', limit) - -def local(*args): - return __.local(*args) - -statics.add_static('local', local) - -def loops(*args): - return __.loops(*args) - -statics.add_static('loops', loops) - -def map(*args): - return __.map(*args) - -statics.add_static('map', map) - -def mapKeys(*args): - return __.mapKeys(*args) - -statics.add_static('mapKeys', mapKeys) - -def mapValues(*args): - return __.mapValues(*args) - -statics.add_static('mapValues', mapValues) - -def match(*args): - return __.match(*args) - -statics.add_static('match', match) - -def max(*args): - return __.max(*args) - -statics.add_static('max', max) - -def mean(*args): - return __.mean(*args) - -statics.add_static('mean', mean) - -def min(*args): - return __.min(*args) - -statics.add_static('min', min) - -def not_(*args): - return __.not_(*args) - -statics.add_static('not_', not_) - -def optional(*args): - return __.optional(*args) - -statics.add_static('optional', optional) - -def or_(*args): - return __.or_(*args) - -statics.add_static('or_', or_) - -def order(*args): - return __.order(*args) - -statics.add_static('order', order) - -def otherV(*args): - return __.otherV(*args) - -statics.add_static('otherV', otherV) - -def out(*args): - return __.out(*args) - -statics.add_static('out', out) - -def outE(*args): - return __.outE(*args) - -statics.add_static('outE', outE) - -def outV(*args): - return __.outV(*args) - -statics.add_static('outV', outV) - -def path(*args): - return __.path(*args) - -statics.add_static('path', path) - -def project(*args): - return __.project(*args) - -statics.add_static('project', project) - -def properties(*args): - return __.properties(*args) - -statics.add_static('properties', properties) - -def property(*args): - return __.property(*args) - -statics.add_static('property', property) - -def propertyMap(*args): - return __.propertyMap(*args) - -statics.add_static('propertyMap', propertyMap) - -def range(*args): - return __.range(*args) - -statics.add_static('range', range) - -def repeat(*args): - return __.repeat(*args) - -statics.add_static('repeat', repeat) - -def sack(*args): - return __.sack(*args) - -statics.add_static('sack', sack) - -def sample(*args): - return __.sample(*args) - -statics.add_static('sample', sample) - -def select(*args): - return __.select(*args) - -statics.add_static('select', select) - -def sideEffect(*args): - return __.sideEffect(*args) - -statics.add_static('sideEffect', sideEffect) - -def simplePath(*args): - return __.simplePath(*args) - -statics.add_static('simplePath', simplePath) - -def store(*args): - return __.store(*args) - -statics.add_static('store', store) - -def subgraph(*args): - return __.subgraph(*args) - -statics.add_static('subgraph', subgraph) - -def sum(*args): - return __.sum(*args) - -statics.add_static('sum', sum) - -def tail(*args): - return __.tail(*args) - -statics.add_static('tail', tail) - -def timeLimit(*args): - return __.timeLimit(*args) - -statics.add_static('timeLimit', timeLimit) - -def times(*args): - return __.times(*args) - -statics.add_static('times', times) - -def to(*args): - return __.to(*args) - -statics.add_static('to', to) - -def toE(*args): - return __.toE(*args) - -statics.add_static('toE', toE) - -def toV(*args): - return __.toV(*args) - -statics.add_static('toV', toV) - -def tree(*args): - return __.tree(*args) - -statics.add_static('tree', tree) - -def unfold(*args): - return __.unfold(*args) - -statics.add_static('unfold', unfold) - -def union(*args): - return __.union(*args) - -statics.add_static('union', union) - -def until(*args): - return __.until(*args) - -statics.add_static('until', until) - -def value(*args): - return __.value(*args) - -statics.add_static('value', value) - -def valueMap(*args): - return __.valueMap(*args) - -statics.add_static('valueMap', valueMap) - -def values(*args): - return __.values(*args) - -statics.add_static('values', values) - -def where(*args): - return __.where(*args) - -statics.add_static('where', where) diff --git a/aiogremlin/gremlin_python/process/strategies.py b/aiogremlin/gremlin_python/process/strategies.py deleted file mode 100644 index 1ac779d5156be617e2fd300e9c0edcc3f75f5eee..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/process/strategies.py +++ /dev/null @@ -1,184 +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. -''' -'''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' - -__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' - -from aiogremlin.gremlin_python.process.traversal import TraversalStrategy - - -######################### -# DECORATION STRATEGIES # -######################### - -class ConnectiveStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class ElementIdStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -# EventStrategy doesn't make sense outside JVM traversal machine - -class HaltedTraverserStrategy(TraversalStrategy): - def __init__(self, halted_traverser_factory=None): - TraversalStrategy.__init__(self) - if halted_traverser_factory is not None: - self.configuration["haltedTraverserFactory"] = halted_traverser_factory - - -class PartitionStrategy(TraversalStrategy): - def __init__(self, partition_key=None, write_partition=None, read_partitions=None, include_meta_properties=None): - TraversalStrategy.__init__(self) - if partition_key is not None: - self.configuration["partitionKey"] = partition_key - if write_partition is not None: - self.configuration["writePartition"] = write_partition - if write_partition is not None: - self.configuration["readPartitions"] = read_partitions - if include_meta_properties is not None: - self.configuration["includeMetaProperties"] = include_meta_properties - - -class SubgraphStrategy(TraversalStrategy): - def __init__(self, vertices=None, edges=None, vertex_properties=None): - TraversalStrategy.__init__(self) - if vertices is not None: - self.configuration["vertices"] = vertices - if edges is not None: - self.configuration["edges"] = edges - if vertex_properties is not None: - self.configuration["vertexProperties"] = vertex_properties - - -class VertexProgramStrategy(TraversalStrategy): - def __init__(self, graph_computer=None, workers=None, persist=None, result=None, vertices=None, edges=None, - configuration=None): - TraversalStrategy.__init__(self) - if graph_computer is not None: - self.configuration["graphComputer"] = graph_computer - if workers is not None: - self.configuration["workers"] = workers - if persist is not None: - self.configuration["persist"] = persist - if result is not None: - self.configuration["result"] = result - if vertices is not None: - self.configuration["vertices"] = vertices - if edges is not None: - self.configuration["edges"] = edges - if configuration is not None: - self.configuration.update(configuration) - - -########################### -# FINALIZATION STRATEGIES # -########################### - -class MatchAlgorithmStrategy(TraversalStrategy): - def __init__(self, match_algorithm=None): - TraversalStrategy.__init__(self) - if match_algorithm is not None: - self.configuration["matchAlgorithm"] = match_algorithm - - -########################### -# OPTIMIZATION STRATEGIES # -########################### - -class AdjacentToIncidentStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class FilterRankingStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class IdentityRemoveStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class IncidentToAdjacentStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class InlineFilterStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class LazyBarrierStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class MatchPredicateStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class OrderLimitStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class PathProcessorStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class PathRetractionStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class RangeByIsCountStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class RepeatUnrollStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class GraphFilterStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -########################### -# VERIFICATION STRATEGIES # -########################### - -class LambdaRestrictionStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) - - -class ReadOnlyStrategy(TraversalStrategy): - def __init__(self): - TraversalStrategy.__init__(self) diff --git a/aiogremlin/gremlin_python/process/traversal.py b/aiogremlin/gremlin_python/process/traversal.py deleted file mode 100644 index b0e98f4e53f2be47db38642253d3807af136e5b9..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/process/traversal.py +++ /dev/null @@ -1,396 +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. -''' -'''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' -import asyncio -from enum import Enum -from aiogremlin.gremlin_python import statics - - -class Traversal(object): - def __init__(self, graph, traversal_strategies, bytecode): - self.graph = graph - self.traversal_strategies = traversal_strategies - self.bytecode = bytecode - self.side_effects = TraversalSideEffects() - self.traversers = None - self.last_traverser = None - def __repr__(self): - return str(self.bytecode) - def __eq__(self, other): - if isinstance(other, self.__class__): - return self.bytecode == other.bytecode - else: - return False - async def __aiter__(self): - return self - async def __anext__(self): - if self.traversers is None: - await self.traversal_strategies.apply_strategies(self) - if self.last_traverser is None: - self.last_traverser = await self.traversers.__anext__() - object = self.last_traverser.object - self.last_traverser.bulk = self.last_traverser.bulk - 1 - if self.last_traverser.bulk <= 0: - self.last_traverser = None - return object - async def toList(self): - results = [] - async for result in self: - results.append(result) - return results - async def toSet(self): - results = set() - async for result in self: - results.add(result) - return results - async def iterate(self): - while True: - try: - await self.nextTraverser() - except StopAsyncIteration: - return self - async def nextTraverser(self): - if self.traversers is None: - await self.traversal_strategies.apply_strategies(self) - if self.last_traverser is None: - return await self.traversers.__anext__() - else: - temp = self.last_traverser - self.last_traverser = None - return temp - async def next(self, amount=None): - if not amount: - try: - return await self.__anext__() - except StopAsyncIteration: - return - results = [] - for i in range(amount): - try: - result = await self.__anext__() - except StopAsyncIteration: - return results - results.append(result) - return results - - -Barrier = Enum('Barrier', 'normSack') -statics.add_static('normSack', Barrier.normSack) - -Cardinality = Enum('Cardinality', 'list_ set_ single') -statics.add_static('single', Cardinality.single) -statics.add_static('list_', Cardinality.list_) -statics.add_static('set_', Cardinality.set_) - -Column = Enum('Column', 'keys values') -statics.add_static('keys', Column.keys) -statics.add_static('values', Column.values) - -Direction = Enum('Direction', 'BOTH IN OUT') -statics.add_static('OUT', Direction.OUT) -statics.add_static('IN', Direction.IN) -statics.add_static('BOTH', Direction.BOTH) - -Operator = Enum('Operator', 'addAll and_ assign div max min minus mult or_ sum sumLong') -statics.add_static('sum', Operator.sum) -statics.add_static('minus', Operator.minus) -statics.add_static('mult', Operator.mult) -statics.add_static('div', Operator.div) -statics.add_static('min', Operator.min) -statics.add_static('max', Operator.max) -statics.add_static('assign', Operator.assign) -statics.add_static('and_', Operator.and_) -statics.add_static('or_', Operator.or_) -statics.add_static('addAll', Operator.addAll) -statics.add_static('sumLong', Operator.sumLong) - -Order = Enum('Order', 'decr incr keyDecr keyIncr shuffle valueDecr valueIncr') -statics.add_static('incr', Order.incr) -statics.add_static('decr', Order.decr) -statics.add_static('keyIncr', Order.keyIncr) -statics.add_static('valueIncr', Order.valueIncr) -statics.add_static('keyDecr', Order.keyDecr) -statics.add_static('valueDecr', Order.valueDecr) -statics.add_static('shuffle', Order.shuffle) - -Pick = Enum('Pick', 'any none') -statics.add_static('any', Pick.any) -statics.add_static('none', Pick.none) - -Pop = Enum('Pop', 'all_ first last') -statics.add_static('first', Pop.first) -statics.add_static('last', Pop.last) -statics.add_static('all_', Pop.all_) - -Scope = Enum('Scope', 'global_ local') -statics.add_static('global_', Scope.global_) -statics.add_static('local', Scope.local) - -T = Enum('T', 'id key label value') -statics.add_static('label', T.label) -statics.add_static('id', T.id) -statics.add_static('key', T.key) -statics.add_static('value', T.value) - -class P(object): - def __init__(self, operator, value, other=None): - self.operator = operator - self.value = value - self.other = other - @staticmethod - def between(*args): - return P("between", *args) - @staticmethod - def eq(*args): - return P("eq", *args) - @staticmethod - def gt(*args): - return P("gt", *args) - @staticmethod - def gte(*args): - return P("gte", *args) - @staticmethod - def inside(*args): - return P("inside", *args) - @staticmethod - def lt(*args): - return P("lt", *args) - @staticmethod - def lte(*args): - return P("lte", *args) - @staticmethod - def neq(*args): - return P("neq", *args) - @staticmethod - def not_(*args): - return P("not", *args) - @staticmethod - def outside(*args): - return P("outside", *args) - @staticmethod - def test(*args): - return P("test", *args) - @staticmethod - def within(*args): - return P("within", *args) - @staticmethod - def without(*args): - return P("without", *args) - def and_(self, arg): - return P("and", self, arg) - def or_(self, arg): - return P("or", self, arg) - def __eq__(self, other): - return isinstance(other, self.__class__) and self.operator == other.operator and self.value == other.value and self.other == other.other - def __repr__(self): - return self.operator + "(" + str(self.value) + ")" if self.other is None else self.operator + "(" + str(self.value) + "," + str(self.other) + ")" - -def between(*args): - return P.between(*args) -statics.add_static('between',between) - -def eq(*args): - return P.eq(*args) -statics.add_static('eq',eq) - -def gt(*args): - return P.gt(*args) -statics.add_static('gt',gt) - -def gte(*args): - return P.gte(*args) -statics.add_static('gte',gte) - -def inside(*args): - return P.inside(*args) -statics.add_static('inside',inside) - -def lt(*args): - return P.lt(*args) -statics.add_static('lt',lt) - -def lte(*args): - return P.lte(*args) -statics.add_static('lte',lte) - -def neq(*args): - return P.neq(*args) -statics.add_static('neq',neq) - -def not_(*args): - return P.not_(*args) -statics.add_static('not_',not_) - -def outside(*args): - return P.outside(*args) -statics.add_static('outside',outside) - -def test(*args): - return P.test(*args) -statics.add_static('test',test) - -def within(*args): - return P.within(*args) -statics.add_static('within',within) - -def without(*args): - return P.without(*args) -statics.add_static('without',without) - - - -''' -TRAVERSER -''' - -class Traverser(object): - def __init__(self, object, bulk=None): - if bulk is None: - bulk = statics.long(1) - self.object = object - self.bulk = bulk - def __repr__(self): - return str(self.object) - def __eq__(self, other): - return isinstance(other, self.__class__) and self.object == other.object - -''' -TRAVERSAL SIDE-EFFECTS -''' - -class TraversalSideEffects(object): - def keys(self): - return set() - def get(self, key): - raise KeyError(key) - def __getitem__(self, key): - return self.get(key) - def __repr__(self): - return "sideEffects[size:" + str(len(self.keys())) + "]" - -''' -TRAVERSAL STRATEGIES -''' - -class TraversalStrategies(object): - global_cache = {} - def __init__(self, traversal_strategies=None): - self.traversal_strategies = traversal_strategies.traversal_strategies if traversal_strategies is not None else [] - def add_strategies(self, traversal_strategies): - self.traversal_strategies = self.traversal_strategies + traversal_strategies - async def apply_strategies(self, traversal): - for traversal_strategy in self.traversal_strategies: - func = traversal_strategy.apply(traversal) - if asyncio.iscoroutine(func): - await func - def __repr__(self): - return str(self.traversal_strategies) - - -class TraversalStrategy(object): - def __init__(self, strategy_name=None, configuration=None): - self.strategy_name = type(self).__name__ if strategy_name is None else strategy_name - self.configuration = {} if configuration is None else configuration - def apply(self, traversal): - return - def apply_async(self, traversal): - return - def __eq__(self, other): - return isinstance(other, self.__class__) - def __hash__(self): - return hash(self.strategy_name) - def __repr__(self): - return self.strategy_name - -''' -BYTECODE -''' - -class Bytecode(object): - def __init__(self, bytecode=None): - self.source_instructions = [] - self.step_instructions = [] - self.bindings = {} - if bytecode is not None: - self.source_instructions = list(bytecode.source_instructions) - self.step_instructions = list(bytecode.step_instructions) - def add_source(self, source_name, *args): - instruction = [source_name] - for arg in args: - instruction.append(self.__convertArgument(arg)) - self.source_instructions.append(instruction) - def add_step(self, step_name, *args): - instruction = [step_name] - for arg in args: - instruction.append(self.__convertArgument(arg)) - self.step_instructions.append(instruction) - def __eq__(self, other): - if isinstance(other, self.__class__): - return self.source_instructions == other.source_instructions and self.step_instructions == other.step_instructions - else: - return False - def __convertArgument(self,arg): - if isinstance(arg, Traversal): - self.bindings.update(arg.bytecode.bindings) - return arg.bytecode - elif isinstance(arg, dict): - newDict = {} - for key in arg: - newDict[self.__convertArgument(key)] = self.__convertArgument(arg[key]) - return newDict - elif isinstance(arg, list): - newList = [] - for item in arg: - newList.append(self.__convertArgument(item)) - return newList - elif isinstance(arg, set): - newSet = set() - for item in arg: - newSet.add(self.__convertArgument(item)) - return newSet - elif isinstance(arg, tuple) and 2 == len(arg) and isinstance(arg[0], str): - self.bindings[arg[0]] = arg[1] - return Binding(arg[0],self.__convertArgument(arg[1])) - else: - return arg - def __repr__(self): - return (str(self.source_instructions) if len(self.source_instructions) > 0 else "") + \ - (str(self.step_instructions) if len(self.step_instructions) > 0 else "") - - -''' -BINDINGS -''' - -class Bindings(object): - def of(self,key,value): - if not isinstance(key, str): - raise TypeError("Key must be str") - return (key,value) - -class Binding(object): - def __init__(self,key,value): - self.key = key - self.value = value - def __eq__(self, other): - return isinstance(other, self.__class__) and self.key == other.key and self.value == other.value - def __hash__(self): - return hash(self.key) + hash(self.value) - def __repr__(self): - return "binding[" + self.key + "=" + str(self.value) + "]" diff --git a/aiogremlin/gremlin_python/statics.py b/aiogremlin/gremlin_python/statics.py deleted file mode 100644 index e8ee220005bc01904969c7d802397ddb2eaa3fa3..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/statics.py +++ /dev/null @@ -1,57 +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. -''' -'''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' -from types import FunctionType - -from enum import Enum - - -class long(int): pass -FloatType = float -IntType = int -LongType = long -TypeType = type - - -staticMethods = {} -staticEnums = {} -default_lambda_language = "gremlin-python" - - -def add_static(key, value): - if isinstance(value, Enum): - staticEnums[key] = value - else: - staticMethods[key] = value - - -def load_statics(global_dict): - for key in staticMethods: - global_dict[key] = staticMethods[key] - for key in staticEnums: - global_dict[key] = staticEnums[key] - - -def unload_statics(global_dict): - for key in staticMethods: - if key in global_dict: - del global_dict[key] - for key in staticEnums: - if key in global_dict: - del global_dict[key] diff --git a/aiogremlin/gremlin_python/structure/__init__.py b/aiogremlin/gremlin_python/structure/__init__.py deleted file mode 100644 index 7626550738f12ccd5e18b8c06a8d68aaab882066..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/structure/__init__.py +++ /dev/null @@ -1,20 +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. -''' - -__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' diff --git a/aiogremlin/gremlin_python/structure/graph.py b/aiogremlin/gremlin_python/structure/graph.py deleted file mode 100644 index e7fe22e85d1a32436a14d35742fb5faec4196fd7..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/structure/graph.py +++ /dev/null @@ -1,123 +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. -''' -'''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' -__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' - -from aiogremlin.gremlin_python.process.graph_traversal import GraphTraversalSource -from aiogremlin.gremlin_python.process.traversal import TraversalStrategies - - -class Graph(object): - def __init__(self): - if self.__class__ not in TraversalStrategies.global_cache: - TraversalStrategies.global_cache[self.__class__] = TraversalStrategies() - - def traversal(self): - return GraphTraversalSource( - self, TraversalStrategies.global_cache[self.__class__]) - - def __repr__(self): - return "graph[empty]" - - -class Element(object): - def __init__(self, id, label): - self.id = id - self.label = label - - def __eq__(self, other): - return isinstance(other, self.__class__) and self.id == other.id - - def __hash__(self): - return hash(self.id) - - -class Vertex(Element): - def __init__(self, id, label="vertex"): - Element.__init__(self, id, label) - - def __repr__(self): - return "v[" + str(self.id) + "]" - - -class Edge(Element): - def __init__(self, id, outV, label, inV): - Element.__init__(self, id, label) - self.outV = outV - self.inV = inV - - def __repr__(self): - return "e[" + str(self.id) + "][" + str(self.outV.id) + "-" + self.label + "->" + str(self.inV.id) + "]" - - -class VertexProperty(Element): - def __init__(self, id, label, value): - Element.__init__(self, id, label) - self.value = value - self.key = self.label - - def __repr__(self): - return "vp[" + str(self.label) + "->" + str(self.value)[0:20] + "]" - - -class Property(object): - def __init__(self, key, value): - self.key = key - self.value = value - - def __repr__(self): - return "p[" + str(self.key) + "->" + str(self.value)[0:20] + "]" - - def __eq__(self, other): - return isinstance(other, self.__class__) and self.key == other.key and self.value == other.value - - def __hash__(self): - return hash(self.key) + hash(self.value) - - -class Path(object): - def __init__(self, labels, objects): - self.labels = labels - self.objects = objects - - def __repr__(self): - return str(self.objects) - - def __eq__(self, other): - return isinstance(other, self.__class__) and self.objects == other.objects and self.labels == other.labels - - def __hash__(self): - return hash(str(self.objects)) + hash(str(self.labels)) - - def __getitem__(self, key): - if isinstance(key, str): - objects = [] - for i, labels in enumerate(self.labels): - if key in labels: - objects.append(self.objects[i]) - if 0 == len(objects): - raise KeyError("The step with label " + key + " does not exist") - return objects if len(objects) > 1 else objects[0] - elif isinstance(key, int): - return self.objects[key] - else: - raise TypeError("The path access key must be either a string label or integer index") - - def __len__(self): - return len(self.objects) diff --git a/aiogremlin/gremlin_python/structure/io/__init__.py b/aiogremlin/gremlin_python/structure/io/__init__.py deleted file mode 100644 index 7626550738f12ccd5e18b8c06a8d68aaab882066..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/structure/io/__init__.py +++ /dev/null @@ -1,20 +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. -''' - -__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' diff --git a/aiogremlin/gremlin_python/structure/io/graphson.py b/aiogremlin/gremlin_python/structure/io/graphson.py deleted file mode 100644 index 6a29ace617945777d0f6f24948086636bd9a6fda..0000000000000000000000000000000000000000 --- a/aiogremlin/gremlin_python/structure/io/graphson.py +++ /dev/null @@ -1,341 +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. -''' -'''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' -from enum import Enum -import json - -from aiogremlin.gremlin_python import statics -from aiogremlin.gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType -from aiogremlin.gremlin_python.process.traversal import Binding, Bytecode, P, Traversal, Traverser, TraversalStrategy -from aiogremlin.gremlin_python.structure.graph import Edge, Property, Vertex, VertexProperty, Path - - -_serializers = {} -_deserializers = {} - - -class GraphSONTypeType(type): - def __new__(mcs, name, bases, dct): - cls = super(GraphSONTypeType, mcs).__new__(mcs, name, bases, dct) - if not name.startswith('_'): - if cls.python_type: - _serializers[cls.python_type] = cls - if cls.graphson_type: - _deserializers[cls.graphson_type] = cls - return cls - - -class GraphSONUtil(object): - TYPE_KEY = "@type" - VALUE_KEY = "@value" - - @classmethod - def typedValue(cls, type_name, value, prefix="g"): - out = {cls.TYPE_KEY: cls.formatType(prefix, type_name)} - if value is not None: - out[cls.VALUE_KEY] = value - return out - - @classmethod - def formatType(cls, prefix, type_name): - return "%s:%s" % (prefix, type_name) - -# Read/Write classes split to follow precedence of the Java API -class GraphSONWriter(object): - - def __init__(self, serializer_map=None): - """ - :param serializer_map: map from Python type to serializer instance implementing `dictify` - """ - self.serializers = _serializers.copy() - if serializer_map: - self.serializers.update(serializer_map) - - def writeObject(self, objectData): - # to JSON - return json.dumps(self.toDict(objectData), separators=(',', ':')) - - def toDict(self, obj): - """ - Encodes python objects in GraphSON type-tagged dict values - """ - try: - return self.serializers[type(obj)].dictify(obj, self) - except KeyError: - for key, serializer in self.serializers.items(): - if isinstance(obj, key): - return serializer.dictify(obj, self) - - # list and map are treated as normal json objs (could be isolated serializers) - if isinstance(obj, (list, set)): - return [self.toDict(o) for o in obj] - elif isinstance(obj, dict): - return dict((self.toDict(k), self.toDict(v)) for k, v in obj.items()) - else: - return obj - - -class GraphSONReader(object): - - def __init__(self, deserializer_map=None): - """ - :param deserializer_map: map from GraphSON type tag to deserializer instance implementing `objectify` - """ - self.deserializers = _deserializers.copy() - if deserializer_map: - self.deserializers.update(deserializer_map) - - def readObject(self, jsonData): - # from JSON - return self.toObject(json.loads(jsonData)) - - def toObject(self, obj): - """ - Unpacks GraphSON type-tagged dict values into objects mapped in self.deserializers - """ - if isinstance(obj, dict): - try: - return self.deserializers[obj[GraphSONUtil.TYPE_KEY]].objectify(obj[GraphSONUtil.VALUE_KEY], self) - except KeyError: - pass - # list and map are treated as normal json objs (could be isolated deserializers) - return dict((self.toObject(k), self.toObject(v)) for k, v in obj.items()) - elif isinstance(obj, list): - return [self.toObject(o) for o in obj] - else: - return obj - - -class _GraphSONTypeIO(metaclass=GraphSONTypeType): - python_type = None - graphson_type = None - - symbolMap = {"global_": "global", "as_": "as", "in_": "in", "and_": "and", - "or_": "or", "is_": "is", "not_": "not", "from_": "from", - "set_": "set", "list_": "list", "all_": "all"} - - @classmethod - def unmangleKeyword(cls, symbol): - return cls.symbolMap.get(symbol, symbol) - - def dictify(self, obj, writer): - raise NotImplementedError() - - def objectify(self, d, reader): - raise NotImplementedError() - - -class _BytecodeSerializer(_GraphSONTypeIO): - - @classmethod - def _dictify_instructions(cls, instructions, writer): - out = [] - for instruction in instructions: - inst = [instruction[0]] - inst.extend(writer.toDict(arg) for arg in instruction[1:]) - out.append(inst) - return out - - @classmethod - def dictify(cls, bytecode, writer): - if isinstance(bytecode, Traversal): - bytecode = bytecode.bytecode - out = {} - if bytecode.source_instructions: - out["source"] = cls._dictify_instructions(bytecode.source_instructions, writer) - if bytecode.step_instructions: - out["step"] = cls._dictify_instructions(bytecode.step_instructions, writer) - return GraphSONUtil.typedValue("Bytecode", out) - - -class TraversalSerializer(_BytecodeSerializer): - python_type = Traversal - - -class BytecodeSerializer(_BytecodeSerializer): - python_type = Bytecode - - -class TraversalStrategySerializer(_GraphSONTypeIO): - python_type = TraversalStrategy - - @classmethod - def dictify(cls, strategy, writer): - return GraphSONUtil.typedValue(strategy.strategy_name, writer.toDict(strategy.configuration)) - - -class TraverserIO(_GraphSONTypeIO): - python_type = Traverser - graphson_type = "g:Traverser" - - @classmethod - def dictify(cls, traverser, writer): - return GraphSONUtil.typedValue("Traverser", {"value": writer.toDict(traverser.object), - "bulk": writer.toDict(traverser.bulk)}) - - @classmethod - def objectify(cls, d, reader): - return Traverser(reader.toObject(d["value"]), - reader.toObject(d["bulk"])) - - -class EnumSerializer(_GraphSONTypeIO): - python_type = Enum - - @classmethod - def dictify(cls, enum, _): - return GraphSONUtil.typedValue(cls.unmangleKeyword(type(enum).__name__), - cls.unmangleKeyword(str(enum.name))) - - -class PSerializer(_GraphSONTypeIO): - python_type = P - - @classmethod - def dictify(cls, p, writer): - out = {"predicate": p.operator, - "value": [writer.toDict(p.value), writer.toDict(p.other)] if p.other is not None else - writer.toDict(p.value)} - return GraphSONUtil.typedValue("P", out) - - -class BindingSerializer(_GraphSONTypeIO): - python_type = Binding - - @classmethod - def dictify(cls, binding, writer): - out = {"key": binding.key, - "value": writer.toDict(binding.value)} - return GraphSONUtil.typedValue("Binding", out) - - -class LambdaSerializer(_GraphSONTypeIO): - python_type = FunctionType - - @classmethod - def dictify(cls, lambda_object, writer): - lambda_result = lambda_object() - script = lambda_result if isinstance(lambda_result, str) else lambda_result[0] - language = statics.default_lambda_language if isinstance(lambda_result, str) else lambda_result[1] - out = {"script": script, - "language": language} - if language == "gremlin-jython" or language == "gremlin-python": - if not script.strip().startswith("lambda"): - script = "lambda " + script - out["script"] = script - out["arguments"] = eval(out["script"]).__code__.co_argcount - else: - out["arguments"] = -1 - return GraphSONUtil.typedValue("Lambda", out) - - -class TypeSerializer(_GraphSONTypeIO): - python_type = TypeType - - @classmethod - def dictify(cls, typ, writer): - return writer.toDict(typ()) - - -class _NumberIO(_GraphSONTypeIO): - - @classmethod - def dictify(cls, n, writer): - if isinstance(n, bool): # because isinstance(False, int) and isinstance(True, int) - return n - return GraphSONUtil.typedValue(cls.graphson_base_type, n) - - @classmethod - def objectify(cls, v, _): - return cls.python_type(v) - - -class FloatIO(_NumberIO): - python_type = FloatType - graphson_type = "g:Float" - graphson_base_type = "Float" - - -class DoubleIO(FloatIO): - graphson_type = "g:Double" - graphson_base_type = "Double" - - -class Int64IO(_NumberIO): - python_type = LongType - graphson_type = "g:Int64" - graphson_base_type = "Int64" - - -class Int32IO(_NumberIO): - python_type = IntType - graphson_type = "g:Int32" - graphson_base_type = "Int32" - - @classmethod - def dictify(cls, n, writer): - if isinstance(n, bool): - return n - return GraphSONUtil.typedValue(cls.graphson_base_type, n) - - -class VertexDeserializer(_GraphSONTypeIO): - graphson_type = "g:Vertex" - - @classmethod - def objectify(cls, d, reader): - return Vertex(reader.toObject(d["id"]), d.get("label", "")) - - -class EdgeDeserializer(_GraphSONTypeIO): - graphson_type = "g:Edge" - - @classmethod - def objectify(cls, d, reader): - return Edge(reader.toObject(d["id"]), - Vertex(reader.toObject(d["outV"]), ""), - d.get("label", "vertex"), - Vertex(reader.toObject(d["inV"]), "")) - - -class VertexPropertyDeserializer(_GraphSONTypeIO): - graphson_type = "g:VertexProperty" - - @classmethod - def objectify(cls, d, reader): - return VertexProperty(reader.toObject(d["id"]), d["label"], - reader.toObject(d["value"])) - - -class PropertyDeserializer(_GraphSONTypeIO): - graphson_type = "g:Property" - - @classmethod - def objectify(cls, d, reader): - return Property(d["key"], reader.toObject(d["value"])) - - -class PathDeserializer(_GraphSONTypeIO): - graphson_type = "g:Path" - - @classmethod - def objectify(cls, d, reader): - labels = [set(label) for label in d["labels"]] - objects = [reader.toObject(o) for o in d["objects"]] - return Path(labels, objects) diff --git a/aiogremlin/process/__init__.py b/aiogremlin/process/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/aiogremlin/process/graph_traversal.py b/aiogremlin/process/graph_traversal.py new file mode 100644 index 0000000000000000000000000000000000000000..6d64aff484557885a59a42f9ebedd902c7600ffe --- /dev/null +++ b/aiogremlin/process/graph_traversal.py @@ -0,0 +1,99 @@ +from aiogremlin.process.traversal import TraversalStrategies +from aiogremlin.remote.remote_connection import RemoteStrategy + +from gremlin_python.process import graph_traversal, traversal + + + +class AsyncGraphTraversal(graph_traversal.GraphTraversal): + """Implements async iteration protocol and updates relevant methods""" + + async def __aiter__(self): + return self + + async def __anext__(self): + if self.traversers is None: + await self.traversal_strategies.apply_strategies(self) + if self.last_traverser is None: + self.last_traverser = await self.traversers.__anext__() + object = self.last_traverser.object + self.last_traverser.bulk = self.last_traverser.bulk - 1 + if self.last_traverser.bulk <= 0: + self.last_traverser = None + return object + + async def toList(self): + results = [] + async for result in self: + results.append(result) + return results + + async def toSet(self): + results = set() + async for result in self: + results.add(result) + return results + + async def iterate(self): + while True: + try: + await self.nextTraverser() + except StopAsyncIteration: + return self + except StopAsyncIteration: + return + results = [] + for i in range(amount): + try: + result = await self.__anext__() + except StopAsyncIteration: + return results + results.append(result) + return results + + async def nextTraverser(self): + if self.traversers is None: + await self.traversal_strategies.apply_strategies(self) + if self.last_traverser is None: + return await self.traversers.__anext__() + else: + temp = self.last_traverser + self.last_traverser = None + return temp + + async def next(self, amount=None): + if not amount: + try: + return await self.__anext__() + except StopAsyncIteration: + return + results = [] + for i in range(amount): + try: + result = await self.__anext__() + except StopAsyncIteration: + return results + results.append(result) + return results + + +class __(graph_traversal.__): + + graph_traversal = AsyncGraphTraversal + + +class AsyncGraphTraversalSource(graph_traversal.GraphTraversalSource): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.graph_traversal = AsyncGraphTraversal + + def withRemote(self, remote_connection): + source = self.get_graph_traversal_source() + source.traversal_strategies.add_strategies([RemoteStrategy(remote_connection)]) + return source + + def get_graph_traversal_source(self): + return self.__class__( + self.graph, TraversalStrategies(self.traversal_strategies), + traversal.Bytecode(self.bytecode)) diff --git a/aiogremlin/process/traversal.py b/aiogremlin/process/traversal.py new file mode 100644 index 0000000000000000000000000000000000000000..d88253c46deae5cf3a5b3c4a9c23c4fa6d996eda --- /dev/null +++ b/aiogremlin/process/traversal.py @@ -0,0 +1,13 @@ +import asyncio + +from gremlin_python.process import traversal + + +class TraversalStrategies(traversal.TraversalStrategies): + global_cache = {} + + async def apply_strategies(self, traversal): + for traversal_strategy in self.traversal_strategies: + func = traversal_strategy.apply(traversal) + if asyncio.iscoroutine(func): + await func diff --git a/aiogremlin/remote/driver_remote_connection.py b/aiogremlin/remote/driver_remote_connection.py index 4532da2b6386c44aa4600e9035fbe9e514ca3ca8..98507ff0ae5bc92a6bebf32ed319b6ebab52dcd2 100644 --- a/aiogremlin/remote/driver_remote_connection.py +++ b/aiogremlin/remote/driver_remote_connection.py @@ -2,9 +2,9 @@ import asyncio from urllib.parse import urlparse from aiogremlin.driver.cluster import Cluster -from aiogremlin.gremlin_python.driver import serializer +from gremlin_python.driver import serializer from aiogremlin.remote.driver_remote_side_effects import RemoteTraversalSideEffects -from aiogremlin.gremlin_python.driver.remote_connection import RemoteTraversal +from aiogremlin.remote.remote_connection import RemoteTraversal __author__ = 'David M. Brown (davebshow@gmail.com)' diff --git a/aiogremlin/remote/driver_remote_side_effects.py b/aiogremlin/remote/driver_remote_side_effects.py index d888b47c4efaacad28f34d66900ea724b625a0ed..375c0abcf1c295e001c22fbfdfe9be658c05cbb9 100644 --- a/aiogremlin/remote/driver_remote_side_effects.py +++ b/aiogremlin/remote/driver_remote_side_effects.py @@ -1,5 +1,5 @@ -from aiogremlin.gremlin_python.driver import request -from aiogremlin.gremlin_python.process import traversal +from gremlin_python.driver import request +from gremlin_python.process import traversal diff --git a/aiogremlin/remote/remote_connection.py b/aiogremlin/remote/remote_connection.py new file mode 100644 index 0000000000000000000000000000000000000000..75268496314ee5ce935a4446ea3674d7eca563e3 --- /dev/null +++ b/aiogremlin/remote/remote_connection.py @@ -0,0 +1,29 @@ +from gremlin_python.process import traversal + + +class RemoteStrategy(traversal.TraversalStrategy): + def __init__(self, remote_connection): + self.remote_connection = remote_connection + + async def apply(self, traversal): + if traversal.traversers is None: + remote_traversal = await self.remote_connection.submit( + traversal.bytecode) + traversal.remote_results = remote_traversal + traversal.side_effects = remote_traversal.side_effects + traversal.traversers = remote_traversal.traversers + + +class RemoteTraversal(traversal.Traversal): + def __init__(self, traversers, side_effects): + super(RemoteTraversal, self).__init__(None, None, None) + self.traversers = traversers + self._side_effects = side_effects + + @property + def side_effects(self): + return self._side_effects + + @side_effects.setter + def side_effects(self, val): + self._side_effects = val diff --git a/aiogremlin/structure/__init__.py b/aiogremlin/structure/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/aiogremlin/structure/graph.py b/aiogremlin/structure/graph.py new file mode 100644 index 0000000000000000000000000000000000000000..530360489efe45ab0a4cf0e70826521f826292ff --- /dev/null +++ b/aiogremlin/structure/graph.py @@ -0,0 +1,17 @@ +from aiogremlin.process import graph_traversal +from aiogremlin.process.traversal import TraversalStrategies + +from gremlin_python.structure import graph + + +class Graph(graph.Graph): + + def __init__(self): + if self.__class__ not in TraversalStrategies.global_cache: + TraversalStrategies.global_cache[self.__class__] = TraversalStrategies() + + def traversal(self, traversal_source_class=None): + if not traversal_source_class: + traversal_source_class = graph_traversal.AsyncGraphTraversalSource + return traversal_source_class( + self, TraversalStrategies.global_cache[self.__class__]) diff --git a/docs/aiogremlin.gremlin_python.driver.rst b/docs/aiogremlin.gremlin_python.driver.rst deleted file mode 100644 index 2eb5595197fe0cd4f613f7b6a1aad82e4376498c..0000000000000000000000000000000000000000 --- a/docs/aiogremlin.gremlin_python.driver.rst +++ /dev/null @@ -1,45 +0,0 @@ -aiogremlin.gremlin_python.driver package -======================================== - -Submodules ----------- - -aiogremlin.gremlin_python.driver.protocol module ------------------------------------------------- - -.. automodule:: aiogremlin.gremlin_python.driver.protocol - :members: - :undoc-members: - :show-inheritance: - -aiogremlin.gremlin_python.driver.remote_connection module ---------------------------------------------------------- - -.. automodule:: aiogremlin.gremlin_python.driver.remote_connection - :members: - :undoc-members: - :show-inheritance: - -aiogremlin.gremlin_python.driver.request module ------------------------------------------------ - -.. automodule:: aiogremlin.gremlin_python.driver.request - :members: - :undoc-members: - :show-inheritance: - -aiogremlin.gremlin_python.driver.serializer module --------------------------------------------------- - -.. automodule:: aiogremlin.gremlin_python.driver.serializer - :members: - :undoc-members: - :show-inheritance: - -aiogremlin.gremlin_python.driver.transport module -------------------------------------------------- - -.. automodule:: aiogremlin.gremlin_python.driver.transport - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/aiogremlin.gremlin_python.process.rst b/docs/aiogremlin.gremlin_python.process.rst deleted file mode 100644 index 7cc2fdd25d9c33475cd8b58485c37ff50f69a5e9..0000000000000000000000000000000000000000 --- a/docs/aiogremlin.gremlin_python.process.rst +++ /dev/null @@ -1,29 +0,0 @@ -aiogremlin.gremlin_python.process package -========================================= - -Submodules ----------- - -aiogremlin.gremlin_python.process.graph_traversal module --------------------------------------------------------- - -.. automodule:: aiogremlin.gremlin_python.process.graph_traversal - :members: - :undoc-members: - :show-inheritance: - -aiogremlin.gremlin_python.process.strategies module ---------------------------------------------------- - -.. automodule:: aiogremlin.gremlin_python.process.strategies - :members: - :undoc-members: - :show-inheritance: - -aiogremlin.gremlin_python.process.traversal module --------------------------------------------------- - -.. automodule:: aiogremlin.gremlin_python.process.traversal - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/aiogremlin.gremlin_python.rst b/docs/aiogremlin.gremlin_python.rst deleted file mode 100644 index 7921453e676f4b7728102ffa085eadf77cccef70..0000000000000000000000000000000000000000 --- a/docs/aiogremlin.gremlin_python.rst +++ /dev/null @@ -1,22 +0,0 @@ -aiogremlin.gremlin_python package -================================= - -Subpackages ------------ - -.. toctree:: - - aiogremlin.gremlin_python.driver - aiogremlin.gremlin_python.process - aiogremlin.gremlin_python.structure - -Submodules ----------- - -aiogremlin.gremlin_python.statics module ----------------------------------------- - -.. automodule:: aiogremlin.gremlin_python.statics - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/aiogremlin.gremlin_python.structure.io.rst b/docs/aiogremlin.gremlin_python.structure.io.rst deleted file mode 100644 index 547f898395aca2155da2361056a8ffb74333c9da..0000000000000000000000000000000000000000 --- a/docs/aiogremlin.gremlin_python.structure.io.rst +++ /dev/null @@ -1,13 +0,0 @@ -aiogremlin.gremlin_python.structure.io package -============================================== - -Submodules ----------- - -aiogremlin.gremlin_python.structure.io.graphson module ------------------------------------------------------- - -.. automodule:: aiogremlin.gremlin_python.structure.io.graphson - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/aiogremlin.gremlin_python.structure.rst b/docs/aiogremlin.gremlin_python.structure.rst deleted file mode 100644 index 3c12f02a101076205bc235bea5c1599981525dc0..0000000000000000000000000000000000000000 --- a/docs/aiogremlin.gremlin_python.structure.rst +++ /dev/null @@ -1,20 +0,0 @@ -aiogremlin.gremlin_python.structure package -=========================================== - -Subpackages ------------ - -.. toctree:: - - aiogremlin.gremlin_python.structure.io - -Submodules ----------- - -aiogremlin.gremlin_python.structure.graph module ------------------------------------------------- - -.. automodule:: aiogremlin.gremlin_python.structure.graph - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/aiogremlin.rst b/docs/aiogremlin.rst index e61427b2092f8d4438592a975f96c5a49df4f62c..9af90422a3e1fbcf76ca0de16e53f1d30acf727c 100644 --- a/docs/aiogremlin.rst +++ b/docs/aiogremlin.rst @@ -7,7 +7,7 @@ Subpackages .. toctree:: aiogremlin.driver - aiogremlin.gremlin_python + gremlin_python aiogremlin.remote Submodules diff --git a/docs/usage.rst b/docs/usage.rst index 086b23231a90b14ed7903f2c11f8c0b3b4fcf12c..60ee2ecbfadd7b7654a32652fbf61334ba6d539b 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -23,14 +23,14 @@ to focus on the syntax used by :py:mod:`aiogremlin`. To create a traversal source, simply use :py:class:`DriverRemoteConnection<aiogremlin.remote.driver_remote_connection.DriverRemoteConnection>` -combined with :py:class:`Graph<aiogremlin.gremlin_python.structure.graph.Graph>`:: +combined with :py:class:`Graph<gremlin_python.structure.graph.Graph>`:: >>> remote_connection = await DriverRemoteConnection.open( ... 'ws://localhost:8182/gremlin', 'g') >>> g = Graph().traversal().withRemote(remote_connection) In :py:mod:`aiogremlin`, a -:py:class:`Traversal<aiogremlin.gremlin_python.process.traversal.Traversal>` +:py:class:`Traversal<gremlin_python.process.traversal.Traversal>` implements the Asynchronous Iterator Protocol as defined by PEP 492:: @@ -44,7 +44,7 @@ Furthermore, it implements several convience methods - :py:meth:`toList`, >>> vertex_set = await g.V().toSet() >>> next_vertex = await g.V().next() # returns next result from the stream -:py:class:`Traversal<aiogremlin.gremlin_python.process.traversal.Traversal>` +:py:class:`Traversal<gremlin_python.process.traversal.Traversal>` also contains a reference to a :py:class:`RemoteTraversalSideEffects<aiogremlin.remote.driver_remote_side_effects.RemoteTraversalSideEffects>` object that can be used to fetch side effects cached by the server (when applicable):: diff --git a/setup.py b/setup.py index 3d467540acf8f6cb3497da700dda99169e80f3f0..5ae1ead247c3595f15389e89a435b01f1df5487d 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,37 @@ +import pip from setuptools import setup +from distutils.command.build_py import build_py as _build_py + + +class build_py(_build_py): + """Don't install tornado when installing gremlinpython""" + pip.main([ + 'install', + 'git+https://git-wip-us.apache.org/repos/asf/tinkerpop.git@12aa2d2fe534fbd9540c9328725ab844e4bb1010#egg=gremlinpython&subdirectory=gremlin-python/src/main/jython', + '--no-deps']) setup( name='aiogremlin', - version='3.2.4', + version='3.2.5rc1', url='', license='Apache Software License', author='davebshow', author_email='davebshow@gmail.com', description='Async Gremlin-Python', long_description=open('README.txt').read(), - packages=['aiogremlin', 'aiogremlin.driver', 'aiogremlin.driver.aiohttp', - 'aiogremlin.gremlin_python', 'aiogremlin.gremlin_python.driver', - 'aiogremlin.gremlin_python.process', - 'aiogremlin.gremlin_python.structure', - 'aiogremlin.gremlin_python.structure.io', + packages=['aiogremlin', + 'aiogremlin.driver', + 'aiogremlin.driver.aiohttp', + 'aiogremlin.process', + 'aiogremlin..structure', 'aiogremlin.remote'], + cmdclass={'build_py': build_py}, install_requires=[ + 'aenum==1.4.5', # required gremlinpython dep 'aiohttp==1.3.3', - 'PyYAML==3.12' + 'PyYAML==3.12', + 'six==1.10.0' # required gremlinpython dep ], test_suite='tests', setup_requires=['pytest-runner'], diff --git a/tests/config/config.json b/tests/config/config.json index 025136e47ae4f118856f1ed97ac8e612878916a7..0b710c52fac45916626e68632592e260037143b8 100644 --- a/tests/config/config.json +++ b/tests/config/config.json @@ -9,5 +9,5 @@ "username":"dave", "password":"mypass", "ssl_keyfile":"", - "message_serializer":"aiogremlin.gremlin_python.driver.serializer.GraphSONMessageSerializer" + "message_serializer":"gremlin_python.driver.serializer.GraphSONMessageSerializer" } diff --git a/tests/config/config.yml b/tests/config/config.yml index 5762be39a72c7ca94771c1d6076985d166018c96..691cf4a1522c44b811710087d3237fb958e49e21 100644 --- a/tests/config/config.yml +++ b/tests/config/config.yml @@ -1,4 +1,4 @@ scheme: 'wss' hosts: ['localhost'] port: 8183 -message_serializer: 'aiogremlin.gremlin_python.driver.serializer.GraphSONMessageSerializer' +message_serializer: 'gremlin_python.driver.serializer.GraphSONMessageSerializer' diff --git a/tests/config_module.py b/tests/config_module.py index cd609ccd281927c45873f8211aaea63b493566d1..3f8b61d1e0baa82c3aac91ae26255ecf5250b95b 100644 --- a/tests/config_module.py +++ b/tests/config_module.py @@ -1,4 +1,4 @@ SCHEME = 'wss' HOSTS = ['localhost'] PORT = 8183 -MESSAGE_SERIALIZER = 'aiogremlin.gremlin_python.driver.serializer.GraphSONMessageSerializer' +MESSAGE_SERIALIZER = 'gremlin_python.driver.serializer.GraphSONMessageSerializer' diff --git a/tests/conftest.py b/tests/conftest.py index 0e860e0b35b9e88e0666d9d8d7484ba5cc420a0e..abce5a0876ffb116ecb3678857db8892aadbb7bf 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -18,7 +18,7 @@ import asyncio import pytest from aiogremlin import driver from aiogremlin.driver.provider import TinkerGraph -from aiogremlin.gremlin_python.driver import serializer +from gremlin_python.driver import serializer # def pytest_generate_tests(metafunc): diff --git a/tests/test_aliases.py b/tests/test_aliases.py index c31dcdd0c7b0f6ef2fe2250640fcdd897175b9ef..6926f6f52bf12dc7091340c1883f4f404b16ce6f 100644 --- a/tests/test_aliases.py +++ b/tests/test_aliases.py @@ -4,7 +4,7 @@ import uuid import pytest from aiogremlin import driver -from aiogremlin.gremlin_python.driver import request, serializer +from gremlin_python.driver import request, serializer @pytest.mark.asyncio async def test_gremlin_query(event_loop, cluster): diff --git a/tests/test_config.py b/tests/test_config.py index e4bdee3b2db19d4954fd8bb275da4bf679075c82..7b4185493db52bc9e680f9d568811b90e980c8cd 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -19,7 +19,7 @@ import os import pytest from aiogremlin import driver, exception -from aiogremlin.gremlin_python.driver import serializer +from gremlin_python.driver import serializer import config_module diff --git a/tests/test_connection.py b/tests/test_connection.py index e7b557a6a2b2b32013d4193a47d7f330d48f220e..c8d7d7f5f2ba324cf141bcb4c394d1657005b20e 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -26,7 +26,7 @@ from aiohttp import web from aiogremlin import driver from aiogremlin import exception from aiogremlin.driver import provider -from aiogremlin.gremlin_python.driver import request, serializer +from gremlin_python.driver import request, serializer @pytest.mark.asyncio diff --git a/tests/test_connection_protocol.py b/tests/test_connection_protocol.py index 96420128e6975db721ed3469150cdd9a4fb3f3c3..040e55013b9468bea4cd02548f8f512d99974419 100644 --- a/tests/test_connection_protocol.py +++ b/tests/test_connection_protocol.py @@ -20,7 +20,7 @@ # import pytest # # from aiogremlin import exception -# from aiogremlin.gremlin_python.driver import request, serializer +# from gremlin_python.driver import request, serializer # # # @pytest.mark.asyncio diff --git a/tests/test_gremlin_python/conftest.py b/tests/test_gremlin_python/conftest.py index 4bac4aec88f7bcb82da51f15d7089e5b25b8918b..468fbf6a827821764d762853b3a85ffb7291f775 100644 --- a/tests/test_gremlin_python/conftest.py +++ b/tests/test_gremlin_python/conftest.py @@ -23,7 +23,7 @@ from aiogremlin.remote.driver_remote_connection import ( DriverRemoteConnection) from aiogremlin.driver.protocol import GremlinServerWSProtocol from aiogremlin.driver.aiohttp.transport import AiohttpTransport -from aiogremlin.gremlin_python.driver.serializer import GraphSONMessageSerializer +from gremlin_python.driver.serializer import GraphSONMessageSerializer @pytest.fixture diff --git a/tests/test_gremlin_python/driver/test_client.py b/tests/test_gremlin_python/driver/test_client.py index da0f9dc5cc1ae85be6beaf90d162a74f165a230e..c5185a7515d2a347d9d9ed163b3639c09a617391 100644 --- a/tests/test_gremlin_python/driver/test_client.py +++ b/tests/test_gremlin_python/driver/test_client.py @@ -19,8 +19,8 @@ under the License. '''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' import pytest -from aiogremlin.gremlin_python.driver.request import RequestMessage -from aiogremlin.gremlin_python.structure.graph import Graph +from gremlin_python.driver.request import RequestMessage +from aiogremlin.structure.graph import Graph __author__ = 'David M. Brown (davebshow@gmail.com)' diff --git a/tests/test_gremlin_python/driver/test_driver_remote_connection.py b/tests/test_gremlin_python/driver/test_driver_remote_connection.py index 911c1044bb90c9810d74a33778603a125eda3436..0432fd5caf80faf9d05f024964d410d763023086 100644 --- a/tests/test_gremlin_python/driver/test_driver_remote_connection.py +++ b/tests/test_gremlin_python/driver/test_driver_remote_connection.py @@ -19,16 +19,16 @@ under the License. '''THIS FILE HAS BEEN MODIFIED BY DAVID M. BROWN TO SUPPORT PEP 492''' import pytest -from aiogremlin.gremlin_python import statics -from aiogremlin.gremlin_python.statics import long +from gremlin_python import statics +from gremlin_python.statics import long from aiogremlin.remote.driver_remote_connection import ( DriverRemoteConnection) -from aiogremlin.gremlin_python.process.traversal import Traverser -from aiogremlin.gremlin_python.process.traversal import TraversalStrategy -from aiogremlin.gremlin_python.process.graph_traversal import __ -from aiogremlin.gremlin_python.structure.graph import Graph -from aiogremlin.gremlin_python.structure.graph import Vertex -from aiogremlin.gremlin_python.process.strategies import SubgraphStrategy +from gremlin_python.process.traversal import Traverser +from gremlin_python.process.traversal import TraversalStrategy +from gremlin_python.process.graph_traversal import __ +from aiogremlin.structure.graph import Graph +from gremlin_python.structure.graph import Vertex +from gremlin_python.process.strategies import SubgraphStrategy __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' diff --git a/tests/test_gremlin_python/process/test_strategies.py b/tests/test_gremlin_python/process/test_strategies.py index 133f46f9b3ff06dcb9ad845ab81347d4ddfc0aae..5e15849f845fa5ccc13abcd2d4d8021adf8699fa 100644 --- a/tests/test_gremlin_python/process/test_strategies.py +++ b/tests/test_gremlin_python/process/test_strategies.py @@ -22,9 +22,9 @@ __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' import unittest from unittest import TestCase -from aiogremlin.gremlin_python.structure.graph import Graph -from aiogremlin.gremlin_python.process.strategies import * -from aiogremlin.gremlin_python.process.graph_traversal import __ +from aiogremlin.structure.graph import Graph +from gremlin_python.process.strategies import * +from gremlin_python.process.graph_traversal import __ class TestTraversalStrategies(TestCase): diff --git a/tests/test_gremlin_python/process/test_traversal.py b/tests/test_gremlin_python/process/test_traversal.py index 325a7c914f098fedd3c8c5f01d9a5a515a241051..8e1b3d2134ccb3eb88447f06ac6feb86eb87293c 100644 --- a/tests/test_gremlin_python/process/test_traversal.py +++ b/tests/test_gremlin_python/process/test_traversal.py @@ -22,10 +22,10 @@ __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' import unittest from unittest import TestCase -from aiogremlin.gremlin_python.structure.graph import Graph -from aiogremlin.gremlin_python.process.traversal import P -from aiogremlin.gremlin_python.process.traversal import Binding -from aiogremlin.gremlin_python.process.graph_traversal import __ +from aiogremlin.structure.graph import Graph +from gremlin_python.process.traversal import P +from gremlin_python.process.traversal import Binding +from gremlin_python.process.graph_traversal import __ class TestTraversal(TestCase): diff --git a/tests/test_gremlin_python/structure/io/test_graphson.py b/tests/test_gremlin_python/structure/io/test_graphson.py index 6c88a2d8d0e5940b3652ee5e5bcf25dc27630dfb..77030023ab6441f2eef357c0f29dbeb9316d0b7a 100644 --- a/tests/test_gremlin_python/structure/io/test_graphson.py +++ b/tests/test_gremlin_python/structure/io/test_graphson.py @@ -24,14 +24,14 @@ from mock import Mock import unittest from unittest import TestCase -from aiogremlin.gremlin_python.statics import * -from aiogremlin.gremlin_python.structure.graph import Vertex -from aiogremlin.gremlin_python.structure.graph import Path -from aiogremlin.gremlin_python.structure.io.graphson import GraphSONWriter, GraphSONReader, GraphSONUtil -import aiogremlin.gremlin_python.structure.io.graphson -from aiogremlin.gremlin_python.process.traversal import P -from aiogremlin.gremlin_python.process.strategies import SubgraphStrategy -from aiogremlin.gremlin_python.process.graph_traversal import __ +from gremlin_python.statics import * +from gremlin_python.structure.graph import Vertex +from gremlin_python.structure.graph import Path +from gremlin_python.structure.io.graphson import GraphSONWriter, GraphSONReader, GraphSONUtil +import gremlin_python.structure.io.graphson +from gremlin_python.process.traversal import P +from gremlin_python.process.strategies import SubgraphStrategy +from gremlin_python.process.graph_traversal import __ class TestGraphSONReader(TestCase): @@ -100,7 +100,7 @@ class TestGraphSONReader(TestCase): assert type_string in reader.deserializers # base dicts are not modified - assert type_string not in aiogremlin.gremlin_python.structure.io.graphson._deserializers + assert type_string not in gremlin_python.structure.io.graphson._deserializers x = X() o = reader.toObject({GraphSONUtil.TYPE_KEY: type_string, GraphSONUtil.VALUE_KEY: x}) @@ -111,7 +111,7 @@ class TestGraphSONReader(TestCase): type_string = "g:Int64" serdes = Mock() reader = GraphSONReader(deserializer_map={type_string: serdes, override_string: serdes}) - assert aiogremlin.gremlin_python.structure.io.graphson._deserializers[type_string] is not reader.deserializers[type_string] + assert gremlin_python.structure.io.graphson._deserializers[type_string] is not reader.deserializers[type_string] value = 3 o = reader.toObject({GraphSONUtil.TYPE_KEY: type_string, GraphSONUtil.VALUE_KEY: value}) @@ -174,7 +174,7 @@ class TestGraphSONWriter(TestCase): assert X in writer.serializers # base dicts are not modified - assert X not in aiogremlin.gremlin_python.structure.io.graphson._serializers + assert X not in gremlin_python.structure.io.graphson._serializers obj = X() d = writer.toDict(obj) @@ -184,7 +184,7 @@ class TestGraphSONWriter(TestCase): # overridden mapping serdes = Mock() writer = GraphSONWriter(serializer_map={int: serdes}) - assert aiogremlin.gremlin_python.structure.io.graphson._serializers[int] is not writer.serializers[int] + assert gremlin_python.structure.io.graphson._serializers[int] is not writer.serializers[int] value = 3 d = writer.toDict(value) diff --git a/tests/test_gremlin_python/structure/test_graph.py b/tests/test_gremlin_python/structure/test_graph.py index 98b48ba12b69c7b86c5ca4e62a27547675afdb08..803c340564c0716f9b842dbdf2a6248c7e9cae0d 100644 --- a/tests/test_gremlin_python/structure/test_graph.py +++ b/tests/test_gremlin_python/structure/test_graph.py @@ -22,12 +22,12 @@ __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' import unittest from unittest import TestCase -from aiogremlin.gremlin_python.statics import long -from aiogremlin.gremlin_python.structure.graph import Edge -from aiogremlin.gremlin_python.structure.graph import Property -from aiogremlin.gremlin_python.structure.graph import Vertex -from aiogremlin.gremlin_python.structure.graph import VertexProperty -from aiogremlin.gremlin_python.structure.graph import Path +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 +from gremlin_python.structure.graph import VertexProperty +from gremlin_python.structure.graph import Path class TestGraph(TestCase): diff --git a/tests/test_gremlin_python/test_statics.py b/tests/test_gremlin_python/test_statics.py index ea2e993584ba3217f10136cf5db377716a2e88a4..6a160e270a05fc10025de80c44a94fe4f16793e8 100644 --- a/tests/test_gremlin_python/test_statics.py +++ b/tests/test_gremlin_python/test_statics.py @@ -22,10 +22,10 @@ __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' import unittest from unittest import TestCase -from aiogremlin.gremlin_python import statics -from aiogremlin.gremlin_python.process.traversal import Cardinality -from aiogremlin.gremlin_python.process.traversal import P -from aiogremlin.gremlin_python.process.traversal import Pop +from gremlin_python import statics +from gremlin_python.process.traversal import Cardinality +from gremlin_python.process.traversal import P +from gremlin_python.process.traversal import Pop class TestStatics(TestCase):