Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

gremlinpython

Package Overview
Dependencies
Maintainers
3
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gremlinpython - pypi Package Compare versions

Comparing version
3.7.1
to
3.6.7
+2
-2
gremlin_python/__version__.py

@@ -19,3 +19,3 @@ '''

'''
version = '3.7.1'
timestamp = 1701721127
version = '3.6.7'
timestamp = 1713192014

@@ -214,3 +214,5 @@ #

async with async_timeout.timeout(self._read_timeout):
return await self._http_req_resp.read()
return {"content": await self._http_req_resp.read(),
"ok": self._http_req_resp.ok,
"status": self._http_req_resp.status}

@@ -217,0 +219,0 @@ return self._loop.run_until_complete(async_read())

@@ -61,6 +61,7 @@ # Licensed to the Apache Software Foundation (ASF) under one

self.connect()
request_id = str(uuid.uuid4())
if request_message.args.get("requestId"):
request_id = request_message.args.get("requestId")
uuid.UUID(request_id) # Checks for proper UUID or else server will return an error.
request_id = str(request_message.args.get("requestId"))
uuid.UUID(request_id) # Checks for proper UUID or else server will return an error.
else:
request_id = str(uuid.uuid4())
result_set = resultset.ResultSet(queue.Queue(), request_id)

@@ -67,0 +68,0 @@ self._results[request_id] = result_set

@@ -178,5 +178,5 @@ #

if options_strategy:
allowed_keys = ['evaluationTimeout', 'scriptEvaluationTimeout', 'batchSize', 'requestId', 'userAgent', 'materializeProperties']
allowed_keys = ['evaluationTimeout', 'scriptEvaluationTimeout', 'batchSize', 'requestId', 'userAgent']
request_options = {allowed: options_strategy[1].configuration[allowed] for allowed in allowed_keys
if allowed in options_strategy[1].configuration}
return request_options

@@ -226,5 +226,5 @@ #

def data_received(self, message, results_dict):
def data_received(self, response, results_dict):
# if Gremlin Server cuts off then we get a None for the message
if message is None:
if response is None:
log.error("Received empty message from server.")

