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] Avoid suggesting set rewrites for non-hashable types #9956

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Ensures that x in [y, z] does not trigger in x, y, or z are known not to be hashable.

Closes #9928.

@charliermarsh charliermarsh added the bug Something isn't working label Feb 12, 2024
@charliermarsh charliermarsh marked this pull request as ready for review February 12, 2024 17:17
Copy link
Contributor

github-actions bot commented Feb 12, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -12 violations, +0 -0 fixes in 4 projects; 39 projects unchanged)

apache/airflow (+0 -7 violations, +0 -0 fixes)

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

- airflow/providers/google/cloud/hooks/bigquery.py:2204:70: PLR6201 Use a `set` literal when testing for membership
- airflow/providers/google/cloud/hooks/bigquery.py:2209:25: PLR6201 Use a `set` literal when testing for membership
- airflow/providers/google/cloud/hooks/bigquery.py:2993:70: PLR6201 Use a `set` literal when testing for membership
- airflow/providers/google/cloud/hooks/bigquery.py:2998:25: PLR6201 Use a `set` literal when testing for membership
- airflow/serialization/serialized_objects.py:642:69: PLR6201 Use a `set` literal when testing for membership
- tests/providers/google/cloud/operators/test_stackdriver.py:191:26: PLR6201 Use a `set` literal when testing for membership
- tests/utils/test_operator_resources.py:26:25: PLR6201 Use a `set` literal when testing for membership

milvus-io/pymilvus (+0 -1 violations, +0 -0 fixes)

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

- pymilvus/client/grpc_handler.py:1387:32: PLR6201 Use a `set` literal when testing for membership

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

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

- pandas/plotting/_matplotlib/core.py:183:18: PLR6201 Use a `set` literal when testing for membership
- pandas/tseries/frequencies.py:231:32: PLR6201 Use a `set` literal when testing for membership

zulip/zulip (+0 -2 violations, +0 -0 fixes)

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

- zerver/migrations/0460_backfill_realmauditlog_extradata_to_json_field.py:119:29: PLR6201 Use a `set` literal when testing for membership
- zilencer/migrations/0027_backfill_remote_realmauditlog_extradata_to_json_field.py:74:29: PLR6201 Use a `set` literal when testing for membership

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLR6201 12 0 12 0 0

Some(Stmt::Assign(ast::StmtAssign { value, .. })) => {
T::match_initializer(value.as_ref(), semantic)
Some(Stmt::Assign(ast::StmtAssign { targets, value, .. })) => {
// TODO(charlie): Replace this with `find_binding_value`, which matches the values.
Copy link
Member Author

Choose a reason for hiding this comment

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

Gonna follow-up on these separately.

@charliermarsh charliermarsh merged commit ab2253d into main Feb 12, 2024
17 checks passed
@charliermarsh charliermarsh deleted the charlie/plr branch February 12, 2024 18:05
nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
…al-sh#9956)

## Summary

Ensures that `x in [y, z]` does not trigger in `x`, `y`, or `z` are
known _not_ to be hashable.

Closes astral-sh#9928.
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.

PLR6201 fails but cannot be fixed on list in tuple(list, list)
1 participant