Skip to content

Commit 1cc56e9

Browse files
committed
[refactor] Reduce cognitive complexity from multiple return statements
1 parent e9c5020 commit 1cc56e9

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

app/models.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,14 @@ def key(self):
7777
return self.url
7878

7979
def __eq__(self, other):
80-
if isinstance(other, Resource):
81-
if self.name != other.name:
82-
return False
83-
if self.url != other.url:
84-
return False
85-
if self.paid != other.paid:
86-
return False
87-
if self.notes != other.notes:
88-
return False
89-
if self.category != other.category:
90-
return False
91-
if self.languages != other.languages:
92-
return False
93-
return True
94-
return False
80+
return isinstance(other, Resource) and all([
81+
self.name == other.name,
82+
self.url == other.url,
83+
self.paid == other.paid,
84+
self.notes == other.notes,
85+
self.category == other.category,
86+
self.languages == other.languages
87+
])
9588

9689
def __hash__(self):
9790
return hash(self.url)

0 commit comments

Comments
 (0)