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

Fix is_module_name() and improve perf of is_identifier() #3795

Merged
merged 8 commits into from
Mar 31, 2023

Conversation

JonathanPlasse
Copy link
Contributor

@JonathanPlasse JonathanPlasse commented Mar 29, 2023

  • For is_module_name()
    • Must not be a reserved keyword
    • use is_ascii_lowercase() and is_ascii_digit()
  • Improve perf of is_indentifier()

crates/ruff_python_stdlib/src/identifiers.rs Outdated Show resolved Hide resolved
crates/ruff_python_stdlib/src/identifiers.rs Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented Mar 29, 2023

PR Check Results

Ecosystem

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

zulip (+1, -0)

+ zerver/management/commands/import.py:1:1: N999 Invalid module name: 'import'

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.02     14.2±0.10ms     2.9 MB/sec    1.00     14.0±0.11ms     2.9 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.01      3.5±0.03ms     4.7 MB/sec    1.00      3.5±0.01ms     4.7 MB/sec
linter/all-rules/numpy/globals.py          1.00    451.8±1.94µs     6.5 MB/sec    1.01    456.9±2.26µs     6.5 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.0±0.06ms     4.3 MB/sec    1.00      6.0±0.05ms     4.2 MB/sec
linter/default-rules/large/dataset.py      1.00      7.2±0.05ms     5.6 MB/sec    1.00      7.3±0.04ms     5.6 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1626.9±5.40µs    10.2 MB/sec    1.01   1637.5±4.37µs    10.2 MB/sec
linter/default-rules/numpy/globals.py      1.00    182.0±0.33µs    16.2 MB/sec    1.01    184.1±2.67µs    16.0 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.3±0.02ms     7.6 MB/sec    1.00      3.4±0.02ms     7.6 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.00     18.1±0.53ms     2.3 MB/sec    1.00     18.1±0.47ms     2.2 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      4.7±0.13ms     3.6 MB/sec    1.02      4.8±0.23ms     3.5 MB/sec
linter/all-rules/numpy/globals.py          1.00   577.4±26.31µs     5.1 MB/sec    1.02   590.6±33.34µs     5.0 MB/sec
linter/all-rules/pydantic/types.py         1.00      7.8±0.24ms     3.3 MB/sec    1.00      7.8±0.23ms     3.3 MB/sec
linter/default-rules/large/dataset.py      1.00      9.5±0.44ms     4.3 MB/sec    1.01      9.5±0.30ms     4.3 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00      2.1±0.09ms     8.1 MB/sec    1.02      2.1±0.10ms     7.9 MB/sec
linter/default-rules/numpy/globals.py      1.00    244.4±8.81µs    12.1 MB/sec    1.08   263.9±15.92µs    11.2 MB/sec
linter/default-rules/pydantic/types.py     1.00      4.3±0.14ms     6.0 MB/sec    1.06      4.5±0.33ms     5.7 MB/sec

@charliermarsh
Copy link
Member

Looking at the ecosystem checks, I'd forgotten that I think we shipped a strict version like this in the past and it caused a ton of problems (e.g. with Django migrations), we had to release a hotfix. Let me dig up the issues.

@JonathanPlasse JonathanPlasse changed the title Fix is_module_name() and is_identifier() Fix is_module_name() and improve perf of is_identifier() Mar 29, 2023
@JonathanPlasse
Copy link
Contributor Author

All the errors except one seem to be migrations. It could easily be ignored with per-file-ignores.
The remaining error is with a file named import.py in zulip. This is not a valid module name and cannot be imported by other modules.
For is_module_name(), the string must be valid ASCII as stated in PEP8.

@charliermarsh
Copy link
Member

I think I was mixing this up with the fact that we accidentally flagged modules like __main__.py and __version.py__.

@MichaReiser
Copy link
Member

MichaReiser commented Mar 29, 2023

Woah, nice performance improvement. I'm surprised that it improves by so much

@JonathanPlasse
Copy link
Contributor Author

Indeed, I was not expecting this.

@charliermarsh
Copy link
Member

My only hangup here is that I'm wondering if we should special-case migration files. If users are always going to end up ignoring them, it'd be nice for us to just "do the right thing" out of the box. At the same time, it's weird to allow what is actually an invalid module name. What do you think?

@JonathanPlasse
Copy link
Contributor Author

How could we avoid false negative if we ignore migration files?

@konstin
Copy link
Member

konstin commented Mar 30, 2023

Maybe we could start checking if the path contains a component called migrations and whether the filename starts with four digits? This should cover the django projects. alembic seems to use versions/[0-9a-f]{12}(_.*)?.py, but from a quick search i couldn't get the exact semantics

@charliermarsh
Copy link
Member