@@ -234,20 +234,21 @@ raise GremlinServerError({'code': 500,

message = self._message_serializer.deserialize_message(message)
request_id = message['requestId']
result_set = results_dict[request_id] if request_id in results_dict else ResultSet(None, None)
status_code = message['status']['code']
aggregate_to = message['result']['meta'].get('aggregateTo', 'list')
data = message['result']['data']
result_set.aggregate_to = aggregate_to
if response['ok']:
message = self._message_serializer.deserialize_message(response['content'])
request_id = message['requestId']
result_set = results_dict[request_id] if request_id in results_dict else ResultSet(None, None)
status_code = message['status']['code']
aggregate_to = message['result']['meta'].get('aggregateTo', 'list')
data = message['result']['data']
result_set.aggregate_to = aggregate_to
if status_code == 204:
result_set.stream.put_nowait([])
del results_dict[request_id]
return status_code
elif status_code in [200, 206]:
result_set.stream.put_nowait(data)
if status_code == 200:
result_set.status_attributes = message['status']['attributes']
if status_code == 204:
result_set.stream.put_nowait([])
del results_dict[request_id]
return status_code
return status_code
elif status_code in [200, 206]:
result_set.stream.put_nowait(data)
if status_code == 200:
result_set.status_attributes = message['status']['attributes']
del results_dict[request_id]
return status_code
else:

@@ -257,4 +258,5 @@ # This message is going to be huge and kind of hard to read, but in the event of an error,

log.error("\r\nReceived error message '%s'\r\n\r\nWith results dictionary '%s'",
str(message), str(results_dict))
del results_dict[request_id]
raise GremlinServerError(message['status'])
str(response['content']), str(results_dict))
body = json.loads(response['content'])
del results_dict[body['requestId']]
raise GremlinServerError({'code': response['status'], 'message': body['message'], 'attributes': {}})

@@ -243,3 +243,3 @@ #

request_id = uuid.UUID(message['requestId'])
request_id = uuid.UUID(str(message['requestId']))
ba.extend(self.header_pack(mime_len, mime_type, 0x81,

@@ -246,0 +246,0 @@ (request_id.int >> 64) & self.max_int64, request_id.int & self.max_int64))

@@ -21,3 +21,3 @@ #

gremlin_version = "3.7.1" # DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
gremlin_version = "3.6.7" # DO NOT MODIFY - Configured automatically by Maven Replacer Plugin

@@ -24,0 +24,0 @@ def _generate_user_agent():

@@ -197,9 +197,2 @@ #

DT = Enum('DT', ' second minute hour day')
statics.add_static('second', DT.second)
statics.add_static('minute', DT.minute)
statics.add_static('hour', DT.hour)
statics.add_static('day', DT.day)
Merge = Enum('Merge', ' on_create on_match out_v in_v')

@@ -218,5 +211,5 @@

Pick = Enum('Pick', ' any none')
Pick = Enum('Pick', ' any_ none')
statics.add_static('any', Pick.any)
statics.add_static('any_', Pick.any_)
statics.add_static('none', Pick.none)

@@ -829,20 +822,2 @@

class CardinalityValue(Bytecode):
def __init__(self, cardinality, val):
super().__init__()
self.add_source("CardinalityValueTraversal", cardinality, val)
@classmethod
def single(cls, val):
return CardinalityValue(Cardinality.single, val)
@classmethod
def list_(cls, val):
return CardinalityValue(Cardinality.list_, val)
@classmethod
def set_(cls, val):
return CardinalityValue(Cardinality.set_, val)
'''

@@ -849,0 +824,0 @@ BINDINGS

@@ -46,6 +46,5 @@ #

class Element(object):
def __init__(self, id, label, properties=None):
def __init__(self, id, label):
self.id = id
self.label = label
self.properties = properties

@@ -60,4 +59,4 @@ def __eq__(self, other):

class Vertex(Element):
def __init__(self, id, label="vertex", properties=None):
Element.__init__(self, id, label, properties)
def __init__(self, id, label="vertex"):
Element.__init__(self, id, label)

@@ -69,4 +68,4 @@ def __repr__(self):

class Edge(Element):
def __init__(self, id, outV, label, inV, properties=None):
Element.__init__(self, id, label, properties)
def __init__(self, id, outV, label, inV):
Element.__init__(self, id, label)
self.outV = outV

@@ -80,4 +79,4 @@ self.inV = inV

class VertexProperty(Element):
def __init__(self, id, label, value, vertex, properties=None):
Element.__init__(self, id, label, properties)
def __init__(self, id, label, value, vertex):
Element.__init__(self, id, label)
self.value = value

@@ -84,0 +83,0 @@ self.key = self.label

@@ -36,3 +36,3 @@ """

SingleChar
from gremlin_python.process.traversal import Barrier, Binding, Bytecode, Cardinality, Column, Direction, DT, Merge, \
from gremlin_python.process.traversal import Barrier, Binding, Bytecode, Cardinality, Column, Direction, Merge, \
Operator, Order, Pick, Pop, P, Scope, TextP, Traversal, Traverser, \

@@ -101,3 +101,2 @@ TraversalStrategy, T

merge = 0x2e
dt = 0x2f
char = 0x80

@@ -607,5 +606,4 @@ duration = 0x81

outv = Vertex(r.read_object(b), r.to_object(b, DataType.string, False))
b.read(2)
properties = r.read_object(b)
edge = Edge(edgeid, outv, edgelbl, inv, properties)
edge = Edge(edgeid, outv, edgelbl, inv)
b.read(4)
return edge

@@ -688,3 +686,4 @@

def _read_vertex(cls, b, r):
vertex = Vertex(r.read_object(b), r.to_object(b, DataType.string, False), r.read_object(b))
vertex = Vertex(r.read_object(b), r.to_object(b, DataType.string, False))
b.read(2)
return vertex

@@ -715,4 +714,3 @@

vp = VertexProperty(r.read_object(b), r.to_object(b, DataType.string, False), r.read_object(b), None)
b.read(2)
vp.properties = r.read_object(b)
b.read(4)
return vp

@@ -928,7 +926,2 @@

class DTIO(_EnumIO):
graphbinary_type = DataType.dt
python_type = DT
class MergeIO(_EnumIO):

@@ -935,0 +928,0 @@ graphbinary_type = DataType.merge

@@ -33,3 +33,3 @@ #

from gremlin_python import statics
from gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType, SingleByte, ByteBufferType, SingleChar
from gremlin_python.statics import FloatType, FunctionType, ShortType, IntType, LongType, TypeType, SingleByte, ByteBufferType, SingleChar
from gremlin_python.process.traversal import Binding, Bytecode, P, TextP, Traversal, Traverser, TraversalStrategy

@@ -502,2 +502,26 @@ from gremlin_python.structure.graph import Edge, Property, Vertex, VertexProperty, Path

class Int16IO(Int64IO):
python_type = ShortType
graphson_type = "gx:Int16"
graphson_base_type = "Int16"
@classmethod
def dictify(cls, n, writer):
# if we exceed Java int range then we need a long
if isinstance(n, bool):
return n
elif n < -9223372036854775808 or n > 9223372036854775807:
return GraphSONUtil.typed_value("BigInteger", str(n), "gx")
elif n < -2147483648 or n > 2147483647:
return GraphSONUtil.typed_value("Int64", n)
elif n < -32768 or n > 32767:
return GraphSONUtil.typed_value("Int32", n)
else:
return GraphSONUtil.typed_value(cls.graphson_base_type, n, "gx")
@classmethod
def objectify(cls, v, _):
return int.__new__(ShortType, v)
class ByteIO(_NumberIO):

@@ -566,8 +590,3 @@ python_type = SingleByte

def objectify(cls, d, reader):
properties = None
if "properties" in d:
properties = reader.to_object(d["properties"])
if properties is not None:
properties = [item for sublist in properties.values() for item in sublist]
return Vertex(reader.to_object(d["id"]), d.get("label", "vertex"), properties)
return Vertex(reader.to_object(d["id"]), d.get("label", "vertex"))

@@ -580,12 +599,6 @@

def objectify(cls, d, reader):
properties = None
if "properties" in d:
properties = reader.to_object(d["properties"])
if properties is not None:
properties = list(properties.values())
return Edge(reader.to_object(d["id"]),
Vertex(reader.to_object(d["outV"]), d.get("outVLabel", "vertex")),
d.get("label", "edge"),
Vertex(reader.to_object(d["inV"]), d.get("inVLabel", "vertex")),
properties)
Vertex(reader.to_object(d["inV"]), d.get("inVLabel", "vertex")))

@@ -598,7 +611,2 @@

def objectify(cls, d, reader):
properties = None
if "properties" in d:
properties = reader.to_object(d["properties"])
if properties is not None:
properties = list(map(lambda x: Property(x[0], x[1], None), properties.items()))
vertex = Vertex(reader.to_object(d.get("vertex"))) if "vertex" in d else None

@@ -608,4 +616,3 @@ return VertexProperty(reader.to_object(d["id"]),

reader.to_object(d["value"]),
vertex,
properties)
vertex)

@@ -612,0 +619,0 @@

@@ -32,3 +32,3 @@ # Licensed to the Apache Software Foundation (ASF) under one

from gremlin_python import statics
from gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType, DictType, ListType, SetType, SingleByte, ByteBufferType, SingleChar
from gremlin_python.statics import FloatType, FunctionType, ShortType, IntType, LongType, TypeType, DictType, ListType, SetType, SingleByte, ByteBufferType, SingleChar
from gremlin_python.process.traversal import Binding, Bytecode, Direction, P, TextP, Traversal, Traverser, TraversalStrategy, T

@@ -601,2 +601,27 @@ from gremlin_python.structure.graph import Edge, Property, Vertex, VertexProperty, Path

class Int16IO(Int64IO):
python_type = ShortType
graphson_type = "gx:Int16"
graphson_base_type = "Int16"
@classmethod
def dictify(cls, n, writer):
# if we exceed Java int range then we need a long
if isinstance(n, bool):
return n
elif n < -9223372036854775808 or n > 9223372036854775807:
return GraphSONUtil.typed_value("BigInteger", str(n), "gx")
elif n < -2147483648 or n > 2147483647:
return GraphSONUtil.typed_value("Int64", n)
elif n < -32768 or n > 32767:
return GraphSONUtil.typed_value("Int32", n)
else:
return GraphSONUtil.typed_value(cls.graphson_base_type, n, "gx")
@classmethod
def objectify(cls, v, _):
return int.__new__(ShortType, v)
class ByteIO(_NumberIO):

@@ -665,8 +690,3 @@ python_type = SingleByte

def objectify(cls, d, reader):
properties = None
if "properties" in d:
properties = reader.to_object(d["properties"])
if properties is not None:
properties = [item for sublist in properties.values() for item in sublist]
return Vertex(reader.to_object(d["id"]), d.get("label", "vertex"), properties)
return Vertex(reader.to_object(d["id"]), d.get("label", "vertex"))

@@ -679,12 +699,6 @@

def objectify(cls, d, reader):
properties = None
if "properties" in d:
properties = reader.to_object(d["properties"])
if properties is not None:
properties = list(properties.values())
return Edge(reader.to_object(d["id"]),
Vertex(reader.to_object(d["outV"]), d.get("outVLabel", "vertex")),
d.get("label", "edge"),
Vertex(reader.to_object(d["inV"]), d.get("inVLabel", "vertex")),
properties)
Vertex(reader.to_object(d["inV"]), d.get("inVLabel", "vertex")))

@@ -697,7 +711,2 @@

def objectify(cls, d, reader):
properties = None
if "properties" in d:
properties = reader.to_object(d["properties"])
if properties is not None:
properties = list(map(lambda x: Property(x[0], x[1], None), properties.items()))
vertex = Vertex(reader.to_object(d.get("vertex"))) if "vertex" in d else None

@@ -707,4 +716,3 @@ return VertexProperty(reader.to_object(d["id"]),

reader.to_object(d["value"]),
vertex,
properties)
vertex)

@@ -711,0 +719,0 @@

Metadata-Version: 2.1
Name: gremlinpython
Version: 3.7.1
Version: 3.6.7
Summary: Gremlin-Python for Apache TinkerPop

@@ -5,0 +5,0 @@ Home-page: http://tinkerpop.apache.org

+1
-1
Apache TinkerPop
Copyright 2015-2023 The Apache Software Foundation.
Copyright 2015-2024 The Apache Software Foundation.
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Metadata-Version: 2.1
Name: gremlinpython
Version: 3.7.1
Version: 3.6.7
Summary: Gremlin-Python for Apache TinkerPop

@@ -5,0 +5,0 @@ Home-page: http://tinkerpop.apache.org

@@ -79,4 +79,3 @@ """

'radish-bdd==0.13.4',
'PyHamcrest>=1.9.0,<3.0.0',
'PyYAML>=5.3'
'PyHamcrest>=1.9.0,<3.0.0'
],

@@ -83,0 +82,0 @@ install_requires=install_requires,

Sorry, the diff of this file is too big to display