Skip to content

Commit

Permalink
[TINKERPOP-3025] Add missing l_trim() and r_trim() to python (#2432)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryn5 authored Jan 11, 2024
1 parent c28aa2e commit 3a071af
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
[[release-3-7-2]]
=== TinkerPop 3.7.2 (NOT OFFICIALLY RELEASED YET)
* Deprecated `ltrim()` and `rTrim()` in favor of `l_trim()` and `r_trim` in Python.
[[release-3-7-1]]
=== TinkerPop 3.7.1 (November 20, 2023)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ def lTrim(self, *args):
self.bytecode.add_step("lTrim", *args)
return self

def l_trim(self, *args):
self.bytecode.add_step("lTrim", *args)
return self

def map(self, *args):
self.bytecode.add_step("map", *args)
return self
Expand Down Expand Up @@ -841,6 +845,10 @@ def rTrim(self, *args):
self.bytecode.add_step("rTrim", *args)
return self

def r_trim(self, *args):
self.bytecode.add_step("rTrim", *args)
return self

def sack(self, *args):
self.bytecode.add_step("sack", *args)
return self
Expand Down Expand Up @@ -1413,7 +1421,15 @@ def loops(cls, *args):

@classmethod
def ltrim(cls, *args):
return cls.graph_traversal(None, None, Bytecode()).ltrim(*args)
warnings.warn(
"gremlin_python.process.__.ltrim will be replaced by "
"gremlin_python.process.__.l_trim.",
DeprecationWarning)
return cls.l_trim(*args)

@classmethod
def l_trim(cls, *args):
return cls.graph_traversal(None, None, Bytecode()).l_trim(*args)

@classmethod
def map(cls, *args):
Expand Down Expand Up @@ -1557,7 +1573,15 @@ def reverse(cls, *args):

@classmethod
def rTrim(cls, *args):
return cls.graph_traversal(None, None, Bytecode()).rTrim(*args)
warnings.warn(
"gremlin_python.process.__.rTrim will be replaced by "
"gremlin_python.process.__.r_trim.",
DeprecationWarning)
return cls.r_trim(*args)

@classmethod
def r_trim(cls, *args):
return cls.graph_traversal(None, None, Bytecode()).r_trim(*args)

@classmethod
def sack(cls, *args):
Expand Down Expand Up @@ -2084,7 +2108,11 @@ def loops(*args):


def ltrim(*args):
return __.ltrim(*args)
return __.l_trim(*args)


def l_trim(*args):
return __.l_trim(*args)


def map(*args):
Expand Down Expand Up @@ -2204,7 +2232,11 @@ def reverse(*args):


def rTrim(*args):
return __.rTrim(*args)
return __.r_trim(*args)


def r_trim(*args):
return __.r_trim(*args)


def sack(*args):
Expand Down Expand Up @@ -2485,6 +2517,8 @@ def where(*args):

statics.add_static('ltrim', ltrim)

statics.add_static('l_trim', l_trim)

statics.add_static('map', map)

statics.add_static('match', match)
Expand Down Expand Up @@ -2545,6 +2579,8 @@ def where(*args):

statics.add_static('rTrim', rTrim)

statics.add_static('r_trim', r_trim)

statics.add_static('sack', sack)

statics.add_static('sample', sample)
Expand Down

0 comments on commit 3a071af

Please sign in to comment.