You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/07/25 15:07:16 UTC
[tinkerpop] branch master updated (a849fd3 -> aee038f)
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git.
from a849fd3 Merge branch 'tp34'
new 4af8725 Minor formatting changes to traversal.py CTR
new 92a2053 Merge branch 'tp33' into tp34
new aee038f Merge branch 'tp34'
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
gremlin-python/glv/TraversalSource.template | 20 ++++--
.../jython/gremlin_python/process/traversal.py | 72 +++++++++++++++-------
2 files changed, 63 insertions(+), 29 deletions(-)
[tinkerpop] 01/03: Minor formatting changes to traversal.py CTR
Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 4af872507d6c56cce9cd250d52dd4205df5635f5
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu Jul 25 10:38:07 2019 -0400
Minor formatting changes to traversal.py CTR
---
gremlin-python/glv/TraversalSource.template | 10 ++++++----
.../src/main/jython/gremlin_python/process/traversal.py | 10 ++++++----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/gremlin-python/glv/TraversalSource.template b/gremlin-python/glv/TraversalSource.template
index db17c04..2c01269 100644
--- a/gremlin-python/glv/TraversalSource.template
+++ b/gremlin-python/glv/TraversalSource.template
@@ -21,6 +21,7 @@ from aenum import Enum
from .. import statics
from ..statics import long
+
class Traversal(object):
def __init__(self, graph, traversal_strategies, bytecode):
self.graph = graph
@@ -167,11 +168,9 @@ def <%= method %>(*args):
return P.<%= method %>(*args)
<% } %>
-
<% pmethods.findAll{!it.equals("clone")}.each { method -> %>statics.add_static('<%= method %>',<%= method %>)
<% } %>
-
'''
TRAVERSER
'''
@@ -190,6 +189,7 @@ class Traverser(object):
def __eq__(self, other):
return isinstance(other, self.__class__) and self.object == other.object
+
'''
TRAVERSAL SIDE-EFFECTS
'''
@@ -208,6 +208,7 @@ class TraversalSideEffects(object):
def __repr__(self):
return "sideEffects[size:" + str(len(self.keys())) + "]"
+
'''
TRAVERSAL STRATEGIES
'''
@@ -255,6 +256,7 @@ class TraversalStrategy(object):
def __repr__(self):
return self.strategy_name
+
'''
BYTECODE
'''
@@ -326,7 +328,7 @@ class Bindings(object):
def of(self,key,value):
if not isinstance(key, str):
raise TypeError("Key must be str")
- return (key,value)
+ return (key, value)
class Binding(object):
@@ -341,4 +343,4 @@ class Binding(object):
return hash(self.key) + hash(self.value)
def __repr__(self):
- return "binding[" + self.key + "=" + str(self.value) + "]"
\ No newline at end of file
+ return "binding[" + self.key + "=" + str(self.value) + "]"
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
index 1782b98..128808d 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -21,6 +21,7 @@ from aenum import Enum
from .. import statics
from ..statics import long
+
class Traversal(object):
def __init__(self, graph, traversal_strategies, bytecode):
self.graph = graph
@@ -329,7 +330,6 @@ def without(*args):
return P.without(*args)
-
statics.add_static('between',between)
statics.add_static('eq',eq)
@@ -357,7 +357,6 @@ statics.add_static('within',within)
statics.add_static('without',without)
-
'''
TRAVERSER
'''
@@ -376,6 +375,7 @@ class Traverser(object):
def __eq__(self, other):
return isinstance(other, self.__class__) and self.object == other.object
+
'''
TRAVERSAL SIDE-EFFECTS
'''
@@ -394,6 +394,7 @@ class TraversalSideEffects(object):
def __repr__(self):
return "sideEffects[size:" + str(len(self.keys())) + "]"
+
'''
TRAVERSAL STRATEGIES
'''
@@ -440,6 +441,7 @@ class TraversalStrategy(object):
def __repr__(self):
return self.strategy_name
+
'''
BYTECODE
'''
@@ -511,7 +513,7 @@ class Bindings(object):
def of(self,key,value):
if not isinstance(key, str):
raise TypeError("Key must be str")
- return (key,value)
+ return (key, value)
class Binding(object):
@@ -526,4 +528,4 @@ class Binding(object):
return hash(self.key) + hash(self.value)
def __repr__(self):
- return "binding[" + self.key + "=" + str(self.value) + "]"
\ No newline at end of file
+ return "binding[" + self.key + "=" + str(self.value) + "]"
[tinkerpop] 03/03: Merge branch 'tp34'
Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit aee038fe26ba399410720afb96c133602410fd6e
Merge: a849fd3 92a2053
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu Jul 25 11:02:10 2019 -0400
Merge branch 'tp34'
gremlin-python/glv/TraversalSource.template | 20 ++++--
.../jython/gremlin_python/process/traversal.py | 72 +++++++++++++++-------
2 files changed, 63 insertions(+), 29 deletions(-)
[tinkerpop] 02/03: Merge branch 'tp33' into tp34
Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 92a20536bbb43db37957097eaf3b88332c1bfdfa
Merge: efc3237 4af8725
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu Jul 25 11:02:01 2019 -0400
Merge branch 'tp33' into tp34
gremlin-python/glv/TraversalSource.template | 20 ++++--
.../jython/gremlin_python/process/traversal.py | 72 +++++++++++++++-------
2 files changed, 63 insertions(+), 29 deletions(-)
diff --cc gremlin-python/glv/TraversalSource.template
index a34c16a,2c01269..ada9bd2
--- a/gremlin-python/glv/TraversalSource.template
+++ b/gremlin-python/glv/TraversalSource.template
@@@ -167,41 -168,9 +168,43 @@@ def <%= method %>(*args)
return P.<%= method %>(*args)
<% } %>
-
--<% pmethods.findAll{!it.equals("clone")}.each { method -> %>statics.add_static('<%= method %>',<%= method %>)
++<% pmethods.findAll{!it.equals("clone")}.each { method -> %>statics.add_static('<%= method %>', <%= method %>)
<% } %>
-
+class TextP(P):
+ def __init__(self, operator, value, other=None):
+ P.__init__(self, operator, value, other)
+<% tpmethods.each { method -> %>
+ @staticmethod
+ def <%= method %>(*args):
+ return TextP("<%= toJava.call(method) %>", *args)
+<% } %>
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.operator == other.operator and self.value == other.value and self.other == other.other
+
+ def __repr__(self):
+ return self.operator + "(" + str(self.value) + ")" if self.other is None else self.operator + "(" + str(self.value) + "," + str(self.other) + ")"
++
+<% tpmethods.findAll{!it.equals("clone")}.each { method -> %>
+def <%= method %>(*args):
+ return TextP.<%= method %>(*args)
- statics.add_static('<%= method %>',<%= method %>)
++
+<% } %>
++<% tpmethods.findAll{!it.equals("clone")}.each { method -> %>statics.add_static('<%= method %>', <%= method %>)
+
++<% } %>
+<% tokens.each { k,v -> %>
++
+'''
+<%= k %>
+'''
+
++
+class <%= k %>(object):
+<% v.each {a,b -> %>
+ <%= a %> = "<%= b %>"
+<% }} %>
+
-
'''
TRAVERSER
'''
@@@ -353,15 -325,12 +359,14 @@@ BINDING
class Bindings(object):
- def of(self,key,value):
+
+ @staticmethod
+ def of(key, value):
if not isinstance(key, str):
raise TypeError("Key must be str")
- return (key, value)
+ return Binding(key, value)
-
class Binding(object):
def __init__(self,key,value):
self.key = key
@@@ -375,11 -344,3 +380,14 @@@
def __repr__(self):
return "binding[" + self.key + "=" + str(self.value) + "]"
+
++
+'''
+WITH OPTIONS
+'''
++
++
+class WithOptions(object):
+<% withOptions.each { %>
+ <%= it.name %> = <%= it.value %>
+<% } %>
diff --cc gremlin-python/src/main/jython/gremlin_python/process/traversal.py
index 7af1b0f,128808d..3029e3a
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@@ -329,167 -330,33 +330,187 @@@ def without(*args)
return P.without(*args)
-statics.add_static('between',between)
++statics.add_static('between', between)
- statics.add_static('between',between)
-
--statics.add_static('eq',eq)
-
- statics.add_static('gt',gt)
++statics.add_static('eq', eq)
- statics.add_static('gte',gte)
-statics.add_static('gt',gt)
++statics.add_static('gt', gt)
- statics.add_static('inside',inside)
-statics.add_static('gte',gte)
++statics.add_static('gte', gte)
- statics.add_static('lt',lt)
-statics.add_static('inside',inside)
++statics.add_static('inside', inside)
- statics.add_static('lte',lte)
-statics.add_static('lt',lt)
++statics.add_static('lt', lt)
- statics.add_static('neq',neq)
-statics.add_static('lte',lte)
++statics.add_static('lte', lte)
- statics.add_static('not_',not_)
-statics.add_static('neq',neq)
++statics.add_static('neq', neq)
- statics.add_static('outside',outside)
-statics.add_static('not_',not_)
++statics.add_static('not_', not_)
- statics.add_static('test',test)
-statics.add_static('outside',outside)
++statics.add_static('outside', outside)
- statics.add_static('within',within)
-statics.add_static('test',test)
++statics.add_static('test', test)
+
- statics.add_static('without',without)
++statics.add_static('within', within)
+
++statics.add_static('without', without)
+
+
+class TextP(P):
+ def __init__(self, operator, value, other=None):
+ P.__init__(self, operator, value, other)
+
+ @staticmethod
+ def containing(*args):
+ return TextP("containing", *args)
+
+ @staticmethod
+ def endingWith(*args):
+ return TextP("endingWith", *args)
+
+ @staticmethod
+ def notContaining(*args):
+ return TextP("notContaining", *args)
+
+ @staticmethod
+ def notEndingWith(*args):
+ return TextP("notEndingWith", *args)
+
+ @staticmethod
+ def notStartingWith(*args):
+ return TextP("notStartingWith", *args)
+
+ @staticmethod
+ def startingWith(*args):
+ return TextP("startingWith", *args)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.operator == other.operator and self.value == other.value and self.other == other.other
+
+ def __repr__(self):
+ return self.operator + "(" + str(self.value) + ")" if self.other is None else self.operator + "(" + str(self.value) + "," + str(self.other) + ")"
+
++
+def containing(*args):
+ return TextP.containing(*args)
- statics.add_static('containing',containing)
++
+
+def endingWith(*args):
+ return TextP.endingWith(*args)
- statics.add_static('endingWith',endingWith)
++
+
+def notContaining(*args):
+ return TextP.notContaining(*args)
- statics.add_static('notContaining',notContaining)
++
+
+def notEndingWith(*args):
+ return TextP.notEndingWith(*args)
- statics.add_static('notEndingWith',notEndingWith)
++
+
+def notStartingWith(*args):
+ return TextP.notStartingWith(*args)
- statics.add_static('notStartingWith',notStartingWith)
++
+
+def startingWith(*args):
+ return TextP.startingWith(*args)
- statics.add_static('startingWith',startingWith)
++
++
++statics.add_static('containing', containing)
++
++statics.add_static('endingWith', endingWith)
++
++statics.add_static('notContaining', notContaining)
++
++statics.add_static('notEndingWith', notEndingWith)
++
++statics.add_static('notStartingWith', notStartingWith)
++
++statics.add_static('startingWith', startingWith)
+
-statics.add_static('within',within)
-statics.add_static('without',without)
+
+
+'''
+IO
+'''
+
++
+class IO(object):
+
+ graphml = "graphml"
+
+ graphson = "graphson"
+
+ gryo = "gryo"
+
+ reader = "~tinkerpop.io.reader"
+
+ registry = "~tinkerpop.io.registry"
+
+ writer = "~tinkerpop.io.writer"
+
++
+'''
+ConnectedComponent
+'''
+
++
+class ConnectedComponent(object):
+
+ component = "gremlin.connectedComponentVertexProgram.component"
+
+ edges = "~tinkerpop.connectedComponent.edges"
+
+ propertyName = "~tinkerpop.connectedComponent.propertyName"
+
++
+'''
+ShortestPath
+'''
+
++
+class ShortestPath(object):
+
+ distance = "~tinkerpop.shortestPath.distance"
+
+ edges = "~tinkerpop.shortestPath.edges"
+
+ includeEdges = "~tinkerpop.shortestPath.includeEdges"
+
+ maxDistance = "~tinkerpop.shortestPath.maxDistance"
+
+ target = "~tinkerpop.shortestPath.target"
+
++
+'''
+PageRank
+'''
+
++
+class PageRank(object):
+
+ edges = "~tinkerpop.pageRank.edges"
+
+ propertyName = "~tinkerpop.pageRank.propertyName"
+
+ times = "~tinkerpop.pageRank.times"
+
++
+'''
+PeerPressure
+'''
+
++
+class PeerPressure(object):
+
+ edges = "~tinkerpop.peerPressure.edges"
+
+ propertyName = "~tinkerpop.peerPressure.propertyName"
+
+ times = "~tinkerpop.peerPressure.times"
-
'''
TRAVERSER
'''
@@@ -640,15 -510,12 +664,14 @@@ BINDING
class Bindings(object):
- def of(self,key,value):
+
+ @staticmethod
+ def of(key, value):
if not isinstance(key, str):
raise TypeError("Key must be str")
- return (key, value)
+ return Binding(key, value)
-
class Binding(object):
def __init__(self,key,value):
self.key = key
@@@ -662,29 -529,3 +685,32 @@@
def __repr__(self):
return "binding[" + self.key + "=" + str(self.value) + "]"
+
++
+'''
+WITH OPTIONS
+'''
++
++
+class WithOptions(object):
+
+ tokens = "~tinkerpop.valueMap.tokens"
+
+ none = 0
+
+ ids = 1
+
+ labels = 2
+
+ keys = 4
+
+ values = 8
+
+ all = 15
+
+ indexer = "~tinkerpop.index.indexer"
+
+ list = 0
+
+ map = 1
+