I'm temped to say we just ignore anything in a migrations or versions subdirectory.

@charliermarsh
Copy link
Member

How bout: if migrations or versions is in the path, allow it to start with a number.

- For `is_module_name()`
  - Must not be a reserved keyword
  - use is_ascii_lowercase() and is_ascii_digit()
- Improve perf of `is_indentifier()`
@JonathanPlasse
Copy link
Contributor Author

Done!

@charliermarsh
Copy link
Member

Thanks!

// and other frameworks.
if is_migration_file(path) && is_migration_name(&module_name) {
return None;
}
Copy link
Member

Choose a reason for hiding this comment

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

@JonathanPlasse - What do you think about this? It lets us keep the "project convention" logic out of ruff_python_stdlib (and keeps is_module_name simple since it doesn't rely on directory in any way)... but it does mean we have to check the name twice for valid migrations. However, the most common path is that a module has a valid name anyway, so it may not matter in practice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is great. Good separation of concerns.

.and_then(Path::file_name)
.and_then(OsStr::to_str)
.map_or(false, |parent| matches!(parent, "versions" | "migrations"))
}
Copy link
Member

Choose a reason for hiding this comment

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

(E.g., to me, this check is similar to the is_module_file check we already do here -- it feels more at-home in the rule than in the compliance utilities...)

@charliermarsh charliermarsh changed the title Fix is_module_name() and improve perf of is_identifier() Fix is_module_name() and improve perf of is_identifier() Mar 31, 2023
is_migration_name(&module_name)
} else {
is_module_name(&module_name)
};
Copy link
Member

Choose a reason for hiding this comment

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

@JonathanPlasse - Tweaked it to do the check once like you had before, just separate functions now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great!

@charliermarsh charliermarsh merged commit 968c7df into astral-sh:main Mar 31, 2023
@JonathanPlasse JonathanPlasse deleted the fix-is-module-name branch March 31, 2023 19:28
bruxisma referenced this pull request in ixm-one/pytest-cmake-presets Apr 5, 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://togithub.com/charliermarsh/ruff) | `^0.0.260` ->
`^0.0.261` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/compatibility-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/confidence-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.261`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.261)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.260...v0.0.261)

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

#### What's Changed

##### Rules

- \[`flake8-simplify`] Ignore `collapsible-if` violations for `if
False:` and `if True:` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3732](https://togithub.com/charliermarsh/ruff/pull/3732)
- \[`flake8-pie`] Extend `unncessary-generator-any-all` to set
comprehensions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3824](https://togithub.com/charliermarsh/ruff/pull/3824)
- \[`flake8-simplify`] Implement `dict-get-with-none-default` (`SIM910`)
by [@&#8203;kyoto7250](https://togithub.com/kyoto7250) in
[https://github.com/charliermarsh/ruff/pull/3874](https://togithub.com/charliermarsh/ruff/pull/3874)
- \[`flake8-annotations`] Additional simple magic return types by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3805](https://togithub.com/charliermarsh/ruff/pull/3805)
- \[`flake8-pyi`]: fix PYI015 false positive on assignment of TypeVar &
friends by [@&#8203;bluetech](https://togithub.com/bluetech) in
[https://github.com/charliermarsh/ruff/pull/3861](https://togithub.com/charliermarsh/ruff/pull/3861)

##### Bug Fixes

- Improve robustness of argument removal for `encode` calls by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3802](https://togithub.com/charliermarsh/ruff/pull/3802)
- Fix SIM222 and SIM223 false positive by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3832](https://togithub.com/charliermarsh/ruff/pull/3832)
- When checking module visibility, don't check entire ancestry by
[@&#8203;Hnasar](https://togithub.com/Hnasar) in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- Improve top-of-file insertions for required imports by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3779](https://togithub.com/charliermarsh/ruff/pull/3779)
- Use multi-fix semantics for `inplace` removal by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3804](https://togithub.com/charliermarsh/ruff/pull/3804)
- Flag non-`Name` expressions in `duplicate-isinstance-call` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3817](https://togithub.com/charliermarsh/ruff/pull/3817)
- Avoid `unnecessary-comprehension-any-all` for async generators by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3823](https://togithub.com/charliermarsh/ruff/pull/3823)
- Fix `is_module_name()` and improve perf of `is_identifier()` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3795](https://togithub.com/charliermarsh/ruff/pull/3795)
- Allow starred arguments in B030 by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3871](https://togithub.com/charliermarsh/ruff/pull/3871)
- Support mutually exclusive branches for `B031` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3844](https://togithub.com/charliermarsh/ruff/pull/3844)
- Consider logger candidate from `logging` module only by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3878](https://togithub.com/charliermarsh/ruff/pull/3878)

##### Core

- Add import insertion support to autofix capabilities by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3787](https://togithub.com/charliermarsh/ruff/pull/3787)
- Generate `ImportMap` from module path to imported dependencies by
[@&#8203;chanman3388](https://togithub.com/chanman3388) in
[https://github.com/charliermarsh/ruff/pull/3243](https://togithub.com/charliermarsh/ruff/pull/3243)

##### Docs

- Add documentation for `ruff-action` (GitHub Action!) by
[@&#8203;brucearctor](https://togithub.com/brucearctor) in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

#### New Contributors

- [@&#8203;AetherUnbound](https://togithub.com/AetherUnbound) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3806](https://togithub.com/charliermarsh/ruff/pull/3806)
- [@&#8203;Hnasar](https://togithub.com/Hnasar) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- [@&#8203;nvuillam](https://togithub.com/nvuillam) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3848](https://togithub.com/charliermarsh/ruff/pull/3848)
- [@&#8203;brucearctor](https://togithub.com/brucearctor) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

**Full Changelog**:
astral-sh/ruff@v0.0.260...v0.0.261

</details>

---

### Configuration

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

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, 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://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4zMi4yIiwidXBkYXRlZEluVmVyIjoiMzUuMzIuMiJ9-->

Signed-off-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot referenced this pull request in allenporter/pyrainbird Apr 7, 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://togithub.com/charliermarsh/ruff) | `==0.0.260` ->
`==0.0.261` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/compatibility-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/confidence-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.261`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.261)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.260...v0.0.261)

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

