[
https://issues.apache.org/jira/browse/TINKERPOP-1747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16120516#comment-16120516
]
ASF GitHub Bot commented on TINKERPOP-1747:
-------------------------------------------
GitHub user davebshow opened a pull request:
https://github.com/apache/tinkerpop/pull/691
TINKERPOP-1747 Streamline inheritance for gremlin-python GrapnSON
serializer classes
https://issues.apache.org/jira/browse/TINKERPOP-1747
This PR cleans up the code used to define GraphSON serializer classes in
gremlin-python.
`GraphSONMessageSerializer` acts as a base class for
`GraphSONSerializersV2d0` and `GraphSONSerializersV3d0` in a similar fashion,
but with this change:
1. While `GraphSONMessageSerializer` can accept custom reader, writer, and
version implementations in order to create a custom serializer,
`GraphSONSerializersV2d0` and `GraphSONSerializersV3d0` cannot.
2. Instead `GraphSONSerializersV3d0` and `GraphSONSerializersV2d0` are in a
sense implementations of custom serializers, and they always use
`graphsonV2d0.GraphSONReader()`/`graphsonV2d0.GraphSONWriter()` and
`graphsonV3d0.GraphSONReader()`/`graphsonV3d0.GraphSONWriter()` respectively.
As before, `GraphSONMessageSerializer` will default to the current version
of GraphSON (v3 for TP 3.3.0) if no custom reader/writer implementation is
passed. Defaults are now specified in a highly visible class attribute position
using uppercase naming like class CONSTANTS.
All other changes, like using `super` to call parent class's init methods,
are more stylistic, reflecting current Python standards for best practice.
I also added a couple small tests to make sure each serializer was assigned
proper reader, writer classes as well as version information.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/tinkerpop TINKERPOP-1747
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/691.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #691
----
commit 83206a2101a0f03c515d4e1829149ed14a330dc7
Author: davebshow <[email protected]>
Date: 2017-08-09T19:14:44Z
cleaned up gremlin-python message serializer classes
----
> Streamline inheritance for gremlin-python GrapnSON serializer classes
> ---------------------------------------------------------------------
>
> Key: TINKERPOP-1747
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1747
> Project: TinkerPop
> Issue Type: Improvement
> Components: language-variant
> Affects Versions: 3.3.0
> Reporter: David M. Brown
> Fix For: 3.3.0
>
>
> This follows up on TINKERPOP-1427 by cleaning up the code used to create the
> various gremlin-python GraphSON serializers for GraphSON version 2 and 3.
> Several small changes can improve code style, reduce redundancy, and clarify
> when custom readers and writers can be passed to the serializer (generic
> serializer) vs. the GraphSON version specific serializers.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)