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

Avoid re-using imports beyond current edit site #4378

Merged
merged 2 commits into from
May 11, 2023
Merged

Conversation

charliermarsh
Copy link
Member

Given code like:

def a():
    try:
        pass
    except OSError:
        pass


import contextlib

Our current edit actions will attempt to form an edit to (1) use contextlib.suppress instead of try, and (2) retain the import contextlib at the bottom of the file. This leads to an out-of-order edit.

One fix here would be to simply reorder the edits. That would often be valid, but it could lead to confusing bugs if the function is called between the definition site and the import site. Another would be to add an import to the top of the file instead of re-using. This would also often be valid, but runs the risk that the import is shadowed between the top-of-file and any call sites. We don't currently have access to that kind of tracing. So, for now, I've opted to just avoid applying a fix in these cases.

Closes #4374.

@charliermarsh charliermarsh added the bug Something isn't working label May 11, 2023
@charliermarsh
Copy link
Member Author

Quite torn on this. Maybe using the import is actually a better choice (and just sorting the edits).

@charliermarsh
Copy link
Member Author

Hmm, actually, in the reported case, re-using the import would have led to broken code.

@charliermarsh
Copy link
Member Author

I think the "right" fix is probably to add an import at top-of-file, if we can ensure that it's not shadowed later on.

@github-actions
Copy link
Contributor

github-actions bot commented May 11, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.06     14.7±0.09ms     2.8 MB/sec    1.00     13.8±0.13ms     2.9 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.03      3.5±0.03ms     4.8 MB/sec    1.00      3.4±0.03ms     4.9 MB/sec
linter/all-rules/numpy/globals.py          1.02    418.8±2.53µs     7.0 MB/sec    1.00    412.0±1.83µs     7.2 MB/sec
linter/all-rules/pydantic/types.py         1.04      6.1±0.07ms     4.2 MB/sec    1.00      5.8±0.07ms     4.4 MB/sec
linter/default-rules/large/dataset.py      1.14      7.7±0.02ms     5.3 MB/sec    1.00      6.7±0.03ms     6.1 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.10   1583.7±1.87µs    10.5 MB/sec    1.00   1441.7±6.07µs    11.5 MB/sec
linter/default-rules/numpy/globals.py      1.08    172.1±0.49µs    17.1 MB/sec    1.00    159.8±1.06µs    18.5 MB/sec
linter/default-rules/pydantic/types.py     1.11      3.4±0.01ms     7.6 MB/sec    1.00      3.0±0.01ms     8.4 MB/sec
parser/large/dataset.py                    1.01      5.4±0.03ms     7.5 MB/sec    1.00      5.3±0.00ms     7.6 MB/sec
parser/numpy/ctypeslib.py                  1.01   1045.6±0.73µs    15.9 MB/sec    1.00   1038.9±2.27µs    16.0 MB/sec
parser/numpy/globals.py                    1.01    106.1±0.19µs    27.8 MB/sec    1.00    105.1±0.22µs    28.1 MB/sec
parser/pydantic/types.py                   1.01      2.3±0.00ms    11.2 MB/sec    1.00      2.3±0.00ms    11.3 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.03     22.4±0.90ms  1862.6 KB/sec    1.00     21.7±0.85ms  1917.6 KB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      5.6±0.24ms     2.9 MB/sec    1.00      5.6±0.29ms     3.0 MB/sec
linter/all-rules/numpy/globals.py          1.08   717.1±88.39µs     4.1 MB/sec    1.00   663.0±84.64µs     4.5 MB/sec
linter/all-rules/pydantic/types.py         1.03      9.4±0.39ms     2.7 MB/sec    1.00      9.2±0.42ms     2.8 MB/sec
linter/default-rules/large/dataset.py      1.01     11.5±0.46ms     3.6 MB/sec    1.00     11.4±0.43ms     3.6 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00      2.4±0.15ms     7.0 MB/sec    1.00      2.4±0.11ms     7.0 MB/sec
linter/default-rules/numpy/globals.py      1.00   273.4±15.87µs    10.8 MB/sec    1.00   272.1±18.35µs    10.8 MB/sec
linter/default-rules/pydantic/types.py     1.00      5.1±0.28ms     5.0 MB/sec    1.00      5.1±0.23ms     5.0 MB/sec
parser/large/dataset.py                    1.01      9.0±0.34ms     4.5 MB/sec    1.00      8.9±0.36ms     4.5 MB/sec
parser/numpy/ctypeslib.py                  1.04  1761.0±84.21µs     9.5 MB/sec    1.00  1697.6±91.47µs     9.8 MB/sec
parser/numpy/globals.py                    1.00   178.1±10.22µs    16.6 MB/sec    1.00   178.2±14.75µs    16.6 MB/sec
parser/pydantic/types.py                   1.01      3.8±0.16ms     6.7 MB/sec    1.00      3.8±0.16ms     6.7 MB/sec