#### What's Changed

##### Rules

- \[`flake8-simplify`] Ignore `collapsible-if` violations for `if
False:` and `if True:` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3732](https://togithub.com/charliermarsh/ruff/pull/3732)
- \[`flake8-pie`] Extend `unncessary-generator-any-all` to set
comprehensions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3824](https://togithub.com/charliermarsh/ruff/pull/3824)
- \[`flake8-simplify`] Implement `dict-get-with-none-default` (`SIM910`)
by [@&#8203;kyoto7250](https://togithub.com/kyoto7250) in
[https://github.com/charliermarsh/ruff/pull/3874](https://togithub.com/charliermarsh/ruff/pull/3874)
- \[`flake8-annotations`] Additional simple magic return types by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3805](https://togithub.com/charliermarsh/ruff/pull/3805)
- \[`flake8-pyi`]: fix PYI015 false positive on assignment of TypeVar &
friends by [@&#8203;bluetech](https://togithub.com/bluetech) in
[https://github.com/charliermarsh/ruff/pull/3861](https://togithub.com/charliermarsh/ruff/pull/3861)

##### Bug Fixes

- Improve robustness of argument removal for `encode` calls by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3802](https://togithub.com/charliermarsh/ruff/pull/3802)
- Fix SIM222 and SIM223 false positive by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3832](https://togithub.com/charliermarsh/ruff/pull/3832)
- When checking module visibility, don't check entire ancestry by
[@&#8203;Hnasar](https://togithub.com/Hnasar) in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- Improve top-of-file insertions for required imports by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3779](https://togithub.com/charliermarsh/ruff/pull/3779)
- Use multi-fix semantics for `inplace` removal by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3804](https://togithub.com/charliermarsh/ruff/pull/3804)
- Flag non-`Name` expressions in `duplicate-isinstance-call` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3817](https://togithub.com/charliermarsh/ruff/pull/3817)
- Avoid `unnecessary-comprehension-any-all` for async generators by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3823](https://togithub.com/charliermarsh/ruff/pull/3823)
- Fix `is_module_name()` and improve perf of `is_identifier()` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3795](https://togithub.com/charliermarsh/ruff/pull/3795)
- Allow starred arguments in B030 by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3871](https://togithub.com/charliermarsh/ruff/pull/3871)
- Support mutually exclusive branches for `B031` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3844](https://togithub.com/charliermarsh/ruff/pull/3844)
- Consider logger candidate from `logging` module only by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3878](https://togithub.com/charliermarsh/ruff/pull/3878)

##### Core

- Add import insertion support to autofix capabilities by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3787](https://togithub.com/charliermarsh/ruff/pull/3787)
- Generate `ImportMap` from module path to imported dependencies by
[@&#8203;chanman3388](https://togithub.com/chanman3388) in
[https://github.com/charliermarsh/ruff/pull/3243](https://togithub.com/charliermarsh/ruff/pull/3243)

##### Docs

- Add documentation for `ruff-action` (GitHub Action!) by
[@&#8203;brucearctor](https://togithub.com/brucearctor) in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

#### New Contributors

- [@&#8203;AetherUnbound](https://togithub.com/AetherUnbound) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3806](https://togithub.com/charliermarsh/ruff/pull/3806)
- [@&#8203;Hnasar](https://togithub.com/Hnasar) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- [@&#8203;nvuillam](https://togithub.com/nvuillam) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3848](https://togithub.com/charliermarsh/ruff/pull/3848)
- [@&#8203;brucearctor](https://togithub.com/brucearctor) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

**Full Changelog**:
astral-sh/ruff@v0.0.260...v0.0.261

</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://app.renovatebot.com/dashboard#github/allenporter/pyrainbird).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4zNC4xIiwidXBkYXRlZEluVmVyIjoiMzUuMzQuMSJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot referenced this pull request in allenporter/flux-local Apr 7, 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://togithub.com/charliermarsh/ruff) | `==0.0.260` ->
`==0.0.261` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/compatibility-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/confidence-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.261`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.261)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.260...v0.0.261)

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

#### What's Changed

##### Rules

- \[`flake8-simplify`] Ignore `collapsible-if` violations for `if
False:` and `if True:` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3732](https://togithub.com/charliermarsh/ruff/pull/3732)
- \[`flake8-pie`] Extend `unncessary-generator-any-all` to set
comprehensions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3824](https://togithub.com/charliermarsh/ruff/pull/3824)
- \[`flake8-simplify`] Implement `dict-get-with-none-default` (`SIM910`)
by [@&#8203;kyoto7250](https://togithub.com/kyoto7250) in
[https://github.com/charliermarsh/ruff/pull/3874](https://togithub.com/charliermarsh/ruff/pull/3874)
- \[`flake8-annotations`] Additional simple magic return types by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3805](https://togithub.com/charliermarsh/ruff/pull/3805)
- \[`flake8-pyi`]: fix PYI015 false positive on assignment of TypeVar &
friends by [@&#8203;bluetech](https://togithub.com/bluetech) in
[https://github.com/charliermarsh/ruff/pull/3861](https://togithub.com/charliermarsh/ruff/pull/3861)

##### Bug Fixes

- Improve robustness of argument removal for `encode` calls by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3802](https://togithub.com/charliermarsh/ruff/pull/3802)
- Fix SIM222 and SIM223 false positive by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3832](https://togithub.com/charliermarsh/ruff/pull/3832)
- When checking module visibility, don't check entire ancestry by
[@&#8203;Hnasar](https://togithub.com/Hnasar) in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- Improve top-of-file insertions for required imports by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3779](https://togithub.com/charliermarsh/ruff/pull/3779)
- Use multi-fix semantics for `inplace` removal by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3804](https://togithub.com/charliermarsh/ruff/pull/3804)
- Flag non-`Name` expressions in `duplicate-isinstance-call` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3817](https://togithub.com/charliermarsh/ruff/pull/3817)
- Avoid `unnecessary-comprehension-any-all` for async generators by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3823](https://togithub.com/charliermarsh/ruff/pull/3823)
- Fix `is_module_name()` and improve perf of `is_identifier()` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3795](https://togithub.com/charliermarsh/ruff/pull/3795)
- Allow starred arguments in B030 by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3871](https://togithub.com/charliermarsh/ruff/pull/3871)
- Support mutually exclusive branches for `B031` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3844](https://togithub.com/charliermarsh/ruff/pull/3844)
- Consider logger candidate from `logging` module only by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3878](https://togithub.com/charliermarsh/ruff/pull/3878)

##### Core

- Add import insertion support to autofix capabilities by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3787](https://togithub.com/charliermarsh/ruff/pull/3787)
- Generate `ImportMap` from module path to imported dependencies by
[@&#8203;chanman3388](https://togithub.com/chanman3388) in
[https://github.com/charliermarsh/ruff/pull/3243](https://togithub.com/charliermarsh/ruff/pull/3243)

##### Docs

- Add documentation for `ruff-action` (GitHub Action!) by
[@&#8203;brucearctor](https://togithub.com/brucearctor) in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

#### New Contributors

- [@&#8203;AetherUnbound](https://togithub.com/AetherUnbound) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3806](https://togithub.com/charliermarsh/ruff/pull/3806)
- [@&#8203;Hnasar](https://togithub.com/Hnasar) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- [@&#8203;nvuillam](https://togithub.com/nvuillam) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3848](https://togithub.com/charliermarsh/ruff/pull/3848)
- [@&#8203;brucearctor](https://togithub.com/brucearctor) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

**Full Changelog**:
astral-sh/ruff@v0.0.260...v0.0.261

</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://app.renovatebot.com/dashboard#github/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4zNC4xIiwidXBkYXRlZEluVmVyIjoiMzUuMzQuMSJ9-->

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.

4 participants