Merged
Conversation
Member
oschwald
commented
Jun 18, 2025
- Update deps
- Update ruff ignores
- Implement hash in models
Ruff wants this whenever __eq__ is implemented.
There was a problem hiding this comment.
Pull Request Overview
This PR updates dependencies and linter configurations for Ruff 0.12.0 while also adding a hash implementation to model classes. Key changes include the removal of flake8 ignore comments in the request module and the introduction of an explicit hash method in the models module.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| minfraud/request.py | Removal of flake8 ignore comments in domain and email cleaning functions. |
| minfraud/models.py | Addition of a hash method and related formatting updates (including FBT001 noqa comments) in model constructors. |
Comments suppressed due to low confidence (1)
minfraud/request.py:357
- The removal of the flake8 ignore comment for E203 appears intentional with the updated linter configuration; please confirm that these changes no longer trigger linter warnings.
tld = domain[idx + 1 :]
Comment on lines
+23
to
+24
| # This is not particularly efficient, but I don't expect it to be used much. | ||
| return hash(json.dumps(self.to_dict(), sort_keys=True)) |
There was a problem hiding this comment.
The new hash implementation using json.dumps with sort_keys is clear but may have performance implications if used frequently; consider caching the result if this method is expected to be called repeatedly.
Suggested change
| # This is not particularly efficient, but I don't expect it to be used much. | |
| return hash(json.dumps(self.to_dict(), sort_keys=True)) | |
| if not hasattr(self, "_cached_hash"): | |
| self._cached_hash = hash(json.dumps(self.to_dict(), sort_keys=True)) | |
| return self._cached_hash |
horgh
approved these changes
Jun 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.