You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by "xiazcy (via GitHub)" <gi...@apache.org> on 2024/10/25 17:01:33 UTC
[PR] Update GraphSONV4 extended types, element, and datetime in gremlin-python [tinkerpop]
xiazcy opened a new pull request, #2854:
URL: https://github.com/apache/tinkerpop/pull/2854
Update GraphSONV4 in Python for elements and datetime according to format specified in https://github.com/apache/tinkerpop/blob/master-http/docs/src/dev/io/graphson.asciidoc
VOTE +1
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update GraphSONV4 extended types, element, and datetime in gremlin-python [tinkerpop]
Posted by "kenhuuu (via GitHub)" <gi...@apache.org>.
kenhuuu commented on PR #2854:
URL: https://github.com/apache/tinkerpop/pull/2854#issuecomment-2438824977
Some small discussion points and nits left but no changes necessary.
VOTE +1
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update GraphSONV4 extended types, element, and datetime in gremlin-python [tinkerpop]
Posted by "kenhuuu (via GitHub)" <gi...@apache.org>.
kenhuuu commented on code in PR #2854:
URL: https://github.com/apache/tinkerpop/pull/2854#discussion_r1817360318
##########
gremlin-python/src/main/python/tests/structure/io/test_graphsonv4model.py:
##########
@@ -0,0 +1,313 @@
+"""
+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 pytest
+
+from src.main.python.gremlin_python.statics import ByteBufferType
Review Comment:
Nit: fix this import
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update GraphSONV4 extended types, element, and datetime in gremlin-python [tinkerpop]
Posted by "xiazcy (via GitHub)" <gi...@apache.org>.
xiazcy merged PR #2854:
URL: https://github.com/apache/tinkerpop/pull/2854
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update GraphSONV4 extended types, element, and datetime in gremlin-python [tinkerpop]
Posted by "kenhuuu (via GitHub)" <gi...@apache.org>.
kenhuuu commented on code in PR #2854:
URL: https://github.com/apache/tinkerpop/pull/2854#discussion_r1817322884
##########
gremlin-python/src/main/python/gremlin_python/structure/io/graphsonV4.py:
##########
@@ -207,9 +212,8 @@ class VertexPropertySerializer(_GraphSONTypeIO):
@classmethod
def dictify(cls, vertex_property, writer):
return GraphSONUtil.typed_value("VertexProperty", {"id": writer.to_dict(vertex_property.id),
- "label": writer.to_dict([vertex_property.label]),
- "value": writer.to_dict(vertex_property.value),
- "vertex": writer.to_dict(vertex_property.vertex.id)})
+ "label": GraphSONUtil.write_label(vertex_property.label, writer),
+ "value": writer.to_dict(vertex_property.value),})
Review Comment:
You probably don't want that trailing comma
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update GraphSONV4 extended types, element, and datetime in gremlin-python [tinkerpop]
Posted by "kenhuuu (via GitHub)" <gi...@apache.org>.
kenhuuu commented on PR #2854:
URL: https://github.com/apache/tinkerpop/pull/2854#issuecomment-2448458711
Checked latest changes, my VOTE is still +1.
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update GraphSONV4 extended types, element, and datetime in gremlin-python [tinkerpop]
Posted by "kenhuuu (via GitHub)" <gi...@apache.org>.
kenhuuu commented on code in PR #2854:
URL: https://github.com/apache/tinkerpop/pull/2854#discussion_r1817334537
##########
gremlin-python/src/main/python/gremlin_python/structure/io/graphsonV4.py:
##########
@@ -637,7 +629,8 @@ def objectify(cls, d, reader):
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")[0], properties)
+ label = d.get("label", "vertex")
+ return Vertex(reader.to_object(d["id"]), label if isinstance(label, str) else label[0], properties)
Review Comment:
I think this leads to a slight behavior difference with the Java driver as it sets the last item in the list as the label and not the first. This probably doesn't really matter though since its just for backwards compatibility?
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update GraphSONV4 extended types, element, and datetime in gremlin-python [tinkerpop]
Posted by "Cole-Greer (via GitHub)" <gi...@apache.org>.
Cole-Greer commented on PR #2854:
URL: https://github.com/apache/tinkerpop/pull/2854#issuecomment-2442763236
LGTM other than the points which Ken has already raised.
VOTE +1 (pending resolution to above comments and CI passing)
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update GraphSONV4 extended types, element, and datetime in gremlin-python [tinkerpop]
Posted by "kenhuuu (via GitHub)" <gi...@apache.org>.
kenhuuu commented on code in PR #2854:
URL: https://github.com/apache/tinkerpop/pull/2854#discussion_r1817328407
##########
gremlin-python/src/main/python/gremlin_python/structure/io/graphsonV4.py:
##########
@@ -587,26 +575,29 @@ def objectify(cls, v, _):
class ByteBufferIO(_GraphSONTypeIO):
python_type = ByteBufferType
- graphson_type = "gx:ByteBuffer"
- graphson_base_type = "ByteBuffer"
+ graphson_type = "g:Binary"
+ graphson_base_type = "Binary"
@classmethod
def dictify(cls, n, writer):
- return GraphSONUtil.typed_value(cls.graphson_base_type, "".join(chr(x) for x in n), "gx")
+ # n_encoded = "".join(chr(x) for x in base64.b64encode(n))
Review Comment:
looks like this section needs some cleanup
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update GraphSONV4 extended types, element, and datetime in gremlin-python [tinkerpop]
Posted by "kenhuuu (via GitHub)" <gi...@apache.org>.
kenhuuu commented on code in PR #2854:
URL: https://github.com/apache/tinkerpop/pull/2854#discussion_r1817322520
##########
gremlin-python/src/main/python/gremlin_python/structure/io/graphsonV4.py:
##########
@@ -69,6 +69,10 @@ def typed_value(cls, type_name, value, prefix="g"):
def format_type(cls, prefix, type_name):
return "%s:%s" % (prefix, type_name)
+ @classmethod
+ def write_label(cls, value, writer):
Review Comment:
I'm not sure how useful this function is, but I think the code is a little clearer because of it?
--
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: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org