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

Change iteration-over-set to flag set literals only #4907

Merged
merged 3 commits into from
Jun 6, 2023

Conversation

tjkuson
Copy link
Contributor

@tjkuson tjkuson commented Jun 6, 2023

Summary

Changes the logic of the iteration-over-set rule to match Pylint and only flag iterations over set literals.

Addresses comment by @andersk in #4706 (comment).

Test Plan

cargo test

@charliermarsh
Copy link
Member

Thanks!

@tjkuson tjkuson marked this pull request as ready for review June 6, 2023 20:57
@tjkuson
Copy link
Contributor Author

tjkuson commented Jun 6, 2023

This PR is ready for review. It should resolve the issue raised in the comment I linked above!

@charliermarsh charliermarsh enabled auto-merge (squash) June 6, 2023 21:00
@charliermarsh charliermarsh merged commit 7cc205b into astral-sh:main Jun 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

PR Check Results

Ecosystem

ℹ️ ecosystem check detected changes. (+0, -5, 0 error(s))

airflow (+0, -1)

- airflow/serialization/serialized_objects.py:1071:19: PLC0208 Use a sequence type instead of a `set` when iterating over values

zulip (+0, -4)

- zerver/management/commands/add_users_to_streams.py:28:28: PLC0208 Use a sequence type instead of a `set` when iterating over values
- zerver/management/commands/create_default_stream_groups.py:43:28: PLC0208 Use a sequence type instead of a `set` when iterating over values
- zerver/tests/test_auth_backends.py:1591:28: PLC0208 Use a sequence type instead of a `set` when iterating over values
- zerver/tests/test_auth_backends.py:4602:28: PLC0208 Use a sequence type instead of a `set` when iterating over values

Rules changed: 1
Rule Changes Additions Removals
PLC0208 5 0 5

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.01      6.2±0.01ms     6.5 MB/sec    1.00      6.2±0.02ms     6.6 MB/sec
formatter/numpy/ctypeslib.py               1.01  1271.3±34.18µs    13.1 MB/sec    1.00   1257.4±7.80µs    13.2 MB/sec
formatter/numpy/globals.py                 1.00    145.7±0.34µs    20.2 MB/sec    1.00    146.3±0.47µs    20.2 MB/sec
formatter/pydantic/types.py                1.00      2.7±0.00ms     9.4 MB/sec    1.00      2.7±0.01ms     9.4 MB/sec
linter/all-rules/large/dataset.py          1.01     15.1±0.07ms     2.7 MB/sec    1.00     15.0±0.08ms     2.7 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.6±0.01ms     4.6 MB/sec    1.00      3.6±0.01ms     4.6 MB/sec
linter/all-rules/numpy/globals.py          1.00    365.7±3.89µs     8.1 MB/sec    1.00    364.4±1.27µs     8.1 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.3±0.02ms     4.1 MB/sec    1.00      6.2±0.09ms     4.1 MB/sec
linter/default-rules/large/dataset.py      1.02      7.4±0.02ms     5.5 MB/sec    1.00      7.3±0.01ms     5.6 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1544.1±4.16µs    10.8 MB/sec    1.00  1538.8±11.85µs    10.8 MB/sec
linter/default-rules/numpy/globals.py      1.00    164.3±0.20µs    18.0 MB/sec    1.00    164.5±0.88µs    17.9 MB/sec
linter/default-rules/pydantic/types.py     1.01      3.3±0.01ms     7.7 MB/sec    1.00      3.3±0.03ms     7.8 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00      6.1±0.03ms     6.7 MB/sec    1.00      6.1±0.03ms     6.7 MB/sec
formatter/numpy/ctypeslib.py               1.00   1183.0±5.95µs    14.1 MB/sec    1.00  1181.5±22.07µs    14.1 MB/sec
formatter/numpy/globals.py                 1.00    131.9±1.24µs    22.4 MB/sec    1.00    132.4±6.64µs    22.3 MB/sec
formatter/pydantic/types.py                1.01      2.6±0.20ms     9.7 MB/sec    1.00      2.6±0.02ms     9.8 MB/sec
linter/all-rules/large/dataset.py          1.00     13.4±0.06ms     3.0 MB/sec    1.00     13.5±0.06ms     3.0 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.3±0.02ms     5.0 MB/sec    1.00      3.3±0.02ms     5.0 MB/sec
linter/all-rules/numpy/globals.py          1.00    340.5±2.65µs     8.7 MB/sec    1.00    341.6±1.96µs     8.6 MB/sec
linter/all-rules/pydantic/types.py         1.00      5.7±0.02ms     4.5 MB/sec    1.00      5.7±0.03ms     4.5 MB/sec
linter/default-rules/large/dataset.py      1.00      6.9±0.03ms     5.9 MB/sec    1.00      6.9±0.02ms     5.9 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1397.7±7.74µs    11.9 MB/sec    1.00   1391.5±6.74µs    12.0 MB/sec
linter/default-rules/numpy/globals.py      1.00    149.7±1.05µs    19.7 MB/sec    1.00    149.2±1.27µs    19.8 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.1±0.01ms     8.4 MB/sec    1.00      3.0±0.01ms     8.4 MB/sec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants