Skip to content

Commit 6f7f04d

Browse files
committed
Deprecated has_key_() for has_key() and updated changeLog
1 parent 1624305 commit 6f7f04d

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

CHANGELOG.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
3535
* Fixed issue in `gremlin-console` where it couldn't accept plugin files that included empty lines or invalid plugin names.
3636
* Modified grammar to make `none()` usage more consistent as a filter step where it can now be used to chain additional traversal steps and be used anonymously.
3737
* Added missing anonymous support for `disjunct()` in Python and Javascript.
38+
* Deprecated gremlin_python.process.__.has_key_ in favor of gremlin_python.process.__.has_key.
3839
3940
[[release-3-7-3]]
4041
=== TinkerPop 3.7.3 (October 23, 2024)

docs/src/reference/gremlin-variants.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2585,7 +2585,7 @@ In situations where Python reserved words and global functions overlap with stan
25852585
bits of conflicting Gremlin get an underscore appended as a suffix:
25862586
25872587
*Steps* - <<all-step,all_()>>, <<and-step,and_()>>, <<any-step,any_()>>, <<as-step,as_()>>, <<filter-step,filter_()>>, <<from-step,from_()>>,
2588-
<<has-step,has_key_>>, <<id-step,id_()>>, <<is-step,is_()>>, <<in-step,in_()>>, <<max-step,max_()>>,
2588+
<<id-step,id_()>>, <<is-step,is_()>>, <<in-step,in_()>>, <<max-step,max_()>>,
25892589
<<min-step,min_()>>, <<not-step,not_()>>, <<or-step,or_()>>, <<range-step,range_()>>, <<sum-step,sum_()>>,
25902590
<<with-step,with_()>>
25912591

gremlin-python/src/main/python/gremlin_python/process/graph_traversal.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,16 @@ def hasKey(self, *args):
542542
"gremlin_python.process.GraphTraversalSource.hasKey will be replaced by "
543543
"gremlin_python.process.GraphTraversalSource.has_key.",
544544
DeprecationWarning)
545-
return self.has_key_(*args)
545+
return self.has_key(*args)
546546

547547
def has_key_(self, *args):
548+
warnings.warn(
549+
"gremlin_python.process.GraphTraversalSource.has_key_ will be replaced by "
550+
"gremlin_python.process.GraphTraversalSource.has_key.",
551+
DeprecationWarning)
552+
return self.has_key(*args)
553+
554+
def has_key(self, *args):
548555
self.bytecode.add_step("hasKey", *args)
549556
return self
550557

@@ -1301,11 +1308,19 @@ def hasKey(cls, *args):
13011308
"gremlin_python.process.__.hasKey will be replaced by "
13021309
"gremlin_python.process.__.has_key.",
13031310
DeprecationWarning)
1304-
return cls.has_key_(*args)
1311+
return cls.has_key(*args)
13051312

13061313
@classmethod
13071314
def has_key_(cls, *args):
1308-
return cls.graph_traversal(None, None, Bytecode()).has_key_(*args)
1315+
warnings.warn(
1316+
"gremlin_python.process.__.has_key_ will be replaced by "
1317+
"gremlin_python.process.__.has_key.",
1318+
DeprecationWarning)
1319+
return cls.has_key(*args)
1320+
1321+
@classmethod
1322+
def has_key (cls, *args):
1323+
return cls.graph_traversal(None, None, Bytecode()).has_key(*args)
13091324

13101325
@classmethod
13111326
def hasLabel(cls, *args):
@@ -2020,12 +2035,14 @@ def has_id(*args):
20202035

20212036

20222037
def hasKey(*args):
2023-
return __.has_key_(*args)
2038+
return __.has_key(*args)
20242039

20252040

20262041
def has_key_(*args):
2027-
return __.has_key_(*args)
2042+
return __.has_key(*args)
20282043

2044+
def has_key(*args):
2045+
return __.has_key(*args)
20292046

20302047
def hasLabel(*args):
20312048
return __.has_label(*args)
@@ -2485,7 +2502,7 @@ def where(*args):
24852502

24862503
statics.add_static('hasKey', hasKey)
24872504

2488-
statics.add_static('has_key', has_key_)
2505+
statics.add_static('has_key', has_key)
24892506

24902507
statics.add_static('hasLabel', hasLabel)
24912508

0 commit comments

Comments
 (0)