xiazcy commented on code in PR #2283:
URL: https://github.com/apache/tinkerpop/pull/2283#discussion_r1358910104
##########
gremlin-python/src/main/python/tests/process/test_translator.py:
##########
@@ -373,6 +374,30 @@ class SuperStr(str):
tests.append([g.V().has("p1", None),
"g.V().has('p1',null)"])
+ # 104
+ vertex = Vertex(0, "person")
Review Comment:
Hmm, ok. Is that a use case to crate a label (that's a string) with a single
quote? Or it's just to test?
##########
gremlin-python/src/main/python/gremlin_python/driver/aiohttp/transport.py:
##########
@@ -138,3 +138,104 @@ async def async_close():
def closed(self):
# Connection is closed if either the websocket or the client session
is closed.
return self._websocket.closed or self._client_session.closed
+
+
+class AiohttpHTTPTransport(AbstractBaseTransport):
+ nest_asyncio_applied = False
+
+ def __init__(self, call_from_event_loop=None, read_timeout=None,
write_timeout=None, **kwargs):
+ if call_from_event_loop is not None and call_from_event_loop and not
AiohttpTransport.nest_asyncio_applied:
+ """
+ The AiohttpTransport implementation uses the asyncio event
loop. Because of this, it cannot be called
+ within an event loop without nest_asyncio. If the code is ever
refactored so that it can be called
+ within an event loop this import and call can be removed.
Without this, applications which use the
+ event loop to call gremlin-python (such as Jupyter) will not
work.
+ """
+ import nest_asyncio
+ nest_asyncio.apply()
+ AiohttpTransport.nest_asyncio_applied = True
+
+ # Start event loop and initialize client session and response to None
+ self._loop = asyncio.new_event_loop()
+ self._client_session = None
+ self._http_req_resp = None
+ self._enable_ssl = False
+
+ # Set all inner variables to parameters passed in.
+ self._aiohttp_kwargs = kwargs
+ self._write_timeout = write_timeout
+ self._read_timeout = read_timeout
+ if "ssl_options" in self._aiohttp_kwargs:
+ self._ssl_context = self._aiohttp_kwargs.pop("ssl_options")
+ self._enable_ssl = True
+
+ # if "ssl_options" in self._aiohttp_kwargs:
+ # self._aiohttp_kwargs["ssl_context"] =
self._aiohttp_kwargs.pop("ssl_options")
Review Comment:
Ah yes, I forgot to remove this part.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]