Skip to content

Commit 08e70a1

Browse files
authored
refactoring: ♻️ Use of NotImplemented in __eq__
1 parent 4937769 commit 08e70a1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

injection/integrations/fastapi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ def __init__(self, cls: type[T] | TypeAliasType | GenericAlias, module: Module):
3939
self.__class = cls
4040

4141
def __eq__(self, other: Any) -> bool:
42-
cls = type(self)
43-
return isinstance(other, cls) and hash(self) == hash(other)
42+
if isinstance(other, type(self)):
43+
return hash(self) == hash(other)
44+
45+
return NotImplemented
4446

4547
def __hash__(self) -> int:
4648
return hash((self.__class,))

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)