Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc7600b4

Browse files
authored
add type checking for graph __eq__ (#2531)
1 parentdecd1f6 commitc7600b4

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

‎redis/commands/graph/edge.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ def __str__(self):
6161
returnres
6262

6363
def__eq__(self,rhs):
64+
# Type checking
65+
ifnotisinstance(rhs,Edge):
66+
returnFalse
67+
6468
# Quick positive check, if both IDs are set.
6569
ifself.idisnotNoneandrhs.idisnotNoneandself.id==rhs.id:
6670
returnTrue

‎redis/commands/graph/node.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ def __str__(self):
6565
returnres
6666

6767
def__eq__(self,rhs):
68+
# Type checking
69+
ifnotisinstance(rhs,Node):
70+
returnFalse
71+
6872
# Quick positive check, if both IDs are set.
6973
ifself.idisnotNoneandrhs.idisnotNoneandself.id!=rhs.id:
7074
returnFalse

‎redis/commands/graph/path.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ def add_edge(self, edge):
5454
returnself
5555

5656
def__eq__(self,other):
57+
# Type checking
58+
ifnotisinstance(other,Path):
59+
returnFalse
60+
5761
returnself.nodes()==other.nodes()andself.edges()==other.edges()
5862

5963
def__str__(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp