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

Expand RUF015 to include all expression types #5767

Merged
merged 3 commits into from
Jul 21, 2023
Merged

Conversation

charliermarsh
Copy link
Member

Summary

We now allow RUF015 to fix cases like:

list(range(10))[0]
list(x.y)[0]
list(x["y"])[0]

Further, we fix generators like:

[i + 1 for i in x][0]

By rewriting to next(iter(i + 1 for i in x)).

I've retained the special-case that rewrites [i for i in x][0] to next(iter(x)).

Closes #5764.

@charliermarsh charliermarsh force-pushed the charlie/ruf015 branch 2 times, most recently from 7739374 to 635ef10 Compare July 14, 2023 23:47
@github-actions
Copy link
Contributor

github-actions bot commented Jul 14, 2023

PR Check Results

Ecosystem

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

airflow (+25, -0)

+ airflow/providers/amazon/aws/secrets/secrets_manager.py:221:38: RUF015 [*] Prefer `next(...)` over single element slice
+ airflow/providers/apache/hive/macros/hive.py:102:18: RUF015 [*] Prefer `next(iter(p.values()))` over single element slice
+ airflow/providers/cncf/kubernetes/triggers/pod.py:249:21: RUF015 [*] Prefer `next(...)` over single element slice
+ airflow/providers/google/cloud/operators/datafusion.py:47:22: RUF015 [*] Prefer `next(...)` over single element slice
+ airflow/serialization/serialized_objects.py:1136:47: RUF015 [*] Prefer `next(iter(_operator_links_source.items()))` over single element slice
+ dev/perf/scheduler_dag_execution_timing.py:83:19: RUF015 [*] Prefer `next(...)` over single element slice
+ kubernetes_tests/test_kubernetes_pod_operator.py:927:22: RUF015 [*] Prefer `next(...)` over single element slice
+ scripts/ci/pre_commit/pre_commit_version_heads_map.py:39:30: RUF015 [*] Prefer `next(...)` over single element slice
+ tests/decorators/test_python.py:465:22: RUF015 [*] Prefer `next(...)` over single element slice
+ tests/executors/test_kubernetes_executor.py:438:20: RUF015 [*] Prefer `next(iter(executor.event_buffer.values()))` over single element slice
+ tests/jobs/test_triggerer_job.py:556:35: RUF015 [*] Prefer `next(...)` over single element slice
+ tests/models/test_dagrun.py:1709:11: RUF015 [*] Prefer `next(i for i in tis if i.map_index == 0)` over single element slice
+ tests/operators/test_python.py:1184:32: RUF015 [*] Prefer `next(x for x in tis if x.task_id == "op1")` over single element slice
+ tests/operators/test_python.py:1215:32: RUF015 [*] Prefer `next(x for x in tis if x.task_id == "op1")` over single element slice
+ tests/operators/test_python.py:1242:32: RUF015 [*] Prefer `next(x for x in tis if x.task_id == "op1")` over single element slice
+ tests/operators/test_python.py:1277:32: RUF015 [*] Prefer `next(x for x in tis if x.task_id == "op1")` over single element slice
+ tests/providers/amazon/aws/secrets/test_systems_manager.py:160:27: RUF015 [*] Prefer `next(...)` over single element slice
+ tests/providers/google/cloud/operators/test_bigquery.py:678:27: RUF015 [*] Prefer `next(iter(simple_task.operator_extra_links))` over single element slice
+ tests/providers/google/cloud/operators/test_bigquery.py:716:27: RUF015 [*] Prefer `next(iter(simple_task.operator_extra_links))` over single element slice
+ tests/providers/qubole/operators/test_qubole.py:156:27: RUF015 [*] Prefer `next(iter(simple_task.operator_extra_links))` over single element slice
+ tests/system/providers/amazon/aws/utils/__init__.py:67:26: RUF015 [*] Prefer `next(...)` over single element slice
+ tests/test_utils/providers.py:56:19: RUF015 [*] Prefer `next(...)` over single element slice
+ tests/www/test_utils.py:436:15: RUF015 [*] Prefer `next(...)` over single element slice
+ tests/www/views/test_views_acl.py:339:16: RUF015 [*] Prefer `next(iter(resp.json.items()))` over single element slice
+ tests/www/views/test_views_base.py:254:16: RUF015 [*] Prefer `next(iter(resp.json.items()))` over single element slice

bokeh (+7, -0)

+ src/bokeh/core/enums.py:362:41: RUF015 [*] Prefer `next(iter(zip(*_hatch_patterns)))` over single element slice
+ src/bokeh/embed/standalone.py:125:22: RUF015 [*] Prefer `next(...)` over single element slice
+ src/bokeh/io/notebook.py:110:24: RUF015 [*] Prefer `next(...)` over single element slice
+ src/bokeh/plotting/_legends.py:55:20: RUF015 [*] Prefer `next(iter(legend_kwarg.items()))` over single element slice
+ tests/unit/bokeh/embed/test_standalone.py:412:20: RUF015 [*] Prefer `next(...)` over single element slice
+ tests/unit/bokeh/embed/test_util__embed.py:512:15: RUF015 [*] Prefer `next(iter(docs_json.values()))` over single element slice
+ tests/unit/bokeh/embed/test_util__embed.py:524:15: RUF015 [*] Prefer `next(iter(docs_json.values()))` over single element slice

scikit-build (+4, -0)

+ skbuild/cmaker.py:753:20: RUF015 [*] Prefer `next(...)` over single element slice
+ skbuild/command/egg_info.py:27:32: RUF015 [*] Prefer `next(...)` over single element slice
+ skbuild/command/egg_info.py:28:41: RUF015 [*] Prefer `next(...)` over single element slice
+ tests/test_setup.py:778:22: RUF015 [*] Prefer `next(...)` over single element slice

zulip (+36, -0)

+ analytics/management/commands/populate_analytics_db.py:158:67: RUF015 [*] Prefer `next(iter(fixture_data.values()))` over single element slice
+ corporate/views/portico.py:136:37: RUF015 [*] Prefer `next(...)` over single element slice
+ tools/tests/test_zulint_custom_rules.py:71:32: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/lib/event_schema.py:458:12: RUF015 [*] Prefer `next(iter(event["presence"].keys()))` over single element slice
+ zerver/lib/event_schema.py:460:12: RUF015 [*] Prefer `next(iter(event["presence"].values()))` over single element slice
+ zerver/lib/markdown/__init__.py:1155:26: RUF015 [*] Prefer `next(iter(uncle.iter(tag="a")))` over single element slice
+ zerver/lib/test_classes.py:1545:16: RUF015 [*] Prefer `next(r for r in data if r["id"] == db_id)` over single element slice
+ zerver/openapi/python_examples.py:626:25: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/openapi/python_examples.py:629:28: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/tests/test_auth_backends.py:3701:29: RUF015 [*] Prefer `next(iter(oidc_setting_dict.values()))` over single element slice
+ zerver/tests/test_auth_backends.py:3751:27: RUF015 [*] Prefer `next(iter(mock_oidc_setting_dict.values()))` over single element slice
+ zerver/tests/test_auth_backends.py:3766:27: RUF015 [*] Prefer `next(iter(mock_oidc_setting_dict.values()))` over single element slice
+ zerver/tests/test_event_system.py:588:30: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/tests/test_event_system.py:797:26: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/tests/test_event_system.py:808:26: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/tests/test_events.py:1083:26: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/tests/test_events.py:1094:26: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/tests/test_gitter_importer.py:103:45: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/tests/test_gitter_importer.py:98:41: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/tests/test_logging_handlers.py:69:16: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/tests/test_message_fetch.py:2811:27: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/tests/test_message_send.py:2001:31: RUF015 [*] Prefer `next(iter(recent_conversations.values()))` over single element slice
+ zerver/tests/test_message_send.py:590:31: RUF015 [*] Prefer `next(iter(recent_conversations.values()))` over single element slice
+ zerver/tests/test_message_send.py:591:24: RUF015 [*] Prefer `next(iter(recent_conversations.keys()))` over single element slice
+ zerver/tests/test_message_send.py:615:31: RUF015 [*] Prefer `next(iter(recent_conversations.values()))` over single element slice
+ zerver/tests/test_message_send.py:616:24: RUF015 [*] Prefer `next(iter(recent_conversations.keys()))` over single element slice
+ zerver/tests/test_users.py:2161:27: RUF015 [*] Prefer `next(...)` over single element slice
+ zerver/views/realm_emoji.py:43:18: RUF015 [*] Prefer `next(iter(request.FILES.values()))` over single element slice
+ zerver/views/realm_icon.py:22:17: RUF015 [*] Prefer `next(iter(request.FILES.values()))` over single element slice
+ zerver/views/realm_logo.py:28:17: RUF015 [*] Prefer `next(iter(request.FILES.values()))` over single element slice
+ zerver/views/upload.py:272:17: RUF015 [*] Prefer `next(iter(request.FILES.values()))` over single element slice
+ zerver/views/user_settings.py:366:17: RUF015 [*] Prefer `next(iter(request.FILES.values()))` over single element slice
+ zerver/views/users.py:417:21: RUF015 [*] Prefer `next(iter(request.FILES.values()))` over single element slice
+ zerver/views/users.py:559:21: RUF015 [*] Prefer `next(iter(request.FILES.values()))` over single element slice
+ zproject/backends.py:2847:40: RUF015 [*] Prefer `next(...)` over single element slice
+ zproject/backends.py:2874:27: RUF015 [*] Prefer `next(...)` over single element slice

