Skip to content

Commit aeba8d8

Browse files
authored
Merge pull request #780 from opsmill/pog-PLW1641
Add __hash__ method to object that already has __eq__
2 parents 296c34a + 2b01488 commit aeba8d8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

infrahub_sdk/recorder.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def default(cls) -> NoRecorder:
3434
def __eq__(self, other: object) -> bool:
3535
return isinstance(other, NoRecorder)
3636

37+
def __hash__(self) -> int:
38+
return hash(self.__class__)
39+
3740

3841
class JSONRecorder(BaseSettings):
3942
model_config = SettingsConfigDict(env_prefix="INFRAHUB_JSON_RECORDER_")

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ ignore = [
247247
"PLR2004", # Magic value used in comparison
248248
"PLR6301", # Method could be a function, class method, or static method
249249
"PLW0603", # Using the global statement to update `SETTINGS` is discouraged
250-
"PLW1641", # Object does not implement `__hash__` method
251250
"RUF005", # Consider `[*path, str(key)]` instead of concatenation
252251
"RUF029", # Function is declared `async`, but doesn't `await` or use `async` features.
253252
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes

0 commit comments

Comments
 (0)