Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pylint] Fixed false-positive on the rule PLW1641 (eq-without-hash) #10566

Merged

Conversation

boolean-light
Copy link
Contributor

Summary

Fixed false-positive on the rule PLW1641, where the explicit assignment on the __hash__ method is not counted as an definition of __hash__. (Discussed in #10557).

Also, added one new testcase.

Test Plan

Checked on cargo test in eq_without_hash.py.

Before the change, for the assignment into __hash__, only __hash__ = None was counted as an explicit definition of __hash__ method.
Probably any assignment into __hash__ property could be counted as an explicit definition of hash, so I removed value.is_none_literal_expr() check.

Copy link
Contributor

github-actions bot commented Mar 25, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+1 -11 violations, +0 -0 fixes in 3 projects; 41 projects unchanged)

pandas-dev/pandas (+0 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

- pandas/core/dtypes/dtypes.py:947:7: PLW1641 Object does not implement `__hash__` method

python/typeshed (+0 -10 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select E,F,FA,I,PYI,RUF,UP,W

- stdlib/io.pyi:17:5: F822 Undefined name `BufferedRWPair` in `__all__`
- stdlib/io.pyi:18:5: F822 Undefined name `BufferedRandom` in `__all__`
- stdlib/io.pyi:19:5: F822 Undefined name `BufferedReader` in `__all__`
- stdlib/io.pyi:20:5: F822 Undefined name `BufferedWriter` in `__all__`
- stdlib/io.pyi:25:5: F822 Undefined name `StringIO` in `__all__`
- stdlib/io.pyi:26:5: F822 Undefined name `TextIOBase` in `__all__`
- stdlib/io.pyi:27:5: F822 Undefined name `TextIOWrapper` in `__all__`
- stdlib/io.pyi:34:40: F822 Undefined name `IncrementalNewlineDecoder` in `__all__`
- stdlib/io.pyi:34:69: F822 Undefined name `text_encoding` in `__all__`
- stdlib/io.pyi:36:1: PYI018 Private TypeVar `_T` is never used

rotki/rotki (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ rotkehlchen/history/events/structures/evm_event.py:63:36: RUF100 [*] Unused `noqa` directive (unused: `PLW1641`)

Changes by rule (4 rules affected)

code total + violation - violation + fix - fix
F822 9 0 9 0 0
RUF100 1 1 0 0 0
PLW1641 1 0 1 0 0
PYI018 1 0 1 0 0

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@charliermarsh charliermarsh added the bug Something isn't working label Mar 25, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) March 25, 2024 14:32
@charliermarsh charliermarsh merged commit f7aab5a into astral-sh:main Mar 25, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants