From ce0fb1b0a9c64b5b41cde7a51b38071812480ab0 Mon Sep 17 00:00:00 2001 From: davebshow <davebshow@gmail.com> Date: Thu, 16 Jul 2015 19:24:23 -0400 Subject: [PATCH] updating rebindings --- README.md | 2 +- aiogremlin/__init__.py | 2 +- aiogremlin/client.py | 9 +++++++-- docs/conf.py | 4 ++-- docs/index.rst | 2 +- setup.py | 2 +- tests/tests.py | 19 +++++++++++++++++++ 7 files changed, 32 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index eef05b1..3f8eb84 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [aiogremlin 0.0.12](https://pypi.python.org/pypi/aiogremlin/0.0.11) +# [aiogremlin 0.1.0](https://pypi.python.org/pypi/aiogremlin/0.0.11) ## [Official Documentation](http://aiogremlin.readthedocs.org/en/latest/) diff --git a/aiogremlin/__init__.py b/aiogremlin/__init__.py index 2211276..a6ee6d4 100644 --- a/aiogremlin/__init__.py +++ b/aiogremlin/__init__.py @@ -4,4 +4,4 @@ from .exceptions import * from .connector import * from .subprotocol import * -__version__ = "0.0.12" +__version__ = "0.1.0" diff --git a/aiogremlin/client.py b/aiogremlin/client.py index 09340be..c93c06f 100644 --- a/aiogremlin/client.py +++ b/aiogremlin/client.py @@ -161,6 +161,8 @@ class GremlinClient: :param dict bindings: A mapping of bindings for Gremlin script. :param str lang: Language of scripts submitted to the server. "gremlin-groovy" by default + :param dict rebindings: Rebind ``Graph`` and ``TraversalSource`` + objects to different variable names in the current request :param str op: Gremlin Server op argument. "eval" by default. :param str processor: Gremlin Server processor argument. "" by default. :param float timeout: timeout for establishing connection (optional). @@ -329,6 +331,7 @@ def submit(gremlin, *, url='ws://localhost:8182/', bindings=None, lang="gremlin-groovy", + rebindings=None, op="eval", processor="", timeout=None, @@ -345,6 +348,8 @@ def submit(gremlin, *, :param dict bindings: A mapping of bindings for Gremlin script. :param str lang: Language of scripts submitted to the server. "gremlin-groovy" by default + :param dict rebindings: Rebind ``Graph`` and ``TraversalSource`` + objects to different variable names in the current request :param str op: Gremlin Server op argument. "eval" by default. :param str processor: Gremlin Server processor argument. "" by default. :param float timeout: timeout for establishing connection (optional). @@ -370,8 +375,8 @@ def submit(gremlin, *, try: resp = yield from gremlin_client.submit( - gremlin, bindings=bindings, lang=lang, op=op, processor=processor, - session=session, timeout=timeout) + gremlin, bindings=bindings, lang=lang, rebindings=rebindings, + op=op, processor=processor, session=session, timeout=timeout) return resp diff --git a/docs/conf.py b/docs/conf.py index 6272765..07f9531 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -62,9 +62,9 @@ author = 'David M. Brown' # built documents. # # The short X.Y version. -version = '0.0.11' +version = '0.1.0' # The full version, including alpha/beta/rc tags. -release = '0.0.11' +release = '0.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/index.rst b/docs/index.rst index e04b140..7087afd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,7 +12,7 @@ based on the `asyncio`_ and `aiohttp`_ libraries. Releases ======== -The latest release of :py:mod:`aiogremlin` is **0.0.12**. +The latest release of :py:mod:`aiogremlin` is **0.1.0**. Requirements diff --git a/setup.py b/setup.py index 4ef8c5a..57496da 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup setup( name="aiogremlin", - version="0.0.12", + version="0.1.0", url="", license="MIT", author="davebshow", diff --git a/tests/tests.py b/tests/tests.py index ef2102e..45c9a2f 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -30,6 +30,25 @@ class SubmitTest(unittest.TestCase): results = self.loop.run_until_complete(go()) self.assertEqual(results[0].data[0], 8) + def test_rebinding(self): + execute = submit("graph2.addVertex()", loop=self.loop) + try: + self.loop.run_until_complete(execute.get()) + error = False + except: + error = True + self.assertTrue(error) + + @asyncio.coroutine + def go(): + result = yield from submit( + "graph2.addVertex()", rebindings={"graph2": "graph"}, + loop=self.loop) + resp = yield from result.get() + self.assertEqual(len(resp), 1) + + self.loop.run_until_complete(go()) + class GremlinClientTest(unittest.TestCase): -- GitLab