@charliermarsh charliermarsh merged commit 871b92a into main May 11, 2023
@charliermarsh charliermarsh deleted the charlie/import branch May 11, 2023 18:47
@charliermarsh charliermarsh changed the title Avoid re-using imports beyond current edit size Avoid re-using imports beyond current edit site May 11, 2023
renovate bot referenced this pull request in ixm-one/pytest-cmake-presets May 12, 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)
([changelog](https://togithub.com/charliermarsh/ruff/releases)) |
`^0.0.265` -> `^0.0.267` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.267/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.267/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.267/compatibility-slim/0.0.265)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.267/confidence-slim/0.0.265)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

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

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

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

#### Summary

Follow-up release to v0.0.266 to fix an issue with `python -m ruff`- and
`import ruff`-based workflows.

(No new rules or functionality.)

#### What's Changed

##### Rules

- Implement `RUF010` to detect explicit type conversions within
f-strings by [@&#8203;LotemAm](https://togithub.com/LotemAm) in
[https://github.com/charliermarsh/ruff/pull/4387](https://togithub.com/charliermarsh/ruff/pull/4387)

##### Other Changes

- Workaround for maturin bug by
[@&#8203;konstin](https://togithub.com/konstin) in
[https://github.com/charliermarsh/ruff/pull/4399](https://togithub.com/charliermarsh/ruff/pull/4399)

#### New Contributors

- [@&#8203;OMEGARAZER](https://togithub.com/OMEGARAZER) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3938](https://togithub.com/charliermarsh/ruff/pull/3938)
- [@&#8203;LotemAm](https://togithub.com/LotemAm) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4387](https://togithub.com/charliermarsh/ruff/pull/4387)

**Full Changelog**:
astral-sh/ruff@v0.0.266...v0.0.267

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

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

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

#### What's Changed

##### Breaking Changes

- Remove deprecated `update-check` setting by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4313](https://togithub.com/charliermarsh/ruff/pull/4313)
- JSON Emitter: Use one indexed column numbers for edits by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4007](https://togithub.com/charliermarsh/ruff/pull/4007)

##### Rules

- \[`pygrep-hooks`] Implement pygrep-hook's Mock-mistake diagnostic by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4366](https://togithub.com/charliermarsh/ruff/pull/4366)
- \[`pylint`] Implement `nested-min-max` (`W3301`) by
[@&#8203;mccullocht](https://togithub.com/mccullocht) in
[https://github.com/charliermarsh/ruff/pull/4200](https://togithub.com/charliermarsh/ruff/pull/4200)
- \[`flynt`] Implement Flynt static string join transform as FLY002 by
[@&#8203;akx](https://togithub.com/akx) in
[https://github.com/charliermarsh/ruff/pull/4196](https://togithub.com/charliermarsh/ruff/pull/4196)
- \[`pylint`] Include positional- and keyword-only arguments in
too-many-arguments by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4329](https://togithub.com/charliermarsh/ruff/pull/4329)
- \[`ruff`] Update confusable character mapping by
[@&#8203;akx](https://togithub.com/akx) in
[https://github.com/charliermarsh/ruff/pull/4274](https://togithub.com/charliermarsh/ruff/pull/4274)

##### Settings

- Add .git-rewrite folder to default ignored folder paths by
[@&#8203;jleclanche](https://togithub.com/jleclanche) in
[https://github.com/charliermarsh/ruff/pull/4261](https://togithub.com/charliermarsh/ruff/pull/4261)
- Feat: detect changes also in configuration files by
[@&#8203;mikeleppane](https://togithub.com/mikeleppane) in
[https://github.com/charliermarsh/ruff/pull/4169](https://togithub.com/charliermarsh/ruff/pull/4169)

##### Bug Fixes

- Revert the B027 autofix logic by
[@&#8203;aacunningham](https://togithub.com/aacunningham) in
[https://github.com/charliermarsh/ruff/pull/4310](https://togithub.com/charliermarsh/ruff/pull/4310)
- Consider Flask app logger as logger candidate by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4253](https://togithub.com/charliermarsh/ruff/pull/4253)
- Enforce max-doc-length for multi-line docstrings by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4347](https://togithub.com/charliermarsh/ruff/pull/4347)
- Avoid re-using imports beyond current edit site by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4378](https://togithub.com/charliermarsh/ruff/pull/4378)
- Respect insertion location when importing symbols by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4258](https://togithub.com/charliermarsh/ruff/pull/4258)
- Fix jemalloc page size on aarch64 by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4247](https://togithub.com/charliermarsh/ruff/pull/4247)
- Fix replace_whitespace() tabulation to space by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/4226](https://togithub.com/charliermarsh/ruff/pull/4226)
- Avoid fixing `PD002` in a lambda expression by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4286](https://togithub.com/charliermarsh/ruff/pull/4286)
- Avoid `D403` if first char cannot be uppercased by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4283](https://togithub.com/charliermarsh/ruff/pull/4283)
- Avoid panics for f-string rewrites at start-of-file by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4291](https://togithub.com/charliermarsh/ruff/pull/4291)
- Rewrite `not not a` as `bool(a)` in boolean contexts by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4294](https://togithub.com/charliermarsh/ruff/pull/4294)
- Include static and class methods in in abstract decorator list by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4298](https://togithub.com/charliermarsh/ruff/pull/4298)
- Specify exact command in incorrect parentheses suggestion by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4300](https://togithub.com/charliermarsh/ruff/pull/4300)
- Ignore `TRY301` exceptions without except handlers by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4301](https://togithub.com/charliermarsh/ruff/pull/4301)
- Preserve whitespace around `ListComp` brackets in `C419` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4099](https://togithub.com/charliermarsh/ruff/pull/4099)
- Tweak capitalization of B021 message by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4350](https://togithub.com/charliermarsh/ruff/pull/4350)
- Avoid debug panic with empty indent replacement by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4364](https://togithub.com/charliermarsh/ruff/pull/4364)
- Use target name in hardcoded-password diagnostics by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4365](https://togithub.com/charliermarsh/ruff/pull/4365)
- Avoid underflow in expected-special-method-signature by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4377](https://togithub.com/charliermarsh/ruff/pull/4377)
- Respect `__all__` imports when determining definition visibility by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4357](https://togithub.com/charliermarsh/ruff/pull/4357)
- Ignore some methods on list in `flake8-boolean-trap` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4385](https://togithub.com/charliermarsh/ruff/pull/4385)
- Fix false positives in PD002 by
[@&#8203;evanrittenhouse](https://togithub.com/evanrittenhouse) in
[https://github.com/charliermarsh/ruff/pull/4337](https://togithub.com/charliermarsh/ruff/pull/4337)
- Run autofix on initial watcher pass by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4311](https://togithub.com/charliermarsh/ruff/pull/4311)
- Avoid SIM105 autofixes that would remove comments by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4330](https://togithub.com/charliermarsh/ruff/pull/4330)
- Handle `.encode` calls on parenthesized expressions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4338](https://togithub.com/charliermarsh/ruff/pull/4338)
- Truncate `SyntaxError`s before newline character by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4124](https://togithub.com/charliermarsh/ruff/pull/4124)
- Use non-empty ranges for logical-lines diagnostics by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4133](https://togithub.com/charliermarsh/ruff/pull/4133)

#### New Contributors

- [@&#8203;jleclanche](https://togithub.com/jleclanche) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4261](https://togithub.com/charliermarsh/ruff/pull/4261)
- [@&#8203;aureliojargas](https://togithub.com/aureliojargas) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/4306](https://togithub.com/charliermarsh/ruff/pull/4306)
- [@&#8203;intgr](https://togithub.com/intgr) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4304](https://togithub.com/charliermarsh/ruff/pull/4304)
- [@&#8203;mikeleppane](https://togithub.com/mikeleppane) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/4169](https://togithub.com/charliermarsh/ruff/pull/4169)
- [@&#8203;dependabot](https://togithub.com/dependabot) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4354](https://togithub.com/charliermarsh/ruff/pull/4354)

**Full Changelog**:
astral-sh/ruff@v0.0.265...v0.0.266

</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:eyJjcmVhdGVkSW5WZXIiOiIzNS43OS4xIiwidXBkYXRlZEluVmVyIjoiMzUuNzkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

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/flux-local May 14, 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)
([changelog](https://togithub.com/charliermarsh/ruff/releases)) |
`==0.0.265` -> `==0.0.267` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.267/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.267/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.267/compatibility-slim/0.0.265)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.267/confidence-slim/0.0.265)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

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

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

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

#### Summary

Follow-up release to v0.0.266 to fix an issue with `python -m ruff`- and
`import ruff`-based workflows.

(No new rules or functionality.)

#### What's Changed

##### Rules

- Implement `RUF010` to detect explicit type conversions within
f-strings by [@&#8203;LotemAm](https://togithub.com/LotemAm) in
[https://github.com/charliermarsh/ruff/pull/4387](https://togithub.com/charliermarsh/ruff/pull/4387)

##### Other Changes

- Workaround for maturin bug by
[@&#8203;konstin](https://togithub.com/konstin) in
[https://github.com/charliermarsh/ruff/pull/4399](https://togithub.com/charliermarsh/ruff/pull/4399)

#### New Contributors

- [@&#8203;OMEGARAZER](https://togithub.com/OMEGARAZER) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3938](https://togithub.com/charliermarsh/ruff/pull/3938)
- [@&#8203;LotemAm](https://togithub.com/LotemAm) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4387](https://togithub.com/charliermarsh/ruff/pull/4387)

**Full Changelog**:
astral-sh/ruff@v0.0.266...v0.0.267

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

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

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

#### What's Changed

##### Breaking Changes

- Remove deprecated `update-check` setting by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4313](https://togithub.com/charliermarsh/ruff/pull/4313)
- JSON Emitter: Use one indexed column numbers for edits by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4007](https://togithub.com/charliermarsh/ruff/pull/4007)

##### Rules

- \[`pygrep-hooks`] Implement pygrep-hook's Mock-mistake diagnostic by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4366](https://togithub.com/charliermarsh/ruff/pull/4366)
- \[`pylint`] Implement `nested-min-max` (`W3301`) by
[@&#8203;mccullocht](https://togithub.com/mccullocht) in
[https://github.com/charliermarsh/ruff/pull/4200](https://togithub.com/charliermarsh/ruff/pull/4200)
- \[`flynt`] Implement Flynt static string join transform as FLY002 by
[@&#8203;akx](https://togithub.com/akx) in
[https://github.com/charliermarsh/ruff/pull/4196](https://togithub.com/charliermarsh/ruff/pull/4196)
- \[`pylint`] Include positional- and keyword-only arguments in
too-many-arguments by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4329](https://togithub.com/charliermarsh/ruff/pull/4329)
- \[`ruff`] Update confusable character mapping by
[@&#8203;akx](https://togithub.com/akx) in
[https://github.com/charliermarsh/ruff/pull/4274](https://togithub.com/charliermarsh/ruff/pull/4274)

##### Settings

- Add .git-rewrite folder to default ignored folder paths by
[@&#8203;jleclanche](https://togithub.com/jleclanche) in
[https://github.com/charliermarsh/ruff/pull/4261](https://togithub.com/charliermarsh/ruff/pull/4261)
- Feat: detect changes also in configuration files by
[@&#8203;mikeleppane](https://togithub.com/mikeleppane) in
[https://github.com/charliermarsh/ruff/pull/4169](https://togithub.com/charliermarsh/ruff/pull/4169)

##### Bug Fixes

- Revert the B027 autofix logic by
[@&#8203;aacunningham](https://togithub.com/aacunningham) in
[https://github.com/charliermarsh/ruff/pull/4310](https://togithub.com/charliermarsh/ruff/pull/4310)
- Consider Flask app logger as logger candidate by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4253](https://togithub.com/charliermarsh/ruff/pull/4253)
- Enforce max-doc-length for multi-line docstrings by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4347](https://togithub.com/charliermarsh/ruff/pull/4347)
- Avoid re-using imports beyond current edit site by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4378](https://togithub.com/charliermarsh/ruff/pull/4378)
- Respect insertion location when importing symbols by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4258](https://togithub.com/charliermarsh/ruff/pull/4258)
- Fix jemalloc page size on aarch64 by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4247](https://togithub.com/charliermarsh/ruff/pull/4247)
- Fix replace_whitespace() tabulation to space by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/4226](https://togithub.com/charliermarsh/ruff/pull/4226)
- Avoid fixing `PD002` in a lambda expression by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4286](https://togithub.com/charliermarsh/ruff/pull/4286)
- Avoid `D403` if first char cannot be uppercased by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4283](https://togithub.com/charliermarsh/ruff/pull/4283)
- Avoid panics for f-string rewrites at start-of-file by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4291](https://togithub.com/charliermarsh/ruff/pull/4291)
- Rewrite `not not a` as `bool(a)` in boolean contexts by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4294](https://togithub.com/charliermarsh/ruff/pull/4294)
- Include static and class methods in in abstract decorator list by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4298](https://togithub.com/charliermarsh/ruff/pull/4298)
- Specify exact command in incorrect parentheses suggestion by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4300](https://togithub.com/charliermarsh/ruff/pull/4300)
- Ignore `TRY301` exceptions without except handlers by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4301](https://togithub.com/charliermarsh/ruff/pull/4301)
- Preserve whitespace around `ListComp` brackets in `C419` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4099](https://togithub.com/charliermarsh/ruff/pull/4099)
- Tweak capitalization of B021 message by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4350](https://togithub.com/charliermarsh/ruff/pull/4350)
- Avoid debug panic with empty indent replacement by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4364](https://togithub.com/charliermarsh/ruff/pull/4364)
- Use target name in hardcoded-password diagnostics by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4365](https://togithub.com/charliermarsh/ruff/pull/4365)
- Avoid underflow in expected-special-method-signature by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4377](https://togithub.com/charliermarsh/ruff/pull/4377)
- Respect `__all__` imports when determining definition visibility by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4357](https://togithub.com/charliermarsh/ruff/pull/4357)
- Ignore some methods on list in `flake8-boolean-trap` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4385](https://togithub.com/charliermarsh/ruff/pull/4385)
- Fix false positives in PD002 by
[@&#8203;evanrittenhouse](https://togithub.com/evanrittenhouse) in
[https://github.com/charliermarsh/ruff/pull/4337](https://togithub.com/charliermarsh/ruff/pull/4337)
- Run autofix on initial watcher pass by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4311](https://togithub.com/charliermarsh/ruff/pull/4311)
- Avoid SIM105 autofixes that would remove comments by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4330](https://togithub.com/charliermarsh/ruff/pull/4330)
- Handle `.encode` calls on parenthesized expressions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4338](https://togithub.com/charliermarsh/ruff/pull/4338)
- Truncate `SyntaxError`s before newline character by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4124](https://togithub.com/charliermarsh/ruff/pull/4124)
- Use non-empty ranges for logical-lines diagnostics by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4133](https://togithub.com/charliermarsh/ruff/pull/4133)

#### New Contributors

- [@&#8203;jleclanche](https://togithub.com/jleclanche) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4261](https://togithub.com/charliermarsh/ruff/pull/4261)
- [@&#8203;aureliojargas](https://togithub.com/aureliojargas) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/4306](https://togithub.com/charliermarsh/ruff/pull/4306)
- [@&#8203;intgr](https://togithub.com/intgr) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4304](https://togithub.com/charliermarsh/ruff/pull/4304)
- [@&#8203;mikeleppane](https://togithub.com/mikeleppane) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/4169](https://togithub.com/charliermarsh/ruff/pull/4169)
- [@&#8203;dependabot](https://togithub.com/dependabot) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4354](https://togithub.com/charliermarsh/ruff/pull/4354)

**Full Changelog**:
astral-sh/ruff@v0.0.265...v0.0.266

</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:eyJjcmVhdGVkSW5WZXIiOiIzNS43OS4xIiwidXBkYXRlZEluVmVyIjoiMzUuNzkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

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

---

### Release Notes

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

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

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

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

#### Summary

Follow-up release to v0.0.266 to fix an issue with `python -m ruff`- and
`import ruff`-based workflows.

(No new rules or functionality.)

#### What's Changed

##### Rules

- Implement `RUF010` to detect explicit type conversions within
f-strings by [@&#8203;LotemAm](https://togithub.com/LotemAm) in
[https://github.com/charliermarsh/ruff/pull/4387](https://togithub.com/charliermarsh/ruff/pull/4387)

##### Other Changes

- Workaround for maturin bug by
[@&#8203;konstin](https://togithub.com/konstin) in
[https://github.com/charliermarsh/ruff/pull/4399](https://togithub.com/charliermarsh/ruff/pull/4399)

#### New Contributors

- [@&#8203;OMEGARAZER](https://togithub.com/OMEGARAZER) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3938](https://togithub.com/charliermarsh/ruff/pull/3938)
- [@&#8203;LotemAm](https://togithub.com/LotemAm) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4387](https://togithub.com/charliermarsh/ruff/pull/4387)

**Full Changelog**:
astral-sh/ruff@v0.0.266...v0.0.267

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

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

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

#### What's Changed

##### Breaking Changes

- Remove deprecated `update-check` setting by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4313](https://togithub.com/charliermarsh/ruff/pull/4313)
- JSON Emitter: Use one indexed column numbers for edits by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4007](https://togithub.com/charliermarsh/ruff/pull/4007)

##### Rules

- \[`pygrep-hooks`] Implement pygrep-hook's Mock-mistake diagnostic by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4366](https://togithub.com/charliermarsh/ruff/pull/4366)
- \[`pylint`] Implement `nested-min-max` (`W3301`) by
[@&#8203;mccullocht](https://togithub.com/mccullocht) in
[https://github.com/charliermarsh/ruff/pull/4200](https://togithub.com/charliermarsh/ruff/pull/4200)
- \[`flynt`] Implement Flynt static string join transform as FLY002 by
[@&#8203;akx](https://togithub.com/akx) in
[https://github.com/charliermarsh/ruff/pull/4196](https://togithub.com/charliermarsh/ruff/pull/4196)
- \[`pylint`] Include positional- and keyword-only arguments in
too-many-arguments by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4329](https://togithub.com/charliermarsh/ruff/pull/4329)
- \[`ruff`] Update confusable character mapping by
[@&#8203;akx](https://togithub.com/akx) in
[https://github.com/charliermarsh/ruff/pull/4274](https://togithub.com/charliermarsh/ruff/pull/4274)

##### Settings

- Add .git-rewrite folder to default ignored folder paths by
[@&#8203;jleclanche](https://togithub.com/jleclanche) in
[https://github.com/charliermarsh/ruff/pull/4261](https://togithub.com/charliermarsh/ruff/pull/4261)
- Feat: detect changes also in configuration files by
[@&#8203;mikeleppane](https://togithub.com/mikeleppane) in
[https://github.com/charliermarsh/ruff/pull/4169](https://togithub.com/charliermarsh/ruff/pull/4169)

##### Bug Fixes

- Revert the B027 autofix logic by
[@&#8203;aacunningham](https://togithub.com/aacunningham) in
[https://github.com/charliermarsh/ruff/pull/4310](https://togithub.com/charliermarsh/ruff/pull/4310)
- Consider Flask app logger as logger candidate by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4253](https://togithub.com/charliermarsh/ruff/pull/4253)
- Enforce max-doc-length for multi-line docstrings by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4347](https://togithub.com/charliermarsh/ruff/pull/4347)
- Avoid re-using imports beyond current edit site by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4378](https://togithub.com/charliermarsh/ruff/pull/4378)
- Respect insertion location when importing symbols by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4258](https://togithub.com/charliermarsh/ruff/pull/4258)
- Fix jemalloc page size on aarch64 by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4247](https://togithub.com/charliermarsh/ruff/pull/4247)
- Fix replace_whitespace() tabulation to space by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/4226](https://togithub.com/charliermarsh/ruff/pull/4226)
- Avoid fixing `PD002` in a lambda expression by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4286](https://togithub.com/charliermarsh/ruff/pull/4286)
- Avoid `D403` if first char cannot be uppercased by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4283](https://togithub.com/charliermarsh/ruff/pull/4283)
- Avoid panics for f-string rewrites at start-of-file by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4291](https://togithub.com/charliermarsh/ruff/pull/4291)
- Rewrite `not not a` as `bool(a)` in boolean contexts by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4294](https://togithub.com/charliermarsh/ruff/pull/4294)
- Include static and class methods in in abstract decorator list by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4298](https://togithub.com/charliermarsh/ruff/pull/4298)
- Specify exact command in incorrect parentheses suggestion by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4300](https://togithub.com/charliermarsh/ruff/pull/4300)
- Ignore `TRY301` exceptions without except handlers by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4301](https://togithub.com/charliermarsh/ruff/pull/4301)
- Preserve whitespace around `ListComp` brackets in `C419` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/4099](https://togithub.com/charliermarsh/ruff/pull/4099)
- Tweak capitalization of B021 message by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4350](https://togithub.com/charliermarsh/ruff/pull/4350)
- Avoid debug panic with empty indent replacement by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4364](https://togithub.com/charliermarsh/ruff/pull/4364)
- Use target name in hardcoded-password diagnostics by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4365](https://togithub.com/charliermarsh/ruff/pull/4365)
- Avoid underflow in expected-special-method-signature by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4377](https://togithub.com/charliermarsh/ruff/pull/4377)
- Respect `__all__` imports when determining definition visibility by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4357](https://togithub.com/charliermarsh/ruff/pull/4357)
- Ignore some methods on list in `flake8-boolean-trap` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4385](https://togithub.com/charliermarsh/ruff/pull/4385)
- Fix false positives in PD002 by
[@&#8203;evanrittenhouse](https://togithub.com/evanrittenhouse) in
[https://github.com/charliermarsh/ruff/pull/4337](https://togithub.com/charliermarsh/ruff/pull/4337)
- Run autofix on initial watcher pass by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4311](https://togithub.com/charliermarsh/ruff/pull/4311)
- Avoid SIM105 autofixes that would remove comments by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4330](https://togithub.com/charliermarsh/ruff/pull/4330)
- Handle `.encode` calls on parenthesized expressions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4338](https://togithub.com/charliermarsh/ruff/pull/4338)
- Truncate `SyntaxError`s before newline character by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4124](https://togithub.com/charliermarsh/ruff/pull/4124)
- Use non-empty ranges for logical-lines diagnostics by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4133](https://togithub.com/charliermarsh/ruff/pull/4133)

#### New Contributors

- [@&#8203;jleclanche](https://togithub.com/jleclanche) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4261](https://togithub.com/charliermarsh/ruff/pull/4261)
- [@&#8203;aureliojargas](https://togithub.com/aureliojargas) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/4306](https://togithub.com/charliermarsh/ruff/pull/4306)
- [@&#8203;intgr](https://togithub.com/intgr) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4304](https://togithub.com/charliermarsh/ruff/pull/4304)
- [@&#8203;mikeleppane](https://togithub.com/mikeleppane) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/4169](https://togithub.com/charliermarsh/ruff/pull/4169)
- [@&#8203;dependabot](https://togithub.com/dependabot) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4354](https://togithub.com/charliermarsh/ruff/pull/4354)

**Full Changelog**:
astral-sh/ruff@v0.0.265...v0.0.266

</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:eyJjcmVhdGVkSW5WZXIiOiIzNS43OS4xIiwidXBkYXRlZEluVmVyIjoiMzUuNzkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

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
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Linter panic] SIM105 with cpython\Lib\http\server.py
2 participants