Rules changed: 1
Rule Changes Additions Removals
RUF015 72 72 0

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00      9.8±0.03ms     4.2 MB/sec    1.00      9.8±0.02ms     4.2 MB/sec
formatter/numpy/ctypeslib.py               1.00   1899.3±2.51µs     8.8 MB/sec    1.01   1908.9±4.12µs     8.7 MB/sec
formatter/numpy/globals.py                 1.00    206.8±1.70µs    14.3 MB/sec    1.01    208.4±1.99µs    14.2 MB/sec
formatter/pydantic/types.py                1.00      4.2±0.01ms     6.1 MB/sec    1.00      4.2±0.01ms     6.1 MB/sec
linter/all-rules/large/dataset.py          1.00     13.6±0.06ms     3.0 MB/sec    1.01     13.6±0.02ms     3.0 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.4±0.01ms     4.8 MB/sec    1.01      3.5±0.00ms     4.8 MB/sec
linter/all-rules/numpy/globals.py          1.00    371.5±1.32µs     7.9 MB/sec    1.00    371.6±1.25µs     7.9 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.1±0.01ms     4.2 MB/sec    1.01      6.2±0.01ms     4.1 MB/sec
linter/default-rules/large/dataset.py      1.00      7.1±0.01ms     5.8 MB/sec    1.01      7.1±0.01ms     5.7 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1430.5±2.23µs    11.6 MB/sec    1.01   1448.0±1.49µs    11.5 MB/sec
linter/default-rules/numpy/globals.py      1.00    149.9±0.23µs    19.7 MB/sec    1.01    151.2±0.26µs    19.5 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.1±0.00ms     8.1 MB/sec    1.01      3.2±0.00ms     8.1 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00     11.2±0.26ms     3.6 MB/sec    1.03     11.5±0.45ms     3.5 MB/sec
formatter/numpy/ctypeslib.py               1.00      2.2±0.05ms     7.7 MB/sec    1.04      2.2±0.12ms     7.4 MB/sec
formatter/numpy/globals.py                 1.00    242.2±8.51µs    12.2 MB/sec    1.01   245.2±10.61µs    12.0 MB/sec
formatter/pydantic/types.py                1.00      4.8±0.16ms     5.3 MB/sec    1.01      4.9±0.18ms     5.2 MB/sec
linter/all-rules/large/dataset.py          1.00     15.9±0.43ms     2.6 MB/sec    1.00     15.9±0.48ms     2.6 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      4.1±0.09ms     4.1 MB/sec    1.04      4.2±0.15ms     3.9 MB/sec
linter/all-rules/numpy/globals.py          1.00   505.0±25.17µs     5.8 MB/sec    1.00   505.8±22.29µs     5.8 MB/sec
linter/all-rules/pydantic/types.py         1.00      7.1±0.21ms     3.6 MB/sec    1.01      7.2±0.22ms     3.5 MB/sec
linter/default-rules/large/dataset.py      1.00      8.3±0.19ms     4.9 MB/sec    1.00      8.3±0.25ms     4.9 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1704.3±40.36µs     9.8 MB/sec    1.02  1732.4±59.36µs     9.6 MB/sec
linter/default-rules/numpy/globals.py      1.00    191.1±3.46µs    15.4 MB/sec    1.04   198.4±12.09µs    14.9 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.6±0.08ms     7.0 MB/sec    1.02      3.7±0.09ms     6.9 MB/sec

@charliermarsh
Copy link
Member Author

I need to change the diagnostic to avoid including the entire snippet if it's multi-line.

@charliermarsh
Copy link
Member Author

It's a lot of new violations but they generally look correct to me.

Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

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

Nice!

@hoxbro
Copy link
Contributor

hoxbro commented Jul 15, 2023

Sorry for the noise, but isn't it possible to reduce next(iter(i + 1 for i in x)) down to next(i + 1 for i in x)?

@charliermarsh
Copy link
Member Author

Good point!

@charliermarsh
Copy link
Member Author

@zanieb - Do you mind taking a look at this one? I'd love to get more sets of eyes on whether this is a safe / correct refactor from the Python perspective.

@zanieb
Copy link
Member

zanieb commented Jul 20, 2023

I've given the ecosystem changes a look and thought about the rule a bit. I can't really think of any downsides here other than that it's a little advanced for most users in comparison with list(...)[0] and the StopIteration error is definitely less than ideal. I think "suggested" is a good applicability for this fix.

@charliermarsh charliermarsh merged commit 5f2014b into main Jul 21, 2023
17 checks passed
@charliermarsh charliermarsh deleted the charlie/ruf015 branch July 21, 2023 00:08
jankatins added a commit to jankatins/pr-workflow-example that referenced this pull request Jul 22, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://beta.ruff.rs/docs)
([source](https://togithub.com/astral-sh/ruff),
[changelog](https://togithub.com/astral-sh/ruff/releases)) | `0.0.278`
-> `0.0.280` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>astral-sh/ruff (ruff)</summary>

###
[`v0.0.280`](https://togithub.com/astral-sh/ruff/compare/v0.0.279...v0.0.280)

[Compare
Source](https://togithub.com/astral-sh/ruff/compare/v0.0.279...v0.0.280)

###
[`v0.0.279`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.279)

[Compare
Source](https://togithub.com/astral-sh/ruff/compare/v0.0.278...v0.0.279)

<!-- Release notes generated using configuration in .github/release.yml
at v0.0.279 -->

#### What's Changed

##### Rules

- \[`flake8-pyi`] Implement flake8-pyi's PYI026 by
[@&#8203;LaBatata101](https://togithub.com/LaBatata101) in
[astral-sh/ruff#5844
- \[`flake8-pyi`] Implement flake8-pyi's `PYI017` by
[@&#8203;qdegraaf](https://togithub.com/qdegraaf) in
[astral-sh/ruff#5895
- \[`flake8-pyi`] Implement flake8-pyi's `PYI036` by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5668
- \[`flake8-pyi`] Implement flake8-pyi's `PYI041` by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5722
- \[`flake8-use-pathlib`] Implement `os-path-getsize` and
`os-path-get(a|m|c)-time` (`PTH202-205`) by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5835
- \[`flake8-use-pathlib`] Implement `path-constructor-default-argument`
(`PTH201`) by [@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5833
- \[`pandas-vet`] Implement constant series rule (`PD101`) by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5802
- \[`pylint`] Implement Pylint's `consider-using-in` (`PLR1714`) by
[@&#8203;tjkuson](https://togithub.com/tjkuson) in
[astral-sh/ruff#5193

##### Rule changes

- \[`flake8-annotations`] Check for `Any` in other types for `ANN401` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5601
- \[`flake8-bugbear`] Add autofix for B004 by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5788
- \[`flake8-bugbear`] Remove `B904`'s lowercase exemption by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5751
- \[`flake8-use-pathlib`] extend PTH118 with `os.sep` by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5935
- \[`pyupgrade`] Expand scope of `quoted-annotation` rule (`UP037`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5766
- \[`pyupgrade`] Extend PEP 604 rewrites to support some quoted
annotations by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5725
- \[`ruff`] Expand `RUF015` to include all expression types by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5767

##### Bug Fixes

- Consider single element subscript expr for implicit optional by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5717
- Ignore `Enum`-and-`str` subclasses for slots enforcement by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5749
- Avoid removing raw strings in comparison fixes by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5755
- Fix nested calls to `sorted` with differing arguments by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5761
- Use unused variable detection to power `incorrect-dict-iterator` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5763
- Include alias when formatting import-from structs by
[@&#8203;guillaumeLepape](https://togithub.com/guillaumeLepape) in
[astral-sh/ruff#5786
- Make `lint_only` aware of the source kind by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5876
- Restore `redefined-while-unused` violations in classes by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5926
- Flatten nested tuples when fixing UP007 violations by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5724
- Ignore Jupyter Notebooks for `--add-noqa` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5727
- Avoid checking `EXE001` and `EXE002` on WSL by
[@&#8203;tjkuson](https://togithub.com/tjkuson) in
[astral-sh/ruff#5735
- Properly group assignment targets by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[astral-sh/ruff#5728
- Avoid stack overflow for non-BitOr binary types by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5743
- Move function visit out of `Expr::Call` branches by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5772
- \[B006] Add bytes to immutable types by
[@&#8203;harupy](https://togithub.com/harupy) in
[astral-sh/ruff#5776
- Format `SetComp` by [@&#8203;lkh42t](https://togithub.com/lkh42t) in
[astral-sh/ruff#5774
- Gate `runtime-import-in-type-checking-block` (`TCH004`) behind enabled
flag by [@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5789
- perf: only compute start offset for overlong lines by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5811
- Change `pandas-use-of-dot-read-table` rule to emit only when
`read_table` is used on CSV data by
[@&#8203;tjkuson](https://togithub.com/tjkuson) in
[astral-sh/ruff#5807
- Do not fix `NamedTuple` calls containing both a list of fields and
keywords by [@&#8203;harupy](https://togithub.com/harupy) in
[astral-sh/ruff#5799
- Ignore directories when collecting files to lint by
[@&#8203;harupy](https://togithub.com/harupy) in
[astral-sh/ruff#5775
- Add filename to `noqa` warnings by
[@&#8203;sobolevn](https://togithub.com/sobolevn) in
[astral-sh/ruff#5856
- Handle io errors gracefully by
[@&#8203;konstin](https://togithub.com/konstin) in
[astral-sh/ruff#5611
- Allow `respect_gitignore` when not in a git repo by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5937

#### New Contributors

- [@&#8203;eggplants](https://togithub.com/eggplants) made their first
contribution in
[astral-sh/ruff#5741
- [@&#8203;guillaumeLepape](https://togithub.com/guillaumeLepape) made
their first contribution in
[astral-sh/ruff#5786
- [@&#8203;odiseo0](https://togithub.com/odiseo0) made their first
contribution in
[astral-sh/ruff#5888
- [@&#8203;DavidCain](https://togithub.com/DavidCain) made their first
contribution in
[astral-sh/ruff#5889
- [@&#8203;LaBatata101](https://togithub.com/LaBatata101) made their
first contribution in
[astral-sh/ruff#5844

**Full Changelog**:
astral-sh/ruff@v0.0.278...v0.0.279

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/jankatins/pr-workflow-example).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
renovate bot added a commit to allenporter/pyrainbird that referenced this pull request Jul 23, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://beta.ruff.rs/docs)
([source](https://togithub.com/astral-sh/ruff),
[changelog](https://togithub.com/astral-sh/ruff/releases)) | `==0.0.278`
-> `==0.0.280` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>astral-sh/ruff (ruff)</summary>

###
[`v0.0.280`](https://togithub.com/astral-sh/ruff/compare/v0.0.279...v0.0.280)

[Compare
Source](https://togithub.com/astral-sh/ruff/compare/v0.0.279...v0.0.280)

###
[`v0.0.279`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.279)

[Compare
Source](https://togithub.com/astral-sh/ruff/compare/v0.0.278...v0.0.279)

<!-- Release notes generated using configuration in .github/release.yml
at v0.0.279 -->

#### What's Changed

##### Rules

- \[`flake8-pyi`] Implement flake8-pyi's PYI026 by
[@&#8203;LaBatata101](https://togithub.com/LaBatata101) in
[astral-sh/ruff#5844
- \[`flake8-pyi`] Implement flake8-pyi's `PYI017` by
[@&#8203;qdegraaf](https://togithub.com/qdegraaf) in
[astral-sh/ruff#5895
- \[`flake8-pyi`] Implement flake8-pyi's `PYI036` by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5668
- \[`flake8-pyi`] Implement flake8-pyi's `PYI041` by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5722
- \[`flake8-use-pathlib`] Implement `os-path-getsize` and
`os-path-get(a|m|c)-time` (`PTH202-205`) by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5835
- \[`flake8-use-pathlib`] Implement `path-constructor-default-argument`
(`PTH201`) by [@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5833
- \[`pandas-vet`] Implement constant series rule (`PD101`) by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5802
- \[`pylint`] Implement Pylint's `consider-using-in` (`PLR1714`) by
[@&#8203;tjkuson](https://togithub.com/tjkuson) in
[astral-sh/ruff#5193

##### Rule changes

- \[`flake8-annotations`] Check for `Any` in other types for `ANN401` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5601
- \[`flake8-bugbear`] Add autofix for B004 by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5788
- \[`flake8-bugbear`] Remove `B904`'s lowercase exemption by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5751
- \[`flake8-use-pathlib`] extend PTH118 with `os.sep` by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5935
- \[`pyupgrade`] Expand scope of `quoted-annotation` rule (`UP037`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5766
- \[`pyupgrade`] Extend PEP 604 rewrites to support some quoted
annotations by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5725
- \[`ruff`] Expand `RUF015` to include all expression types by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5767

##### Bug Fixes

- Consider single element subscript expr for implicit optional by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5717
- Ignore `Enum`-and-`str` subclasses for slots enforcement by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5749
- Avoid removing raw strings in comparison fixes by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5755
- Fix nested calls to `sorted` with differing arguments by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5761
- Use unused variable detection to power `incorrect-dict-iterator` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5763
- Include alias when formatting import-from structs by
[@&#8203;guillaumeLepape](https://togithub.com/guillaumeLepape) in
[astral-sh/ruff#5786
- Make `lint_only` aware of the source kind by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5876
- Restore `redefined-while-unused` violations in classes by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5926
- Flatten nested tuples when fixing UP007 violations by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5724
- Ignore Jupyter Notebooks for `--add-noqa` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5727
- Avoid checking `EXE001` and `EXE002` on WSL by
[@&#8203;tjkuson](https://togithub.com/tjkuson) in
[astral-sh/ruff#5735
- Properly group assignment targets by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[astral-sh/ruff#5728
- Avoid stack overflow for non-BitOr binary types by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5743
- Move function visit out of `Expr::Call` branches by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5772
- \[B006] Add bytes to immutable types by
[@&#8203;harupy](https://togithub.com/harupy) in
[astral-sh/ruff#5776
- Format `SetComp` by [@&#8203;lkh42t](https://togithub.com/lkh42t) in
[astral-sh/ruff#5774
- Gate `runtime-import-in-type-checking-block` (`TCH004`) behind enabled
flag by [@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5789
- perf: only compute start offset for overlong lines by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5811
- Change `pandas-use-of-dot-read-table` rule to emit only when
`read_table` is used on CSV data by
[@&#8203;tjkuson](https://togithub.com/tjkuson) in
[astral-sh/ruff#5807
- Do not fix `NamedTuple` calls containing both a list of fields and
keywords by [@&#8203;harupy](https://togithub.com/harupy) in
[astral-sh/ruff#5799
- Ignore directories when collecting files to lint by
[@&#8203;harupy](https://togithub.com/harupy) in
[astral-sh/ruff#5775
- Add filename to `noqa` warnings by
[@&#8203;sobolevn](https://togithub.com/sobolevn) in
[astral-sh/ruff#5856
- Handle io errors gracefully by
[@&#8203;konstin](https://togithub.com/konstin) in
[astral-sh/ruff#5611
- Allow `respect_gitignore` when not in a git repo by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5937

#### New Contributors

- [@&#8203;eggplants](https://togithub.com/eggplants) made their first
contribution in
[astral-sh/ruff#5741
- [@&#8203;guillaumeLepape](https://togithub.com/guillaumeLepape) made
their first contribution in
[astral-sh/ruff#5786
- [@&#8203;odiseo0](https://togithub.com/odiseo0) made their first
contribution in
[astral-sh/ruff#5888
- [@&#8203;DavidCain](https://togithub.com/DavidCain) made their first
contribution in
[astral-sh/ruff#5889
- [@&#8203;LaBatata101](https://togithub.com/LaBatata101) made their
first contribution in
[astral-sh/ruff#5844

**Full Changelog**:
astral-sh/ruff@v0.0.278...v0.0.279

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/allenporter/pyrainbird).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot added a commit to allenporter/flux-local that referenced this pull request Jul 24, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://beta.ruff.rs/docs)
([source](https://togithub.com/astral-sh/ruff),
[changelog](https://togithub.com/astral-sh/ruff/releases)) | `==0.0.278`
-> `==0.0.280` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>astral-sh/ruff (ruff)</summary>

###
[`v0.0.280`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.280)

[Compare
Source](https://togithub.com/astral-sh/ruff/compare/v0.0.279...v0.0.280)

<!-- Release notes generated using configuration in .github/release.yml
at v0.0.280 -->

#### What's Changed

##### Bug Fixes

- Avoid collapsing `elif` and `else` branches during import sorting by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5964

**Full Changelog**:
astral-sh/ruff@v0.0.279...v0.0.280

###
[`v0.0.279`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.279)

[Compare
Source](https://togithub.com/astral-sh/ruff/compare/v0.0.278...v0.0.279)

<!-- Release notes generated using configuration in .github/release.yml
at v0.0.279 -->

#### What's Changed

##### Rules

- \[`flake8-pyi`] Implement flake8-pyi's PYI026 by
[@&#8203;LaBatata101](https://togithub.com/LaBatata101) in
[astral-sh/ruff#5844
- \[`flake8-pyi`] Implement flake8-pyi's `PYI017` by
[@&#8203;qdegraaf](https://togithub.com/qdegraaf) in
[astral-sh/ruff#5895
- \[`flake8-pyi`] Implement flake8-pyi's `PYI036` by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5668
- \[`flake8-pyi`] Implement flake8-pyi's `PYI041` by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5722
- \[`flake8-use-pathlib`] Implement `os-path-getsize` and
`os-path-get(a|m|c)-time` (`PTH202-205`) by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5835
- \[`flake8-use-pathlib`] Implement `path-constructor-default-argument`
(`PTH201`) by [@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5833
- \[`pandas-vet`] Implement constant series rule (`PD101`) by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5802
- \[`pylint`] Implement Pylint's `consider-using-in` (`PLR1714`) by
[@&#8203;tjkuson](https://togithub.com/tjkuson) in
[astral-sh/ruff#5193

##### Rule changes

- \[`flake8-annotations`] Check for `Any` in other types for `ANN401` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5601
- \[`flake8-bugbear`] Add autofix for B004 by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5788
- \[`flake8-bugbear`] Remove `B904`'s lowercase exemption by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5751
- \[`flake8-use-pathlib`] extend PTH118 with `os.sep` by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5935
- \[`pyupgrade`] Expand scope of `quoted-annotation` rule (`UP037`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5766
- \[`pyupgrade`] Extend PEP 604 rewrites to support some quoted
annotations by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5725
- \[`ruff`] Expand `RUF015` to include all expression types by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5767

##### Bug Fixes

- Consider single element subscript expr for implicit optional by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5717
- Ignore `Enum`-and-`str` subclasses for slots enforcement by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5749
- Avoid removing raw strings in comparison fixes by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5755
- Fix nested calls to `sorted` with differing arguments by
[@&#8203;density](https://togithub.com/density) in
[astral-sh/ruff#5761
- Use unused variable detection to power `incorrect-dict-iterator` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5763
- Include alias when formatting import-from structs by
[@&#8203;guillaumeLepape](https://togithub.com/guillaumeLepape) in
[astral-sh/ruff#5786
- Make `lint_only` aware of the source kind by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5876
- Restore `redefined-while-unused` violations in classes by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5926
- Flatten nested tuples when fixing UP007 violations by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5724
- Ignore Jupyter Notebooks for `--add-noqa` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5727
- Avoid checking `EXE001` and `EXE002` on WSL by
[@&#8203;tjkuson](https://togithub.com/tjkuson) in
[astral-sh/ruff#5735
- Properly group assignment targets by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[astral-sh/ruff#5728
- Avoid stack overflow for non-BitOr binary types by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5743
- Move function visit out of `Expr::Call` branches by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5772
- \[B006] Add bytes to immutable types by
[@&#8203;harupy](https://togithub.com/harupy) in
[astral-sh/ruff#5776
- Format `SetComp` by [@&#8203;lkh42t](https://togithub.com/lkh42t) in
[astral-sh/ruff#5774
- Gate `runtime-import-in-type-checking-block` (`TCH004`) behind enabled
flag by [@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#5789
- perf: only compute start offset for overlong lines by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#5811
- Change `pandas-use-of-dot-read-table` rule to emit only when
`read_table` is used on CSV data by
[@&#8203;tjkuson](https://togithub.com/tjkuson) in
[astral-sh/ruff#5807
- Do not fix `NamedTuple` calls containing both a list of fields and
keywords by [@&#8203;harupy](https://togithub.com/harupy) in
[astral-sh/ruff#5799
- Ignore directories when collecting files to lint by
[@&#8203;harupy](https://togithub.com/harupy) in
[astral-sh/ruff#5775
- Add filename to `noqa` warnings by
[@&#8203;sobolevn](https://togithub.com/sobolevn) in
[astral-sh/ruff#5856
- Handle io errors gracefully by
[@&#8203;konstin](https://togithub.com/konstin) in
[astral-sh/ruff#5611
- Allow `respect_gitignore` when not in a git repo by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[astral-sh/ruff#5937

#### New Contributors

- [@&#8203;eggplants](https://togithub.com/eggplants) made their first
contribution in
[astral-sh/ruff#5741
- [@&#8203;guillaumeLepape](https://togithub.com/guillaumeLepape) made
their first contribution in
[astral-sh/ruff#5786
- [@&#8203;odiseo0](https://togithub.com/odiseo0) made their first
contribution in
[astral-sh/ruff#5888
- [@&#8203;DavidCain](https://togithub.com/DavidCain) made their first
contribution in
[astral-sh/ruff#5889
- [@&#8203;LaBatata101](https://togithub.com/LaBatata101) made their
first contribution in
[astral-sh/ruff#5844

**Full Changelog**:
astral-sh/ruff@v0.0.278...v0.0.279

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

RUF015 bad code example does not throw a warning
5 participants