Compare commits

...

200 Commits

Author SHA1 Message Date
David Peter
8e52fa2fab [ty] Explicit control over cycle entrypoint 2025-09-02 16:00:52 +02:00
David Peter
bbfcf6e111 [ty] __class_getitem__ is a classmethod (#20192)
## Summary

`__class_getitem__` is [implicitly a
classmethod](https://docs.python.org/3/reference/datamodel.html#object.__class_getitem__).

## Test Plan

Added regression test.
2025-09-01 11:22:19 +02:00
David Peter
5518c84ab3 [ty] Support __init_subclass__ (#20190)
## Summary

`__init_subclass__` is implicitly a classmethod.

closes https://github.com/astral-sh/ty/issues/1106

## Test Plan

Regression test
2025-09-01 10:16:28 +02:00
renovate[bot]
c71ce006c4 Update dependency ruff to v0.12.11 (#20184)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [ruff](https://docs.astral.sh/ruff)
([source](https://redirect.github.com/astral-sh/ruff),
[changelog](https://redirect.github.com/astral-sh/ruff/blob/main/CHANGELOG.md))
| `==0.12.10` -> `==0.12.11` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.12.11?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.12.10/0.12.11?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

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

###
[`v0.12.11`](https://redirect.github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#01211)

[Compare
Source](https://redirect.github.com/astral-sh/ruff/compare/0.12.10...0.12.11)

##### Preview features

- \[`airflow`] Extend `AIR311` and `AIR312` rules
([#&#8203;20082](https://redirect.github.com/astral-sh/ruff/pull/20082))
- \[`airflow`] Replace wrong path `airflow.io.storage` with
`airflow.io.store` (`AIR311`)
([#&#8203;20081](https://redirect.github.com/astral-sh/ruff/pull/20081))
- \[`flake8-async`] Implement
`blocking-http-call-httpx-in-async-function` (`ASYNC212`)
([#&#8203;20091](https://redirect.github.com/astral-sh/ruff/pull/20091))
- \[`flake8-logging-format`] Add auto-fix for f-string logging calls
(`G004`)
([#&#8203;19303](https://redirect.github.com/astral-sh/ruff/pull/19303))
- \[`flake8-use-pathlib`] Add autofix for `PTH211`
([#&#8203;20009](https://redirect.github.com/astral-sh/ruff/pull/20009))
- \[`flake8-use-pathlib`] Make `PTH100` fix unsafe because it can change
behavior
([#&#8203;20100](https://redirect.github.com/astral-sh/ruff/pull/20100))

##### Bug fixes

- \[`pyflakes`, `pylint`] Fix false positives caused by `__class__` cell
handling (`F841`, `PLE0117`)
([#&#8203;20048](https://redirect.github.com/astral-sh/ruff/pull/20048))
- \[`pyflakes`] Fix `allowed-unused-imports` matching for top-level
modules (`F401`)
([#&#8203;20115](https://redirect.github.com/astral-sh/ruff/pull/20115))
- \[`ruff`] Fix false positive for t-strings in `default-factory-kwarg`
(`RUF026`)
([#&#8203;20032](https://redirect.github.com/astral-sh/ruff/pull/20032))
- \[`ruff`] Preserve relative whitespace in multi-line expressions
(`RUF033`)
([#&#8203;19647](https://redirect.github.com/astral-sh/ruff/pull/19647))

##### Rule changes

- \[`ruff`] Handle empty t-strings in
`unnecessary-empty-iterable-within-deque-call` (`RUF037`)
([#&#8203;20045](https://redirect.github.com/astral-sh/ruff/pull/20045))

##### Documentation

- Fix incorrect `D413` links in docstrings convention FAQ
([#&#8203;20089](https://redirect.github.com/astral-sh/ruff/pull/20089))
- \[`flake8-use-pathlib`] Update links to the table showing the
correspondence between `os` and `pathlib`
([#&#8203;20103](https://redirect.github.com/astral-sh/ruff/pull/20103))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-01 08:51:28 +02:00
renovate[bot]
2f3bf03d82 Update rui314/setup-mold digest to 725a879 (#20181)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [rui314/setup-mold](https://redirect.github.com/rui314/setup-mold) |
action | digest | `7344740` -> `725a879` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-01 08:51:00 +02:00
renovate[bot]
24a6d247f1 Update CodSpeedHQ/action action to v3.8.1 (#20183)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [CodSpeedHQ/action](https://redirect.github.com/CodSpeedHQ/action) |
action | patch | `v3.8.0` -> `v3.8.1` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>CodSpeedHQ/action (CodSpeedHQ/action)</summary>

###
[`v3.8.1`](https://redirect.github.com/CodSpeedHQ/action/releases/tag/v3.8.1)

[Compare
Source](https://redirect.github.com/CodSpeedHQ/action/compare/v3.8.0...v3.8.1)

##### What's Changed

##### <!-- 1 -->🐛 Bug Fixes

- Don't show error when libpython is not found by
[@&#8203;not-matthias](https://redirect.github.com/not-matthias)

##### <!-- 2 -->🏗️ Refactor

- Improve conditional compilation in `get_pipe_open_options` by
[@&#8203;art049](https://redirect.github.com/art049) in
[#&#8203;100](https://redirect.github.com/CodSpeedHQ/runner/pull/100)

##### <!-- 7 -->⚙️ Internals

- Change log level to warn for venv\_compat error by
[@&#8203;not-matthias](https://redirect.github.com/not-matthias) in
[#&#8203;104](https://redirect.github.com/CodSpeedHQ/runner/pull/104)

**Full Changelog**:
<https://github.com/CodSpeedHQ/action/compare/v3.8.0...v3.8.1>
**Full Runner Changelog**:
<https://github.com/CodSpeedHQ/runner/blob/main/CHANGELOG.md>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-01 08:50:02 +02:00
renovate[bot]
88f7644551 Update cargo-bins/cargo-binstall action to v1.15.3 (#20182)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[cargo-bins/cargo-binstall](https://redirect.github.com/cargo-bins/cargo-binstall)
| action | patch | `v1.15.1` -> `v1.15.3` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>cargo-bins/cargo-binstall (cargo-bins/cargo-binstall)</summary>

###
[`v1.15.3`](https://redirect.github.com/cargo-bins/cargo-binstall/releases/tag/v1.15.3)

[Compare
Source](https://redirect.github.com/cargo-bins/cargo-binstall/compare/v1.15.2...v1.15.3)

*Binstall is a tool to fetch and install Rust-based executables as
binaries. It aims to be a drop-in replacement for `cargo install` in
most cases. Install it today with `cargo install cargo-binstall`, from
the binaries below, or if you already have it, upgrade with `cargo
binstall cargo-binstall`.*

##### In this release:

- Upgrade (de)compression libraries
([#&#8203;2289](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2289))
- Fix release pipeline: stop building for x86\_64h-apple-darwin since it
is broken and is a rarely used tier 3 target, plus GHA no longer offers
x86\_64 mac
([#&#8203;2292](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2292))

###
[`v1.15.2`](https://redirect.github.com/cargo-bins/cargo-binstall/releases/tag/v1.15.2)

[Compare
Source](https://redirect.github.com/cargo-bins/cargo-binstall/compare/v1.15.1...v1.15.2)

*Binstall is a tool to fetch and install Rust-based executables as
binaries. It aims to be a drop-in replacement for `cargo install` in
most cases. Install it today with `cargo install cargo-binstall`, from
the binaries below, or if you already have it, upgrade with `cargo
binstall cargo-binstall`.*

##### In this release:

- Fix updating telemetry config
([#&#8203;2279](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2279)
[#&#8203;2287](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2287))

##### Other changes:

- Upgrade dependencies
([#&#8203;2278](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2278)
[#&#8203;2286](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2286))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-01 08:49:31 +02:00
renovate[bot]
6be46033b9 Update Rust crate camino to v1.1.12 (#20185)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [camino](https://redirect.github.com/camino-rs/camino) |
workspace.dependencies | patch | `1.1.11` -> `1.1.12` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>camino-rs/camino (camino)</summary>

###
[`v1.1.12`](https://redirect.github.com/camino-rs/camino/blob/HEAD/CHANGELOG.md#1112---2025-08-26)

[Compare
Source](https://redirect.github.com/camino-rs/camino/compare/camino-1.1.11...camino-1.1.12)

##### Added

- `Utf8PathBuf::from_os_string` and `Utf8Path::from_os_str` conversions.
- `TryFrom<OsString> for Utf8PathBuf` and `TryFrom<&OsStr> for
&Utf8Path` conversions.

Thanks to [BenjaminBrienen](https://redirect.github.com/BenjaminBrienen)
for your first contribution!

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-01 08:48:52 +02:00
renovate[bot]
9e292f1522 Update Rust crate clap to v4.5.46 (#20186)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [clap](https://redirect.github.com/clap-rs/clap) |
workspace.dependencies | patch | `4.5.45` -> `4.5.46` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>clap-rs/clap (clap)</summary>

###
[`v4.5.46`](https://redirect.github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4546---2025-08-26)

[Compare
Source](https://redirect.github.com/clap-rs/clap/compare/v4.5.45...v4.5.46)

##### Features

- Expose `StyledStr::push_str`

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-01 08:48:35 +02:00
renovate[bot]
74b60212dc Update Rust crate mimalloc to v0.1.48 (#20187)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [mimalloc](https://redirect.github.com/purpleprotocol/mimalloc_rust) |
workspace.dependencies | patch | `0.1.47` -> `0.1.48` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>purpleprotocol/mimalloc_rust (mimalloc)</summary>

###
[`v0.1.48`](https://redirect.github.com/purpleprotocol/mimalloc_rust/releases/tag/v0.1.48):
Version 0.1.48

[Compare
Source](https://redirect.github.com/purpleprotocol/mimalloc_rust/compare/v0.1.47...v0.1.48)

##### Changes

- Mimalloc `v3` feature flag. (credits
[@&#8203;gschulze](https://redirect.github.com/gschulze)).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-01 08:48:22 +02:00
github-actions[bot]
bfe501b802 [ty] Sync vendored typeshed stubs (#20188)
Close and reopen this PR to trigger CI

---------

Co-authored-by: typeshedbot <>
2025-09-01 06:27:48 +01:00
Carl Meyer
6f2b874d6c [ty] improve cycle-detection coverage for apply_type_mapping (#20159)
## Summary

Thread visitors through the rest of `apply_type_mapping`: callable and
protocol types.

## Test Plan

Added mdtest that previously stack overflowed.
2025-08-29 16:20:07 -07:00
Carl Meyer
17dc2e4d80 [ty] don't assume that deferred type inference means deferred name resolution (#20160)
## Summary

We have the ability to defer type inference of some parts of
definitions, so as to allow us to create a type that may need to be
recursively referenced in those other parts of the definition.

We also have the ability to do type inference in a context where all
name resolution should be deferred (that is, names should be looked up
from all-reachable-definitions rather than from the location of use.)
This is used for all annotations in stubs, or if `from __future__ import
annotations` is active.

Previous to this PR, these two concepts were linked: deferred-inference
always implied deferred-name-resolution, though we also supported
deferred-name-resolution without deferred-inference, via
`DeferredExpressionState`.

For the upcoming `typing.TypeAlias` support, I will defer inference of
the entire RHS of the alias (so as to support cycles), but that doesn't
imply deferred name resolution; at runtime, the RHS of a name annotated
as `typing.TypeAlias` is executed eagerly.

So this PR fully de-couples the two concepts, instead explicitly setting
the `DeferredExpressionState` in those cases where we should defer name
resolution.

It also fixes a long-standing related bug, where we were deferring name
resolution of all names in class bases, if any of the class bases
contained a stringified annotation.

## Test Plan

Added test that failed before this PR.
2025-08-29 16:19:45 -07:00
Dylan
694e7ed52e Less confidently mark f-strings as empty when inferring truthiness (#20152)
When computing the boolean value of an f-string, we over-eagerly
interpreted some f-string interpolations as empty. In this PR we now
mark the truthiness of f-strings involving format specs, debug text, and
bytes literals as "unknown".

This will probably result in some false negatives, which may be further
refined (for example - there are probably many cases where
`is_not_empty_f_string` should be modified to return `true`), but for
now at least we should have fewer false positives.

Affected rules (may not be an exhaustive list):

- [unnecessary-empty-iterable-within-deque-call
(RUF037)](https://docs.astral.sh/ruff/rules/unnecessary-empty-iterable-within-deque-call/#unnecessary-empty-iterable-within-deque-call-ruf037)
- [falsy-dict-get-fallback
(RUF056)](https://docs.astral.sh/ruff/rules/falsy-dict-get-fallback/#falsy-dict-get-fallback-ruf056)
- [pytest-assert-always-false
(PT015)](https://docs.astral.sh/ruff/rules/pytest-assert-always-false/#pytest-assert-always-false-pt015)
- [expr-or-not-expr
(SIM221)](https://docs.astral.sh/ruff/rules/expr-or-not-expr/#expr-or-not-expr-sim221)
- [expr-or-true
(SIM222)](https://docs.astral.sh/ruff/rules/expr-or-true/#expr-or-true-sim222)
- [expr-and-false
(SIM223)](https://docs.astral.sh/ruff/rules/expr-and-false/#expr-and-false-sim223)

Closes #19935
2025-08-29 22:12:54 +00:00
Carl Meyer
fe953e5c5c [ty] skip a slow seed in fuzzer (#20161)
## Summary

Fuzzer seed 208 seems to be timing out all fuzzer runs on PRs today.
This has happened on multiple unrelated PRs, as well as on an initial
version of this PR that made a comment-only change in ty and didn't skip
any seeds, so the timeout appears to be consistent in CI, on ty main
branch, as of today, but it started happening due to some change in a
factor outside ty; not sure what.

I checked the code generated for seed 208 locally, and it takes about
30s to check on current ty main branch. This is slow for a fuzzer seed,
but shouldn't be slow enough to make it time out after 20min in CI (even
accounting for GH runners being slower than my laptop.)

I tried to bisect the slowness of checking that code locally, but I
didn't go back far enough to find the change that made it slow. In fact
it seems like it became significantly faster in the last few days (on an
older checkout I had to stop it after several minutes.) So whatever the
cause of the slowness, it's not a recent change in ty.

I don't want to rabbit-hole on this right now (fuzzer-discovered issues
are lower-priority than real-world-code issues), and need a working CI,
so skip this seed for now until we can investigate it.

## Test Plan

CI. This PR contains a no-op (comment) change in ty, so that the fuzz
test is triggered in CI and we can verify it now works (as well as
verify, on the previous commit, that the fuzzer job is timing out on
that seed, even with just a no-op change in ty.)
2025-08-29 13:59:16 -07:00
Alex Waygood
0bf5d2a204 Revert "[ty] Use invalid-assignment error code for invalid assignments to ClassVars" (#20158)
Reverts astral-sh/ruff#20156. As @sharkdp noted in his post-merge
review, there were several issues with that PR that I didn't spot before
merging — but I'm out for four days now, and would rather not leave
things in an inconsistent state for that long. I'll revisit this on
Wednesday.
2025-08-29 19:48:45 +01:00
Carl Meyer
8eb8d25565 [ty] add six ecosystem projects to good.txt (#20157)
## Summary

These projects all check successfully now.

(Pandas still takes 9s, as the comment in `bad.txt` said, but I don't
think this is slow enough to exclude it; mypy-primer overall still runs
in 4 minutes, faster than e.g. the test suite on Windows.)

## Test Plan

mypy-primer CI.
2025-08-29 11:37:29 -07:00
Alex Waygood
9b1b58a451 [ty] Use invalid-assignment error code for invalid assignments to ClassVars (#20156)
## Summary

This error is about assigning to attributes rather than reading
attributes, so I think `invalid-assignment` makes more sense than
`invalid-attribute-access`

## Test Plan

existing mdtests updated
2025-08-29 18:43:30 +01:00
Carl Meyer
fa7798ddd9 [ty] minor TypedDict fixes (#20146)
## Summary

In `is_disjoint_from_impl`, we should unpack type aliases before we
check `TypedDict`. This change probably doesn't have any visible effect
until we have a more discriminating implementation of disjointness for
`TypedDict`, but making the change now can avoid some confusion/bugs in
future.

In `type_ordering.rs`, we should order `TypedDict` near more similar
types, and leave Union/Intersection together at the end of the list.
This is not necessary for correctness, but it's more consistent and it
could have saved me some confusion trying to figure out why I was only
getting an unreachable panic when my code example included a `TypedDict`
type.

## Test Plan

None besides existing tests.
2025-08-29 09:46:48 -07:00
Carl Meyer
8223fea062 [ty] ensure union normalization really normalizes (#20147)
## Summary

Now that we have `Type::TypeAlias`, which can wrap a union, and the
possibility of unions including non-unpacked type aliases (which is
necessary to support recursive type aliases), we can no longer assume in
`UnionType::normalized_impl` that normalizing each element of an
existing union will result in a set of elements that we can order and
then place raw into `UnionType` to create a normalized union. It's now
possible for those elements to themselves include union types (unpacked
from an alias). So instead, we need to feed those elements into the full
`UnionBuilder` (with alias-unpacking turned on) to flatten/normalize
them, and then order them.

## Test Plan

Added mdtest.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-08-29 09:02:35 -07:00
Eric Jolibois
5a608f7366 [ty] typecheck dict methods for TypedDict (#19874)
## Summary

Typecheck `get()`, `setdefault()`, `pop()` for `TypedDict`

```py
from typing import TypedDict
from typing_extensions import NotRequired

class Employee(TypedDict):
    name: str
    department: NotRequired[str]

emp = Employee(name="Alice", department="Engineering")

emp.get("name")
emp.get("departmen", "Unknown")
emp.pop("department")
emp.pop("name")
```

<img width="838" height="529" alt="Screenshot 2025-08-12 at 11 42 12"
src="https://github.com/user-attachments/assets/77ce150a-223c-4931-b914-551095d8a3a6"
/>


part of https://github.com/astral-sh/ty/issues/154

## Test Plan

Updated Markdown tests

---------

Co-authored-by: David Peter <mail@david-peter.de>
2025-08-29 16:25:03 +02:00
Hans
c2d7c673ca [pyupgrade] Add fix safety section to docs (UP029) (#17490)
## Summary

Add `fix safety` section to `UP029: unnecessary_builtin_import.rs`, for
#15584
2025-08-29 13:55:19 +00:00
Brent Westbrook
8a6db4f257 Show fixes by default (#19919)
## Summary

This PR fixes #7352 by exposing the `show_fix_diff` option used in our
snapshot tests in the CLI. As the issue suggests, we plan to make this
the default output format in the future, so this is added to the `full`
output format in preview for now.

This turned out to be pretty straightforward. I just used our existing
`Applicability` settings to determine whether or not to print the diff.

The snapshot differences are because we now set
`Applicability::DisplayOnly` for our snapshot tests. This
`Applicability` is also used to determine whether or not the fix icon
(`[*]`) is rendered, so this is now shown for display-only fixes in our
snapshots. This was already the case previously, but we were only
setting `Applicability::Unsafe` in these tests and ignoring the
`Applicability` when rendering fix diffs. CLI users can't enable
display-only fixes, so this is only a test change for now, but this
should work smoothly if we decide to expose a `--display-only-fixes`
flag or similar in the future.

I also deleted the `PrinterFlags::SHOW_FIX_DIFF` flag. This was
completely unused before, and it seemed less confusing just to delete it
than to enable it in the right place and check it along with the
`OutputFormat` and `preview`.

## Test Plan

I only added one CLI test for now. I'm kind of assuming that we have
decent coverage of the cases where this shouldn't be firing, especially
the `output_format` CLI test, which shows that this definitely doesn't
affect non-preview `full` output. I'm happy to add more tests with
different combinations of options, if we're worried about any in
particular. I did try `--diff` and `--preview` and a few other
combinations manually.

And here's a screenshot using our trusty UP049 example from the design
discussion confirming that all the colors and other formatting still
look as expected:

<img width="786" height="629" alt="image"
src="https://github.com/user-attachments/assets/94e408bc-af7b-4573-b546-a5ceac2620f2"
/>

And one with an unsafe fix to see the footer:

<img width="782" height="367" alt="image"
src="https://github.com/user-attachments/assets/bbb29e47-310b-4293-b2c2-cc7aee3baff4"
/>


## Related issues and PR
- https://github.com/astral-sh/ruff/issues/7352
- https://github.com/astral-sh/ruff/pull/12595
- https://github.com/astral-sh/ruff/issues/12598
- https://github.com/astral-sh/ruff/issues/12599
- https://github.com/astral-sh/ruff/issues/12600

I think we could probably close all of these issues now. I think we've
either resolved or avoided most of them, and if we encounter them again
with the new output format, it would probably make sense to open new
ones anyway.
2025-08-29 09:53:05 -04:00
Hans
ffcdd4ea42 [refurb] Add fix safety section (FURB105) (#17499)
## Summary

This PR add the `fix safety` section for rule `FURB105` in
`print_empty_string.rs` for #15584

Before:
```
def get_sep():
    print("side effect")
    return ""
    
print("", sep=get_sep())
```

After:
```
def get_sep():
    print("side effect")
    return ""
    
print()
```

---------

Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
2025-08-29 09:41:06 -04:00
Dan Parizher
0ff0c70302 [fastapi] Fix false positive for paths with spaces around parameters (FAST003) (#20077)
## Summary

Fixes #20060
2025-08-29 13:40:25 +00:00
Alex Waygood
f77315776c [ty] Better error message for attempting to assign to a read-only property (#20150) 2025-08-29 13:22:23 +00:00
Alex Waygood
04dc223710 [ty] Improve disambiguation of types via fully qualified names (#20141) 2025-08-29 08:44:18 +00:00
Alex Waygood
0d7ed32494 [ty] Enforce that an attribute on a class X must be callable in order to satisfy a member on a protocol P (#20142)
## Summary

Small, incremental progress towards checking the types of method
members.

## Test Plan

Added an mdtest
2025-08-29 08:31:26 +01:00
Dhruv Manilawala
4ca38b2974 [ty] Unpack variadic argument type in specialization (#20130)
## Summary

This PR fixes various TODOs around overload call when a variadic
argument is used.

The reason this bug existed is because the specialization wouldn't
account for unpacking the type of the variadic argument.

This is fixed by expanding `MatchedArgument` to contain the type of that
argument _only_ when it is a variadic argument. The reason is that
there's a split for when the argument type is inferred -- the
non-variadic arguments are inferred using `infer_argument_types` _after_
parameter matching while the variadic argument type is inferred _during_
the parameter matching. And, the `MatchedArgument` is populated _during_
parameter matching which means the unpacking would need to happen during
parameter matching.

This split seems a bit inconsistent but I don't want to spend a lot of
time on trying to merge them such that all argument type inference
happens in a single place. I might look into it while adding support for
`**kwargs`.

## Test Plan

Update existing tests by resolving the todos.

The ecosystem changes looks correct to me except for the `slice` call
but it seems that it's unrelated to this PR as we infer `slice[Any, Any,
Any]` for a `slice(1, 2, 3)` call on `main` as well
([playground](https://play.ty.dev/9eacce00-c7d5-4dd5-a932-4265cb2bb4f6)).
2025-08-29 04:27:28 +00:00
Douglas Creager
a8039f80f0 [ty] Add constraint set implementation (#19997)
This PR adds an implementation of constraint sets.

An individual constraint restricts the specialization of a single
typevar to be within a particular lower and upper bound: the typevar can
only specialize to types that are a supertype of the lower bound, and a
subtype of the upper bound. (Note that lower and upper bounds are fully
static; we take the bottom and top materializations of the bounds to
remove any gradual forms if needed.) Either bound can be “closed” (where
the bound is a valid specialization), or “open” (where it is not).

You can then build up more complex constraint sets using union,
intersection, and negation operations. We use a disjunctive normal form
(DNF) representation, just like we do for types: a _constraint set_ is
the union of zero or more _clauses_, each of which is the intersection
of zero or more individual constraints. Note that the constraint set
that contains no clauses is never satisfiable (`⋃ {} = 0`); and the
constraint set that contains a single clause, which contains no
constraints, is always satisfiable (`⋃ {⋂ {}} = 1`).

One thing to note is that this PR does not change the logic of the
actual assignability checks, and in particular, we still aren't ever
trying to create an "individual constraint" that constrains a typevar.
Technically we're still operating only on `bool`s, since we only ever
instantiate `C::always_satisfiable` (i.e., `true`) and
`C::unsatisfiable` (i.e., `false`) in the `has_relation_to` methods. So
if you thought that #19838 introduced an unnecessarily complex stand-in
for `bool`, well here you go, this one is worse! (But still seemingly
not yielding a performance regression!) The next PR in this series,
#20093, is where we will actually create some non-trivial constraint
sets and use them in anger.

That said, the PR does go ahead and update the assignability checks to
use the new `ConstraintSet` type instead of `bool`. That part is fairly
straightforward since we had already updated the assignability checks to
use the `Constraints` trait; we just have to actively choose a different
impl type. (For the `is_whatever` variants, which still return a `bool`,
we have to convert the constraint set, but the explicit
`is_always_satisfiable` calls serve as nice documentation of our
intent.)

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Carl Meyer <carl@astral.sh>
2025-08-28 20:04:29 -04:00
Lior Weissman
5c2d4d8d8f [perflint] Handle tuples in dictionary comprehensions (PERF403) (#19934)
This pull request fixes the bug described in issue
[#19153](https://github.com/astral-sh/ruff/issues/19153).

The issue occurred when `PERF403` incorrectly flagged cases involving
tuple unpacking in a for loop. For example:

```python
def f():
    v = {}
    for (o, p), x in [("op", "x")]:
        v[x] = o, p
```

This code was wrongly suggested to be rewritten into a dictionary
comprehension, which changes the semantics.

Changes in this PR:

Updated the `PERF403` rule to correctly handle tuple unpacking in loop
targets.

Added regression tests to ensure this case (and similar ones) are no
longer flagged incorrectly.

Why:
This ensures that `PERF403` only triggers when a dictionary
comprehension is semantically equivalent to the original loop,
preventing false positives.

---------

Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
2025-08-28 21:37:40 +00:00
Dan Parizher
26082e8ec1 [ruff] Fix false negative for empty f-strings in deque calls (RUF037) (#20109)
## Summary

Fixes #20050
2025-08-28 16:58:39 -04:00
Kot
b6522cb534 [pylint] Add U+061C to PLE2502 (#20106)
Resolves #20058
2025-08-28 16:35:48 -04:00
Dan Parizher
637a2b1170 [pycodestyle] Preserve return type annotation for ParamSpec (E731) (#20108)
## Summary

Fixes #20097

Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
2025-08-28 20:31:45 +00:00
Jelle Zijlstra
3927b0c931 [ty] Simplify materialization of specialized generics (#20121)
This is a variant of #20076 that moves some complexity out of
`apply_type_mapping_impl` in `generics.rs`. The tradeoff is that now
every place that applies `TypeMapping::Specialization` must take care to
call `.materialize()` afterwards. (A previous version of this didn't
work because I had missed a spot where I had to call `.materialize()`.)

@carljm as asked in
https://github.com/astral-sh/ruff/pull/20076#discussion_r2305385298 .
2025-08-28 11:35:00 -07:00
Amethyst Reese
ca1f66a657 [flake8-async] Implement blocking-input rule (ASYNC250) (#20122)
## Summary

Adds new rule to catch use of builtins `input()` in async functions.

Issue #8451

## Test Plan

New snapshosts in `ASYNC250.py` with `cargo insta test`.
2025-08-28 11:04:24 -07:00
Matthew Mckee
166b63ad4d Fix mdtest ignore python code blocks (#20139)
## Summary

Resolves https://github.com/astral-sh/ty/issues/1103

## Test Plan

Edited `crates/ty_python_semantic/resources/mdtest/literal/boolean.md`
with:

```
# Boolean literals

```python
reveal_type(True)  # revealed: Literal[False]
reveal_type(False)  # revealed: Literal[False]
```

Ran `cargo test -p ty_python_semantic --test mdtest -- mdtest__literal_boolean`

And we get a test failure:

```
running 1 test
test mdtest__literal_boolean ... FAILED

failures:

---- mdtest__literal_boolean stdout ----

boolean.md - Boolean literals (c336e1af3d538acd)

crates/ty_python_semantic/resources/mdtest/literal/boolean.md:4
unmatched assertion: revealed: Literal[False]
crates/ty_python_semantic/resources/mdtest/literal/boolean.md:4
unexpected error: 13 [revealed-type] "Revealed type: `Literal[True]`"

To rerun this specific test, set the environment variable:
MDTEST_TEST_FILTER='boolean.md - Boolean literals (c336e1af3d538acd)'
MDTEST_TEST_FILTER='boolean.md - Boolean literals (c336e1af3d538acd)'
cargo test -p ty_python_semantic --test mdtest --
mdtest__literal_boolean

--------------------------------------------------


thread 'mdtest__literal_boolean' panicked at
crates/ty_test/src/lib.rs:138:5:
Some tests failed.
note: run with `RUST_BACKTRACE=1` environment variable to display a
backtrace


failures:
    mdtest__literal_boolean

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 263
filtered out; finished in 0.18s

error: test failed, to rerun pass `-p ty_python_semantic --test mdtest`
```

As expected.

And when i checkout main and keep the same mdtest file all tests pass (as the repro).
2025-08-28 09:59:03 -07:00
Carl Meyer
9363eeca26 [ty] add support for cyclic legacy generic protocols (#20125)
## Summary

Just add the necessary Salsa cycle handling.

## Test Plan

Added mdtest.
2025-08-28 16:58:01 +00:00
Carl Meyer
f4362b95d7 [ty] add cycle detection for find_legacy_typevars (#20124)
## Summary

Add cycle detection to the `find_legacy_typevars` type method.

## Test Plan

Added mdtest that stack overflowed without this.
2025-08-28 09:55:08 -07:00
Brent Westbrook
f703536977 Use new diff rendering format in tests (#20101)
## Summary

I spun this off from #19919 to separate the rendering code change and
snapshot updates from the (much smaller) changes to expose this in the
CLI. I grouped all of the `ruff_linter` snapshot changes in the final
commit in an effort to make this easier to review. The code changes are
in [this
range](619395eb41).

I went through all of the snapshots, albeit fairly quickly, and they all
looked correct to me. In the last few commits I was trying to resolve an
existing issue in the alignment of the line number separator:


73720c73be/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap (L87-L89)

In the snapshot above on `main`, you can see that a double-digit line
number at the end of the context lines for a snippet was causing a
misalignment with the other separators. That's now resolved. The one
downside is that this can lead to a mismatch with the diagnostic above:

```
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
 --> C409.py:4:6
  |
2 |   t2 = tuple([1, 2])
3 |   t3 = tuple((1, 2))
4 |   t4 = tuple([
  |  ______^
5 | |     1,
6 | |     2
7 | | ])
  | |__^
8 |   t5 = tuple(
9 |       (1, 2)
  |
help: Rewrite as a tuple literal
1  | t1 = tuple([])
2  | t2 = tuple([1, 2])
3  | t3 = tuple((1, 2))
   - t4 = tuple([
4  + t4 = (
5  |     1,
6  |     2
   - ])
7  + )
8  | t5 = tuple(
9  |     (1, 2)
10 | )
note: This is an unsafe fix and may remove comments or change runtime behavior
```

But I don't think we can avoid that without really reworking this
rendering to make the diagnostic and diff rendering aware of each other.
Anyway, this should only happen in relatively rare cases where the
diagnostic is near a digit boundary and also near a context boundary.
Most of our diagnostics line up nicely.

Another potential downside of the new rendering format is its handling
of long stretches of `+` or `-` lines:

```
help: Replace with `Literal[...] | None`
21 |     ...
22 |
23 |
   - def func6(arg1: Literal[
   -     "hello",
   -     None  # Comment 1
   -     , "world"
   -     ]):
24 + def func6(arg1: Literal["hello", "world"] | None):
25 |     ...
26 |
27 |
note: This is an unsafe fix and may remove comments or change runtime behavior
```

To me it just seems a little hard to tell what's going on with just a
long streak of `-`-prefixed lines. I saw an even more exaggerated
example at some point, but I think this is also fairly rare. Most of the
snapshots seem more like the examples we looked at on Discord with
plenty of `|` lines and pairs of `+` and `-` lines.

## Test Plan

Existing tests plus one new test in `ruff_db` to isolate a line
separator alignment issue
2025-08-28 10:56:58 -04:00
David Peter
1842cfe333 [ty] Fix 'too many cycle iterations' for unions of literals (#20137)
## Summary

Decrease the maximum number of literals in a union before we collapse to
the supertype. The better fix for this will be
https://github.com/astral-sh/ty/issues/957, but it is very tempting to
solve this for now by simply decreasing the limit by one, to get below
the salsa limit of 200.

closes https://github.com/astral-sh/ty/issues/660

## Test Plan

Added a regression test that would previously lead to a "too many cycle
iterations" panic.
2025-08-28 16:46:37 +02:00
David Peter
b3c4005289 [ty] No boundness analysis for implicit instance attributes (#20128)
## Summary

With this PR, we stop performing boundness analysis for implicit
instance attributes:

```py
class C:
    def __init__(self):
        if False:   
            self.x = 1

C().x  # would previously show an error, with this PR we pretend the attribute exists
```

This PR is potentially just a temporary measure until we find a better
fix. But I have already invested a lot of time trying to find the root
cause of https://github.com/astral-sh/ty/issues/758 (and [this
example](https://github.com/astral-sh/ty/issues/758#issuecomment-3206108262),
which I'm not entirely sure is related) and I still don't understand
what is going on. This PR fixes the performance problems in both of
these problems (in a rather crude way).

The impact of the proposed change on the ecosystem is small, and the
three new diagnostics are arguably true positives (previously hidden
because we considered the code unreachable, based on e.g. `assert`ions
that depended on implicit instance attributes). So this seems like a
reasonable fix for now.

Note that we still support cases like these:

```py
class D:
    if False:  # or any other expression that statically evaluates to `False`
        x: int = 1

D().x  # still an error


class E:
    if False:  # or any other expression that statically evaluates to `False`
        def f(self):
            self.x = 1

E().x  # still an error
```

closes https://github.com/astral-sh/ty/issues/758

## Test Plan

Updated tests, benchmark results
2025-08-28 16:25:07 +02:00
Brent Westbrook
c2bc15bc15 Bump 0.12.11 (#20136) 2025-08-28 09:45:01 -04:00
David Peter
e586f6dcc4 [ty] Benchmarks for problematic implicit instance attributes cases (#20133)
## Summary

Add regression benchmarks for the problematic cases in
https://github.com/astral-sh/ty/issues/758. I'd like to merge this
before https://github.com/astral-sh/ruff/pull/20128 to measure the
impact (local tests show that this will "solve" both cases).
2025-08-28 15:25:25 +02:00
Takayuki Maeda
76a6b7e3e2 [pyflakes] Fix allowed-unused-imports matching for top-level modules (F401) (#20115)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

Fixes #19664

Fix allowed unused imports matching for top-level modules.

I've simply replaced `from_dotted_name` with `user_defined`. Since
QualifiedName for imports is created in
crates/ruff_python_semantic/src/imports.rs, I guess it's acceptable to
use `user_defined` here. Please tell me if there is better way.


0c5089ed9e/crates/ruff_python_semantic/src/imports.rs (L62)

## Test Plan

<!-- How was it tested? -->

I've added a snapshot test
`f401_allowed_unused_imports_top_level_module`.
2025-08-28 13:02:50 +00:00
Brent Westbrook
1ce65714c0 Move GitLab output rendering to ruff_db (#20117)
## Summary

This PR is a first step toward adding a GitLab output format to ty. It
converts the `GitlabEmitter` from `ruff_linter` to a `GitlabRenderer` in
`ruff_db` and updates its implementation to handle non-Ruff files and
diagnostics without primary spans. I tried to break up the changes here
so that they're easy to review commit-by-commit, or at least in groups
of commits:
- [preparatory changes in-place in `ruff_linter` and a `ruff_db`
skeleton](0761b73a61)
- [moving the code over with no implementation changes mixed
in](0761b73a61..8f909ea0bb)
- [tidying up the code now in
`ruff_db`](9f047c4f9f..e5e217fcd6)

This wasn't strictly necessary, but I also added some `Serialize`
structs instead of calling `json!` to make it a little clearer that we
weren't modifying the schema (e4c4bee35d).

I plan to follow this up with a separate PR exposing this output format
in the ty CLI, which should be quite straightforward.

## Test Plan

Existing tests, especially the two that show up in the diff as renamed
nearly without changes
2025-08-28 08:56:33 -04:00
Shaygan Hooshyari
d9aaacd01f [ty] Evaluate reachability of non-definitely-bound to Ambiguous (#19579)
## Summary

closes https://github.com/astral-sh/ty/issues/692

If the expression (or any child expressions) is not definitely bound the
reachability constraint evaluation is determined as ambiguous.

This fixes the infinite cycles panic in the following code:

```py
from typing import Literal

class Toggle:
    def __init__(self: "Toggle"):
        if not self.x:
            self.x: Literal[True] = True
```

Credit of this solution is for David.

## Test Plan

- Added a test case with too many cycle iterations panic.
- Previous tests.

---------

Co-authored-by: David Peter <mail@david-peter.de>
2025-08-28 14:34:49 +02:00
Jelle Zijlstra
18eaa659c1 [ty] Introduce a representation for the top/bottom materialization of an invariant generic (#20076)
Part of #994. This adds a new field to the Specialization struct to
record when we're dealing with the top or bottom materialization of an
invariant generic. It also implements subtyping and assignability for
these objects.

Next planned steps after this is done are to implement other operations
on top/bottom materializations; probably attribute access is an
important one.

---------

Co-authored-by: Carl Meyer <carl@astral.sh>
2025-08-27 17:53:57 -07:00
Amethyst Reese
af259faed5 [flake8-async] Implement blocking-http-call-httpx (ASYNC212) (#20091)
## Summary

Adds new rule to find and report use of `httpx.Client` in synchronous
functions.

See issue #8451

## Test Plan

New snapshots for `ASYNC212.py` with `cargo insta test`.
2025-08-27 15:19:01 -07:00
Leandro Braga
d75ef3823c [ty] print diagnostics with fully qualified name to disambiguate some cases (#19850)
There are some situations that we have a confusing diagnostics due to
identical class names.

## Class with same name from different modules

```python
import pandas
import polars

df: pandas.DataFrame = polars.DataFrame()
```

This yields the following error:

**Actual:**
error: [invalid-assignment] "Object of type `DataFrame` is not
assignable to `DataFrame`"
**Expected**:
error: [invalid-assignment] "Object of type `polars.DataFrame` is not
assignable to `pandas.DataFrame`"

## Nested classes

```python
from enum import Enum

class A:
    class B(Enum):
        ACTIVE = "active"
        INACTIVE = "inactive"

class C:
    class B(Enum):
        ACTIVE = "active"
        INACTIVE = "inactive"
```

**Actual**:
error: [invalid-assignment] "Object of type `Literal[B.ACTIVE]` is not
assignable to `B`"
**Expected**:
error: [invalid-assignment] "Object of type
`Literal[my_module.C.B.ACTIVE]` is not assignable to `my_module.A.B`"

## Solution

In this MR we added an heuristics to detect when to use a fully
qualified name:
- There is an invalid assignment and;
- They are two different classes and;
- They have the same name

The fully qualified name always includes:
- module name
- nested classes name
- actual class name

There was no `QualifiedDisplay` so I had to implement it from scratch.
I'm very new to the codebase, so I might have done things inefficiently,
so I appreciate feedback.

Should we pre-compute the fully qualified name or do it on demand? 

## Not implemented

### Function-local classes

Should we approach this in a different PR?

**Example**:
```python 
# t.py
from __future__ import annotations


def function() -> A:
    class A:
        pass

    return A()


class A:
    pass


a: A = function()
```

#### mypy

```console
t.py:8: error: Incompatible return value type (got "t.A@5", expected "t.A")  [return-value]
```

From my testing the 5 in `A@5` comes from the like number. 

#### ty

```console
error[invalid-return-type]: Return type does not match returned value
 --> t.py:4:19
  |
4 | def function() -> A:
  |                   - Expected `A` because of return type
5 |     class A:
6 |         pass
7 |
8 |     return A()
  |            ^^^ expected `A`, found `A`
  |
info: rule `invalid-return-type` is enabled by default
```

Fixes https://github.com/astral-sh/ty/issues/848

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Carl Meyer <carl@astral.sh>
2025-08-27 20:46:07 +00:00
Dan Parizher
89ca493fd9 [ruff] Preserve relative whitespace in multi-line expressions (RUF033) (#19647)
## Summary

Fixes #19581

I decided to add in a `indent_first_line` function into
[`textwrap.rs`](https://github.com/astral-sh/ruff/blob/main/crates/ruff_python_trivia/src/textwrap.rs),
as it solely focuses on text manipulation utilities. It follows the same
design as `indent()`, and there may be situations in the future where it
can be reused as well.

---------

Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
2025-08-27 19:15:44 +00:00
David Peter
4b80f5fa4f [ty] Optimize TDD atom ordering (#20098)
## Summary

While looking at some logging output that I added to
`ReachabilityConstraintBuilder::add_and_constraint` in order to debug
https://github.com/astral-sh/ty/issues/1091, I noticed that it seemed to
suggest that the TDD was built in an imbalanced way for code like the
following, where we have a sequence of non-nested `if` conditions:

```py
def f(t1, t2, t3, t4, …):
    x = 0
    if t1:
        x = 1
    if t2:
        x = 2
    if t3:
        x = 3
    if t4:
        x = 4
    …
```

To understand this a bit better, I added some code to the
`ReachabilityConstraintBuilder` to render the resulting TDD. On `main`,
we get a tree that looks like the following, where you can see a pattern
of N sub-trees that grow linearly with N (number of `if` statements).
This results in an overall tree structure that has N² nodes (see graph
below):

<img alt="normal order"
src="https://github.com/user-attachments/assets/aab40ce9-e82a-4fcd-823a-811f05f15f66"
/>

If we zoom in to one of these subgraphs, we can see what the problem is.
When we add new constraints that represent combinations like `t1 AND ~t2
AND ~t3 AND t4 AND …`, they start with the evaluation of "early"
conditions (`t1`, `t2`, …). This means that we have to create new
subgraphs for each new `if` condition because there is little sharing
with the previous structure. We evaluate the Boolean condition in a
right-associative way: `t1 AND (~t2 AND (~t3 AND t4)))`:

<img width="500" align="center"
src="https://github.com/user-attachments/assets/31ea7182-9e00-4975-83df-d980464f545d"
/>

If we change the ordering of TDD atoms, we can change that to a
left-associative evaluation: `(((t1 AND ~t2) AND ~t3) AND t4) …`. This
means that we can re-use previous subgraphs `(t1 AND ~t2)`, which
results in a much more compact graph structure overall (note how "late"
conditions are now at the top, and "early" conditions are further down
in the graph):

<img alt="reverse order"
src="https://github.com/user-attachments/assets/96a6b7c1-3d35-4192-a917-0b2d24c6b144"
/>

If we count the number of TDD nodes for a growing number if `if`
statements, we can see that this change results in a slower growth. It's
worth noting that the growth is still superlinear, though:

<img width="800" height="600" alt="plot"
src="https://github.com/user-attachments/assets/22e8394f-e74e-4a9e-9687-0d41f94f2303"
/>

On the actual code from the referenced ticket (the `t_main.py` file
reduced to its main function, with the main function limited to 2000
lines instead of 11000 to allow the version on `main` to run to
completion), the effect is much more dramatic. Instead of 26 million TDD
nodes (`main`), we now only create 250 thousand (this branch), which is
slightly less than 1%.

The change in this PR allows us to build the semantic index and
type-check the problematic `t_main.py` file in
https://github.com/astral-sh/ty/issues/1091 in 9 seconds. This is still
not great, but an obvious improvement compared to running out of memory
after *minutes* of execution.

An open question remains whether this change is beneficial for all kinds
of code patterns, or just this linear sequence of `if` statements. It
does not seem unreasonable to think that referring to "earlier"
conditions is generally a good idea, but I learned from Doug that it's
generally not possible to find a TDD-construction heuristic that is
non-pathological for all kinds of inputs. Fortunately, it seems like
this change here results in performance improvements across *all of our
benchmarks*, which should increase the confidence in this change:

| Benchmark           | Improvement |
|---------------------|-------------------------|
| hydra-zen           | +13%                    |
| DateType            | +5%                     |
| sympy (walltime)    | +4%                     |
| attrs               | +4%                     |
| pydantic (walltime) | +2%                     |
| pandas (walltime)   | +2%                     |
| altair (walltime)   | +2%                     |
| static-frame        | +2%                     |
| anyio               | +1%                     |
| freqtrade           | +1%                     |
| colour-science      | +1%                     |
| tanjun              | +1%                     |

closes https://github.com/astral-sh/ty/issues/1091

---------

Co-authored-by: Douglas Creager <dcreager@dcreager.net>
2025-08-27 20:42:09 +02:00
Wei Lee
5663426d73 [airflow] Extend AIR311 and AIR312 rules (#20082)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

Extend the following rules.

### AIR311
* `airflow.sensors.base.BaseSensorOperator` →
airflow.sdk.bases.sensor.BaseSensorOperator`
* `airflow.sensors.base.PokeReturnValue` →
airflow.sdk.bases.sensor.PokeReturnValue`
* `airflow.sensors.base.poke_mode_only` →
airflow.sdk.bases.sensor.poke_mode_only`
* `airflow.decorators.base.DecoratedOperator` →
airflow.sdk.bases.decorator.DecoratedOperator`
* `airflow.models.param.Param` → airflow.sdk.definitions.param.Param`
* `airflow.decorators.base.DecoratedMappedOperator` →
`airflow.sdk.bases.decorator.DecoratedMappedOperator`
* `airflow.decorators.base.DecoratedOperator` →
`airflow.sdk.bases.decorator.DecoratedOperator`
* `airflow.decorators.base.TaskDecorator` →
`airflow.sdk.bases.decorator.TaskDecorator`
* `airflow.decorators.base.get_unique_task_id` →
`airflow.sdk.bases.decorator.get_unique_task_id`
* `airflow.decorators.base.task_decorator_factory` →
`airflow.sdk.bases.decorator.task_decorator_factory`


### AIR312
* `airflow.sensors.bash.BashSensor` →
`airflow.providers.standard.sensor.bash.BashSensor`
* `airflow.sensors.python.PythonSensor` →
`airflow.providers.standard.sensors.python.PythonSensor`



## Test Plan

<!-- How was it tested? -->

update the test fixture accordingly in the second commit and reorg in
the third
2025-08-27 14:11:22 -04:00
David Peter
0b3548755c [ty] Preserve qualifiers when accessing attributes on unions/intersections (#20114)
## Summary

Properly preserve type qualifiers when accessing attributes on unions
and intersections. This is a prerequisite for
https://github.com/astral-sh/ruff/pull/19579.

Also fix a completely wrong implementation of
`map_with_boundness_and_qualifiers`. It now closely follows
`map_with_boundness` (just above).

## Test Plan

I thought about it, but didn't find any easy way to test this. This only
affected `Type::member`. Things like validation of attribute writes
(where type qualifiers like `ClassVar` and `Final` are important) were
already handling things correctly.
2025-08-27 20:01:45 +02:00
Alex Waygood
ce1dc21e7e [ty] Fix the inferred interface of specialized generic protocols (#19866) 2025-08-27 18:16:15 +01:00
Alex Waygood
7d0c8e045c [ty] Infer slightly more precise types for comprehensions (#20111) 2025-08-27 13:21:47 +01:00
Alex Waygood
d71518b369 [ty] Add more tests for protocols (#20095)
Co-authored-by: Shunsuke Shibayama <sbym1346@gmail.com>
2025-08-27 12:56:14 +01:00
Carl Meyer
9ab276b345 [ty] don't eagerly unpack aliases in user-authored unions (#20055)
## Summary

Add a subtly different test case for recursive PEP 695 type aliases,
which does require that we relax our union simplification, so we don't
eagerly unpack aliases from user-provided union annotations.

## Test Plan

Added mdtest.
2025-08-26 16:29:45 -07:00
chiri
a60fb3f2c8 [flake8-use-pathlib] Update links to the table showing the correspondence between os and pathlib (#20103)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary

Part of https://github.com/astral-sh/ruff/pull/20100 |
https://github.com/astral-sh/ruff/pull/20100#issuecomment-3225349156
2025-08-26 17:33:33 -04:00
chiri
f558bf721c [flake8-use-pathlib] Make PTH100 fix unsafe because it can change behavior (#20100)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary
Fixes https://github.com/astral-sh/ruff/issues/20088
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

`cargo nextest run flake8_use_pathlib`

---------

Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
2025-08-26 18:59:12 +00:00
chiri
ea1c080881 [flake8-use-pathlib] Delete unused Rule::OsSymlink enabled check (#20099)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary
Part of #20009 (i forgot to delete it in this PR)
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

<!-- How was it tested? -->
2025-08-26 12:05:52 -04:00
Renkai Ge
73720c73be [ty] Add search paths info to unresolved import diagnostics (#20040)
Fixes https://github.com/astral-sh/ty/issues/457

---------

Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2025-08-26 11:01:16 -04:00
Hamir Mahal
136abace92 [flake8-logging-format] Add auto-fix for f-string logging calls (G004) (#19303)
Closes #19302

<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary
This adds an auto-fix for `Logging statement uses f-string` Ruff G004,
so users don't have to resolve it manually.
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan
I ran the auto-fixes on a Python file locally and and it worked as
expected.
<!-- How was it tested? -->

---------

Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
2025-08-26 10:51:24 -04:00
Brent Westbrook
bc7274d148 Add a ScopeKind for the __class__ cell (#20048)
Summary
--

This PR aims to resolve (or help to resolve) #18442 and #19357 by
encoding the CPython semantics around the `__class__` cell in our
semantic model. Namely,

> `__class__` is an implicit closure reference created by the compiler
if any methods in a class body refer to either `__class__` or super.

from the Python
[docs](https://docs.python.org/3/reference/datamodel.html#creating-the-class-object).

As noted in the variant docs by @AlexWaygood, we don't fully model this
behavior, opting always to create the `__class__` cell binding in a new
`ScopeKind::DunderClassCell` around each method definition, without
checking if any method in the class body actually refers to `__class__`
or `super`.

As such, this PR fixes #18442 but not #19357.

Test Plan
--

Existing tests, plus the tests from #19783, which now pass without any
rule-specific code.

Note that we opted not to alter the behavior of F841 here because
flagging `__class__` in these cases still seems helpful. See the
discussion in
https://github.com/astral-sh/ruff/pull/20048#discussion_r2296252395 and
in the test comments for more information.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Mikko Leppänen <mleppan23@gmail.com>
2025-08-26 09:49:08 -04:00
Avasam
911d5cc973 Fix incorrect D413 links in docstrings convention FAQ (#20089)
## Summary

D413 in this section was incorrectly linking to D410.

I haven't checked if this issue happens anywhere else in the docs.

## Test Plan

Look at docs
2025-08-26 10:24:58 +05:30
Matthew Mckee
8d6dc7d3a3 [ty] Refactor inlay hints structure to use separate parts (#20052)
## Summary

Our internal inlay hints structure (`ty_ide::InlayHint`) now more
closely resembles `lsp_types::InlayHint`.

This mainly allows us to convert to `lsp_types::InlayHint` with less
hassle, but it also allows us to manage the different parts of the inlay
hint better, which in the future will allow us to implement features
like goto on the type part of the type inlay hint.

It also really isn't important to store a specific `Type` instance in
the `InlayHintContent`. So we remove this and use `InlayHintLabel`
instead which just shows the representation of the type (along with
other information).

We see a similar structure used in rust-analyzer too.
2025-08-26 10:21:31 +05:30
Dylan
ef4897f9f3 [ty] Add support for PEP 750 t-strings (#20085)
This PR attempts to adds support for inferring`string.templatelib.Template` for t-string literals.
2025-08-25 18:49:49 +00:00
Alex Waygood
ecf3c4ca11 [ty] Add support for PEP 800 (#20084) 2025-08-25 19:39:05 +01:00
Carl Meyer
33c5f6f4f8 [ty] don't mark entire type-alias scopes as Deferred (#20086)
## Summary

This has been here for awhile (since our initial PEP 695 type alias
support) but isn't really correct. The right-hand-side of a PEP 695 type
alias is a distinct scope, and we don't mark it as an "eager" nested
scope, so it automatically gets "deferred" resolution of names from
outer scopes (just like a nested function). Thus it's
redundant/unnecessary for us to use `DeferredExpressionState::Deferred`
for resolving that RHS expression -- that's for deferring resolution of
individual names within a scope. Using it here causes us to wrongly
ignore applicable outer-scope narrowing.

## Test Plan

Added mdtest that failed before this PR (the second snippet -- the first
snippet always passed.)
2025-08-25 11:32:18 -07:00
github-actions[bot]
ba47010150 [ty] Sync vendored typeshed stubs (#20083)
Co-authored-by: typeshedbot <>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2025-08-25 17:01:51 +00:00
Wei Lee
db423ee978 [airflow] replace wrong path airflow.io.stroage as airflow.io.store (AIR311) (#20081)
## Summary

`airflow.io.storage` is not the correct path. it should be
`airflow.io.store` instead
2025-08-25 10:15:34 -05:00
Alex Waygood
a04823cfad [ty] Completely ignore typeshed's stub for Any (#20079) 2025-08-25 15:27:55 +01:00
Brent Westbrook
d0bcf56bd9 Improve diff rendering for notebooks (#20036)
## Summary

As noted in a code TODO, our `Diff` rendering code previously didn't
have any
special handling for notebooks. This was particularly obvious when the
diffs
were rendered right next to the corresponding diagnostic because the
diagnostic
used cell-based line numbers, while the diff was still using line
numbers from
the concatenated source. This PR updates the diff rendering to handle
notebooks
too.

The main improvements shown in the example below are:

- Line numbers are now remapped to be relative to their cell
- Context lines from other cells are suppressed

```
error[unused-import][*]: `math` imported but unused                             
 --> notebook.ipynb:cell 2:2:8                                                  
  |                                                                             
1 | # cell 2                                                                    
2 | import math                                                                 
  |        ^^^^                                                                 
3 |                                                                             
4 | print('hello world')                                                        
  |                                                                             
help: Remove unused import: `math`                                              
                                                                                
ℹ Safe fix                                                                      
1 1 | # cell 2                                                                  
2   |-import math                                                               
3 2 |                                                                           
4 3 | print('hello world')                                                      
```

I tried a few different approaches here before finally just splitting
the notebook into separate text ranges by cell and diffing each one
separately. It seems to work and passes all of our tests, but I don't
know if it's actually enforced anywhere that a single edit doesn't span
cells. Such an edit would silently be dropped right now since it would
fail the `contains_range` check. I also feel like I may have overlooked
an existing way to partition a file into cells like this.

## Test Plan

Existing notebook tests, plus a new one in `ruff_db`
2025-08-25 09:20:42 -04:00
Eric Jolibois
f9bbee33f6 [ty] validate constructor call of TypedDict (#19810)
## Summary
Implement validation for `TypedDict` constructor calls and dictionary
literal assignments, including support for `total=False` and proper
field management.
Also add support for `Required` and `NotRequired` type qualifiers in
`TypedDict` classes, along with proper inheritance behavior and the
`total=` parameter.
Support both constructor calls and dict literal syntax

part of https://github.com/astral-sh/ty/issues/154

### Basic Required Field Validation
```py
class Person(TypedDict):
    name: str
    age: int | None

# Error: Missing required field 'name' in TypedDict `Person` constructor
incomplete = Person(age=25)

# Error: Invalid argument to key "name" with declared type `str` on TypedDict `Person`
wrong_type = Person(name=123, age=25)

# Error: Invalid key access on TypedDict `Person`: Unknown key "extra"
extra_field = Person(name="Bob", age=25, extra=True)
```
<img width="773" height="191" alt="Screenshot 2025-08-07 at 17 59 22"
src="https://github.com/user-attachments/assets/79076d98-e85f-4495-93d6-a731aa72a5c9"
/>

### Support for `total=False`
```py
class OptionalPerson(TypedDict, total=False):
    name: str
    age: int | None

# All valid - all fields are optional with total=False
charlie = OptionalPerson()
david = OptionalPerson(name="David")
emily = OptionalPerson(age=30)
frank = OptionalPerson(name="Frank", age=25)

# But type validation and extra fields still apply
invalid_type = OptionalPerson(name=123)  # Error: Invalid argument type
invalid_extra = OptionalPerson(extra=True)  # Error: Invalid key access
```

### Dictionary Literal Validation
```py
# Type checking works for both constructors and dict literals
person: Person = {"name": "Alice", "age": 30}

reveal_type(person["name"])  # revealed: str
reveal_type(person["age"])   # revealed: int | None

# Error: Invalid key access on TypedDict `Person`: Unknown key "non_existing"
reveal_type(person["non_existing"])  # revealed: Unknown
```

### `Required`, `NotRequired`, `total`
```python
from typing import TypedDict
from typing_extensions import Required, NotRequired

class PartialUser(TypedDict, total=False):
    name: Required[str]      # Required despite total=False
    age: int                 # Optional due to total=False
    email: NotRequired[str]  # Explicitly optional (redundant)

class User(TypedDict):
    name: Required[str]      # Explicitly required (redundant)
    age: int                 # Required due to total=True
    bio: NotRequired[str]    # Optional despite total=True

# Valid constructions
partial = PartialUser(name="Alice")  # name required, age optional
full = User(name="Bob", age=25)      # name and age required, bio optional

# Inheritance maintains original field requirements
class Employee(PartialUser):
    department: str                  # Required (new field)
    # name: still Required (inherited)
    # age: still optional (inherited)

emp = Employee(name="Charlie", department="Engineering")  # 
Employee(department="Engineering")  # 
e: Employee = {"age": 1}  # 
```

<img width="898" height="683" alt="Screenshot 2025-08-11 at 22 02 57"
src="https://github.com/user-attachments/assets/4c1b18cd-cb2e-493a-a948-51589d121738"
/>

## Implementation
The implementation reuses existing validation logic done in
https://github.com/astral-sh/ruff/pull/19782

### ℹ️ Why I did NOT synthesize an `__init__` for `TypedDict`:

`TypedDict` inherits `dict.__init__(self, *args, **kwargs)` that accepts
all arguments.
The type resolution system finds this inherited signature **before**
looking for synthesized members.
So `own_synthesized_member()` is never called because a signature
already exists.

To force synthesis, you'd have to override Python’s inheritance
mechanism, which would break compatibility with the existing ecosystem.

This is why I went with ad-hoc validation. IMO it's the only viable
approach that respects Python’s
inheritance semantics while providing the required validation.

### Refacto of `Field`

**Before:**
```rust
struct Field<'db> {
    declared_ty: Type<'db>,
    default_ty: Option<Type<'db>>,     // NamedTuple and dataclass only
    init_only: bool,                   // dataclass only  
    init: bool,                        // dataclass only
    is_required: Option<bool>,         // TypedDict only
}
```

**After:**
```rust
struct Field<'db> {
    declared_ty: Type<'db>,
    kind: FieldKind<'db>,
}

enum FieldKind<'db> {
    NamedTuple { default_ty: Option<Type<'db>> },
    Dataclass { default_ty: Option<Type<'db>>, init_only: bool, init: bool },
    TypedDict { is_required: bool },
}
```

## Test Plan
Updated Markdown tests

---------

Co-authored-by: David Peter <mail@david-peter.de>
2025-08-25 14:45:52 +02:00
Dhruv Manilawala
376e3ff395 [ty] Limit argument expansion size for overload call evaluation (#20041)
## Summary

This PR limits the argument type expansion size for an overload call
evaluation to 512.

The limit chosen is arbitrary but I've taken the 256 limit from Pyright
into account and bumped it x2 to start with.

Initially, I actually started out by trying to refactor the entire
argument type expansion to be lazy. Currently, expanding a single
argument at any position eagerly creates the combination (argument
lists) and returns that (`Vec<CallArguments>`) but I thought we could
make it lazier by converting the return type of `expand` from
`Iterator<Item = Vec<CallArguments>>` to `Iterator<Item = Iterator<Item
= CallArguments>>` but that's proving to be difficult to implement
mainly because we **need** to maintain the previous expansion to
generate the next expansion which is the main reason to use
`std::iter::successors` in the first place.

Another approach would be to eagerly expand all the argument types and
then use the `combinations` from `itertools` to generate the
combinations but we would need to find the "boundary" between arguments
lists produced from expanding argument at position 1 and position 2
because that's important for the algorithm.

Closes: https://github.com/astral-sh/ty/issues/868

## Test Plan

Add test case to demonstrate the limit along with the diagnostic
snapshot stating that the limit has been reached.
2025-08-25 09:43:04 +00:00
renovate[bot]
b57cc5be33 Update actions/checkout digest to ff7abcd (#20061)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| actions/checkout | action | digest | `08c6903` -> `ff7abcd` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2025-08-25 11:04:07 +05:30
renovate[bot]
3c1fe12259 Update Rust crate regex-automata to v0.4.10 (#20068)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[regex-automata](https://redirect.github.com/rust-lang/regex/tree/master/regex-automata)
([source](https://redirect.github.com/rust-lang/regex)) |
workspace.dependencies | patch | `0.4.9` -> `0.4.10` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>rust-lang/regex (regex-automata)</summary>

###
[`v0.4.10`](https://redirect.github.com/rust-lang/regex/compare/regex-automata-0.4.9...regex-automata-0.4.10)

[Compare
Source](https://redirect.github.com/rust-lang/regex/compare/regex-automata-0.4.9...regex-automata-0.4.10)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-25 10:44:59 +05:30
renovate[bot]
e4289deb5a Update Rust crate regex to v1.11.2 (#20067)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [regex](https://redirect.github.com/rust-lang/regex) |
workspace.dependencies | patch | `1.11.1` -> `1.11.2` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>rust-lang/regex (regex)</summary>

###
[`v1.11.2`](https://redirect.github.com/rust-lang/regex/blob/HEAD/CHANGELOG.md#1112-2025-08-24)

[Compare
Source](https://redirect.github.com/rust-lang/regex/compare/1.11.1...1.11.2)

\===================
This is a new patch release of `regex` with some minor fixes. A larger
number
of typo or lint fix patches were merged. Also, we now finally recommend
using
`std::sync::LazyLock`.

Improvements:

- [BUG
#&#8203;1217](https://redirect.github.com/rust-lang/regex/issues/1217):
  Switch recommendation from `once_cell` to `std::sync::LazyLock`.
- [BUG
#&#8203;1225](https://redirect.github.com/rust-lang/regex/issues/1225):
  Add `DFA::set_prefilter` to `regex-automata`.

Bug fixes:

- [BUG
#&#8203;1165](https://redirect.github.com/rust-lang/regex/pull/1150):
Remove `std` dependency from `perf-literal-multisubstring` crate
feature.
- [BUG
#&#8203;1165](https://redirect.github.com/rust-lang/regex/pull/1165):
  Clarify the meaning of `(?R)$` in the documentation.
- [BUG
#&#8203;1281](https://redirect.github.com/rust-lang/regex/pull/1281):
Remove `fuzz/` and `record/` directories from published crate on
crates.io.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-25 10:44:47 +05:30
renovate[bot]
dbbcb7f452 Update cargo-bins/cargo-binstall action to v1.15.1 (#20075)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[cargo-bins/cargo-binstall](https://redirect.github.com/cargo-bins/cargo-binstall)
| action | minor | `v1.14.4` -> `v1.15.1` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>cargo-bins/cargo-binstall (cargo-bins/cargo-binstall)</summary>

###
[`v1.15.1`](https://redirect.github.com/cargo-bins/cargo-binstall/releases/tag/v1.15.1)

[Compare
Source](https://redirect.github.com/cargo-bins/cargo-binstall/compare/v1.15.0...v1.15.1)

*Binstall is a tool to fetch and install Rust-based executables as
binaries. It aims to be a drop-in replacement for `cargo install` in
most cases. Install it today with `cargo install cargo-binstall`, from
the binaries below, or if you already have it, upgrade with `cargo
binstall cargo-binstall`.*

##### In this release:

- fix failure to create settings manifest file
([#&#8203;2268](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2268)
[#&#8203;2271](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2271))
- fix race condition in creating, loading and writing of settings
manifest file
([#&#8203;2272](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2272))
- fix infinite hang on `--self-install` due to the quickinstall consent
([#&#8203;2269](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2269)
[#&#8203;2273](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2273))

###
[`v1.15.0`](https://redirect.github.com/cargo-bins/cargo-binstall/releases/tag/v1.15.0)

[Compare
Source](https://redirect.github.com/cargo-bins/cargo-binstall/compare/v1.14.4...v1.15.0)

*Binstall is a tool to fetch and install Rust-based executables as
binaries. It aims to be a drop-in replacement for `cargo install` in
most cases. Install it today with `cargo install cargo-binstall`, from
the binaries below, or if you already have it, upgrade with `cargo
binstall cargo-binstall`.*

##### In this release:

- confirm on the first time using quickinstall
([#&#8203;2223](https://redirect.github.com/cargo-bins/cargo-binstall/issues/2223))

##### Other changes:

- upgrade dependencies

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-25 10:43:27 +05:30
renovate[bot]
c6dfdb1d39 Update Rust crate url to v2.5.7 (#20073)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [url](https://redirect.github.com/servo/rust-url) |
workspace.dependencies | patch | `2.5.4` -> `2.5.7` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>servo/rust-url (url)</summary>

###
[`v2.5.5`](https://redirect.github.com/servo/rust-url/releases/tag/v2.5.5)

[Compare
Source](https://redirect.github.com/servo/rust-url/compare/v2.5.4...v2.5.5)

##### What's Changed

- ci: downgrade crates when building for Rust 1.67.0 by
[@&#8203;mxinden](https://redirect.github.com/mxinden) in
[https://github.com/servo/rust-url/pull/1003](https://redirect.github.com/servo/rust-url/pull/1003)
- ci: run unit tests with sanitizers by
[@&#8203;mxinden](https://redirect.github.com/mxinden) in
[https://github.com/servo/rust-url/pull/1002](https://redirect.github.com/servo/rust-url/pull/1002)
- fix small typo by [@&#8203;hkBst](https://redirect.github.com/hkBst)
in
[https://github.com/servo/rust-url/pull/1011](https://redirect.github.com/servo/rust-url/pull/1011)
- chore: fix clippy errors on main by
[@&#8203;dsherret](https://redirect.github.com/dsherret) in
[https://github.com/servo/rust-url/pull/1019](https://redirect.github.com/servo/rust-url/pull/1019)
- perf: remove heap allocation in parse\_query by
[@&#8203;dsherret](https://redirect.github.com/dsherret) in
[https://github.com/servo/rust-url/pull/1020](https://redirect.github.com/servo/rust-url/pull/1020)
- perf: slightly improve parsing a port by
[@&#8203;dsherret](https://redirect.github.com/dsherret) in
[https://github.com/servo/rust-url/pull/1022](https://redirect.github.com/servo/rust-url/pull/1022)
- perf: improve to\_file\_path() by
[@&#8203;dsherret](https://redirect.github.com/dsherret) in
[https://github.com/servo/rust-url/pull/1018](https://redirect.github.com/servo/rust-url/pull/1018)
- perf: make parse\_scheme slightly faster by
[@&#8203;dsherret](https://redirect.github.com/dsherret) in
[https://github.com/servo/rust-url/pull/1025](https://redirect.github.com/servo/rust-url/pull/1025)
- update LICENSE-MIT by
[@&#8203;wmjae](https://redirect.github.com/wmjae) in
[https://github.com/servo/rust-url/pull/1029](https://redirect.github.com/servo/rust-url/pull/1029)
- perf: url encode path segments in longer string slices by
[@&#8203;dsherret](https://redirect.github.com/dsherret) in
[https://github.com/servo/rust-url/pull/1026](https://redirect.github.com/servo/rust-url/pull/1026)
- Disable the default features on serde by
[@&#8203;rilipco](https://redirect.github.com/rilipco) in
[https://github.com/servo/rust-url/pull/1033](https://redirect.github.com/servo/rust-url/pull/1033)
- docs: base url relative join by
[@&#8203;tisonkun](https://redirect.github.com/tisonkun) in
[https://github.com/servo/rust-url/pull/1013](https://redirect.github.com/servo/rust-url/pull/1013)
- perf: remove heap allocation in parse\_host by
[@&#8203;dsherret](https://redirect.github.com/dsherret) in
[https://github.com/servo/rust-url/pull/1021](https://redirect.github.com/servo/rust-url/pull/1021)
- Update tests to Unicode 16.0 by
[@&#8203;hsivonen](https://redirect.github.com/hsivonen) in
[https://github.com/servo/rust-url/pull/1045](https://redirect.github.com/servo/rust-url/pull/1045)
- Add some some basic functions to `Mime` by
[@&#8203;mrobinson](https://redirect.github.com/mrobinson) in
[https://github.com/servo/rust-url/pull/1047](https://redirect.github.com/servo/rust-url/pull/1047)
- ran `cargo clippy --fix -- -Wclippy::use_self` by
[@&#8203;mrobinson](https://redirect.github.com/mrobinson) in
[https://github.com/servo/rust-url/pull/1048](https://redirect.github.com/servo/rust-url/pull/1048)
- Fix MSRV and clippy CI by
[@&#8203;Manishearth](https://redirect.github.com/Manishearth) in
[https://github.com/servo/rust-url/pull/1058](https://redirect.github.com/servo/rust-url/pull/1058)
- Update `Url::domain` docs to show that it includes subdomain by
[@&#8203;supercoolspy](https://redirect.github.com/supercoolspy) in
[https://github.com/servo/rust-url/pull/1057](https://redirect.github.com/servo/rust-url/pull/1057)
- set\_hostname should error when encountering colon ':' by
[@&#8203;edgul](https://redirect.github.com/edgul) in
[https://github.com/servo/rust-url/pull/1060](https://redirect.github.com/servo/rust-url/pull/1060)
- version bump to 2.5.5 by
[@&#8203;edgul](https://redirect.github.com/edgul) in
[https://github.com/servo/rust-url/pull/1061](https://redirect.github.com/servo/rust-url/pull/1061)

##### New Contributors

- [@&#8203;mxinden](https://redirect.github.com/mxinden) made their
first contribution in
[https://github.com/servo/rust-url/pull/1003](https://redirect.github.com/servo/rust-url/pull/1003)
- [@&#8203;hkBst](https://redirect.github.com/hkBst) made their first
contribution in
[https://github.com/servo/rust-url/pull/1011](https://redirect.github.com/servo/rust-url/pull/1011)
- [@&#8203;wmjae](https://redirect.github.com/wmjae) made their first
contribution in
[https://github.com/servo/rust-url/pull/1029](https://redirect.github.com/servo/rust-url/pull/1029)
- [@&#8203;rilipco](https://redirect.github.com/rilipco) made their
first contribution in
[https://github.com/servo/rust-url/pull/1033](https://redirect.github.com/servo/rust-url/pull/1033)
- [@&#8203;tisonkun](https://redirect.github.com/tisonkun) made their
first contribution in
[https://github.com/servo/rust-url/pull/1013](https://redirect.github.com/servo/rust-url/pull/1013)
- [@&#8203;supercoolspy](https://redirect.github.com/supercoolspy) made
their first contribution in
[https://github.com/servo/rust-url/pull/1057](https://redirect.github.com/servo/rust-url/pull/1057)

**Full Changelog**:
https://github.com/servo/rust-url/compare/v2.5.4...v2.5.5

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-25 10:42:38 +05:30
renovate[bot]
c65029f9a5 Update Rust crate syn to v2.0.106 (#20070)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [syn](https://redirect.github.com/dtolnay/syn) |
workspace.dependencies | patch | `2.0.104` -> `2.0.106` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>dtolnay/syn (syn)</summary>

###
[`v2.0.106`](https://redirect.github.com/dtolnay/syn/releases/tag/2.0.106)

[Compare
Source](https://redirect.github.com/dtolnay/syn/compare/2.0.105...2.0.106)

- Replace `~const` syntax with `[const]` conditionally const syntax in
trait bounds
([#&#8203;1896](https://redirect.github.com/dtolnay/syn/issues/1896),
[rust-lang/rust#139858](https://redirect.github.com/rust-lang/rust/pull/139858))
- Support conditionally const impl Trait types
([#&#8203;1897](https://redirect.github.com/dtolnay/syn/issues/1897))
- Reject polarity modifier and lifetime binder used in the same trait
bound
([#&#8203;1899](https://redirect.github.com/dtolnay/syn/issues/1899),
[rust-lang/rust#127054](https://redirect.github.com/rust-lang/rust/pull/127054))
- Parse const trait bounds with bound lifetimes
([#&#8203;1902](https://redirect.github.com/dtolnay/syn/issues/1902))
- Parse bound lifetimes with lifetime bounds
([#&#8203;1903](https://redirect.github.com/dtolnay/syn/issues/1903))
- Allow type parameters and const parameters in trait bounds and generic
closures
([#&#8203;1904](https://redirect.github.com/dtolnay/syn/issues/1904),
[#&#8203;1907](https://redirect.github.com/dtolnay/syn/issues/1907),
[#&#8203;1908](https://redirect.github.com/dtolnay/syn/issues/1908),
[#&#8203;1909](https://redirect.github.com/dtolnay/syn/issues/1909))

###
[`v2.0.105`](https://redirect.github.com/dtolnay/syn/releases/tag/2.0.105)

[Compare
Source](https://redirect.github.com/dtolnay/syn/compare/2.0.104...2.0.105)

- Disallow "negative" inherent impls like `impl !T {}`
([#&#8203;1881](https://redirect.github.com/dtolnay/syn/issues/1881),
[rust-lang/rust#144386](https://redirect.github.com/rust-lang/rust/pull/144386))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-25 10:41:48 +05:30
renovate[bot]
a0bba718f6 Update Rust crate tracing-indicatif to v0.3.13 (#20072)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[tracing-indicatif](https://redirect.github.com/emersonford/tracing-indicatif)
| workspace.dependencies | patch | `0.3.12` -> `0.3.13` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>emersonford/tracing-indicatif (tracing-indicatif)</summary>

###
[`v0.3.13`](https://redirect.github.com/emersonford/tracing-indicatif/blob/HEAD/CHANGELOG.md#0313---2025-08-15)

[Compare
Source](https://redirect.github.com/emersonford/tracing-indicatif/compare/0.3.12...0.3.13)

- eliminate panics on internal lock poison

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-25 10:41:33 +05:30
renovate[bot]
1eab4dbd95 Update Rust crate thiserror to v2.0.16 (#20071)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [thiserror](https://redirect.github.com/dtolnay/thiserror) |
workspace.dependencies | patch | `2.0.12` -> `2.0.16` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>dtolnay/thiserror (thiserror)</summary>

###
[`v2.0.16`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.16)

[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.15...2.0.16)

- Add to "no-std" crates.io category
([#&#8203;429](https://redirect.github.com/dtolnay/thiserror/issues/429))

###
[`v2.0.15`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.15)

[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.14...2.0.15)

- Prevent `Error::provide` API becoming unavailable from a future new
compiler lint
([#&#8203;427](https://redirect.github.com/dtolnay/thiserror/issues/427))

###
[`v2.0.14`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.14)

[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.13...2.0.14)

- Allow build-script cleanup failure with NFSv3 output directory to be
non-fatal
([#&#8203;426](https://redirect.github.com/dtolnay/thiserror/issues/426))

###
[`v2.0.13`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.13)

[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.12...2.0.13)

- Documentation improvements

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-25 10:41:18 +05:30
renovate[bot]
3eb3c3572b Update astral-sh/setup-uv action to v6.6.0 (#20074)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [astral-sh/setup-uv](https://redirect.github.com/astral-sh/setup-uv) |
action | minor | `v6.4.3` -> `v6.6.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>astral-sh/setup-uv (astral-sh/setup-uv)</summary>

###
[`v6.6.0`](https://redirect.github.com/astral-sh/setup-uv/releases/tag/v6.6.0):
🌈 Support for .tools-versions

[Compare
Source](https://redirect.github.com/astral-sh/setup-uv/compare/v6.5.0...v6.6.0)

##### Changes

This release adds support for [asdf](https://asdf-vm.com/)
`.tool-versions` in the `version-file` input

##### 🐛 Bug fixes

- Add log message before long API calls to GitHub
[@&#8203;eifinger](https://redirect.github.com/eifinger)
([#&#8203;530](https://redirect.github.com/astral-sh/setup-uv/issues/530))

##### 🚀 Enhancements

- Add support for .tools-versions
[@&#8203;eifinger](https://redirect.github.com/eifinger)
([#&#8203;531](https://redirect.github.com/astral-sh/setup-uv/issues/531))

##### 🧰 Maintenance

- Bump dependencies
[@&#8203;eifinger](https://redirect.github.com/eifinger)
([#&#8203;532](https://redirect.github.com/astral-sh/setup-uv/issues/532))
- chore: update known versions for 0.8.12
@&#8203;[github-actions\[bot\]](https://redirect.github.com/apps/github-actions)
([#&#8203;529](https://redirect.github.com/astral-sh/setup-uv/issues/529))
- chore: update known versions for 0.8.11
@&#8203;[github-actions\[bot\]](https://redirect.github.com/apps/github-actions)
([#&#8203;526](https://redirect.github.com/astral-sh/setup-uv/issues/526))
- chore: update known versions for 0.8.10
@&#8203;[github-actions\[bot\]](https://redirect.github.com/apps/github-actions)
([#&#8203;525](https://redirect.github.com/astral-sh/setup-uv/issues/525))

###
[`v6.5.0`](https://redirect.github.com/astral-sh/setup-uv/releases/tag/v6.5.0):
🌈 Better error messages, bug fixes and copilot agent settings

[Compare
Source](https://redirect.github.com/astral-sh/setup-uv/compare/v6.4.3...v6.5.0)

##### Changes

This release brings better error messages in case the GitHub API is
impacted, fixes a few bugs and allows to disable [problem
matchers](https://redirect.github.com/actions/toolkit/blob/main/docs/problem-matchers.md)
for better use in Copilot Agent workspaces.

##### 🐛 Bug fixes

- Improve error messages on GitHub API errors
[@&#8203;eifinger](https://redirect.github.com/eifinger)
([#&#8203;518](https://redirect.github.com/astral-sh/setup-uv/issues/518))
- Ignore backslashes and whitespace in requirements
[@&#8203;axm2](https://redirect.github.com/axm2)
([#&#8203;501](https://redirect.github.com/astral-sh/setup-uv/issues/501))

##### 🚀 Enhancements

- Add input add-problem-matchers
[@&#8203;eifinger](https://redirect.github.com/eifinger)
([#&#8203;517](https://redirect.github.com/astral-sh/setup-uv/issues/517))

##### 🧰 Maintenance

- chore: update known versions for 0.8.9
@&#8203;[github-actions\[bot\]](https://redirect.github.com/apps/github-actions)
([#&#8203;512](https://redirect.github.com/astral-sh/setup-uv/issues/512))
- chore: update known versions for 0.8.6-0.8.8
@&#8203;[github-actions\[bot\]](https://redirect.github.com/apps/github-actions)
([#&#8203;510](https://redirect.github.com/astral-sh/setup-uv/issues/510))
- chore: update known versions for 0.8.5
@&#8203;[github-actions\[bot\]](https://redirect.github.com/apps/github-actions)
([#&#8203;509](https://redirect.github.com/astral-sh/setup-uv/issues/509))
- chore: update known versions for 0.8.4
@&#8203;[github-actions\[bot\]](https://redirect.github.com/apps/github-actions)
([#&#8203;505](https://redirect.github.com/astral-sh/setup-uv/issues/505))
- chore: update known versions for 0.8.3
@&#8203;[github-actions\[bot\]](https://redirect.github.com/apps/github-actions)
([#&#8203;502](https://redirect.github.com/astral-sh/setup-uv/issues/502))

##### 📚 Documentation

- add note on caching to read disable-cache-pruning
[@&#8203;eifinger](https://redirect.github.com/eifinger)
([#&#8203;506](https://redirect.github.com/astral-sh/setup-uv/issues/506))

##### ⬆️ Dependency updates

- Bump actions/checkout from 4 to 5
@&#8203;[dependabot\[bot\]](https://redirect.github.com/apps/dependabot)
([#&#8203;514](https://redirect.github.com/astral-sh/setup-uv/issues/514))
- bump dependencies
[@&#8203;eifinger](https://redirect.github.com/eifinger)
([#&#8203;516](https://redirect.github.com/astral-sh/setup-uv/issues/516))
- Bump biome to v2
[@&#8203;eifinger](https://redirect.github.com/eifinger)
([#&#8203;515](https://redirect.github.com/astral-sh/setup-uv/issues/515))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-25 10:40:46 +05:30
renovate[bot]
41bb24a87e Update Rust crate serde_json to v1.0.143 (#20069) 2025-08-24 22:20:39 -04:00
renovate[bot]
87f0da139a Update Rust crate proc-macro2 to v1.0.101 (#20066) 2025-08-24 22:20:24 -04:00
renovate[bot]
f9bfc9ab5b Update Rust crate ordermap to v0.5.9 (#20065) 2025-08-24 22:20:17 -04:00
renovate[bot]
59f7102606 Update Rust crate bitflags to v2.9.3 (#20063) 2025-08-24 22:19:54 -04:00
renovate[bot]
862d2d0687 Update dependency ruff to v0.12.10 (#20062) 2025-08-24 22:19:44 -04:00
renovate[bot]
48edf46f3b Update Rust crate filetime to v0.2.26 (#20064) 2025-08-24 22:19:34 -04:00
Jelle Zijlstra
ec86a4e960 [ty] Add Top[] and Bottom[] special forms, replacing top_materialization_of() function (#20054)
Part of astral-sh/ty#994

## Summary

Add new special forms to `ty_extensions`, `Top[T]` and `Bottom[T]`.
Remove `ty_extensions.top_materialization` and
`ty_extensions.bottom_materialization`.

## Test Plan

Converted the existing `materialization.md` mdtest to the new syntax.
Added some tests for invalid use of the new special form.
2025-08-23 11:20:56 -07:00
Andrew Gallant
e7237652a9 [ty] Lightly refactor document symbols AST visitor
This makes use of early continue/return to keep rightward drift under
control. (I also find it easier to read.)
2025-08-23 12:53:41 -04:00
Andrew Gallant
205eae14d2 [ty] Rejigger workspace symbols for more efficient caching
In effect, we make the Salsa query aspect keyed only on whether we want
global symbols. We move everything else (hierarchical and querying) to
an aggregate step *after* the query.

This was a somewhat involved change since we want to return a flattened
list from visiting the source while also preserving enough information
to reform the symbols into a hierarchical structure that the LSP
expects. But I think overall the API has gotten simpler and we encode
more invariants into the type system. (For example, previously you got a
runtime assertion if you tried to provide a query string while enabling
hierarchical mode. But now that's prevented by construction.)
2025-08-23 12:53:41 -04:00
Andrew Gallant
f407f12f4c [ty] Parallelize workspace symbols
This is a pretty naive approach, but it makes cold times for listing
workspace symbols in home-assistant under 1s on my machine.

Courtesy of Micha:
https://github.com/astral-sh/ruff/pull/20030#discussion_r2292924171
2025-08-23 12:53:41 -04:00
Andrew Gallant
fb2d0af18c [ty] Optimize "workspace symbols" retrieval
Basically, this splits the implementation into two pieces:
the first piece does the traversal and finds *all* symbols
across the workspace. The second piece does filtering based
on a user provided query string. Only the first piece is
cached by Salsa.

This brings warm "workspace symbols" requests down from
500-600ms to 100-200ms.
2025-08-23 12:53:41 -04:00
Andrew Gallant
8ead02e0b1 [ty] Optimize query string matching
While this doesn't typically matter, when ty returns a very
large list of symbols, this can have an impact. Specifically,
when searching `async` in home-assistant, this gets times
closer to 500ms versus closer to 600ms before this change.
It looks like an overall ~50ms improvement (so around 10%),
but variance is all over the place and I didn't do any
statistical tests.

But this does make intuitive sense. Previously, we were
allocating intermediate strings, doing UTF-8 decoding and
consulting Unicode casing tables. Now we're just doing what
is likely a single DFA scan. In effect, we front load all
of the Unicode junk into regex compilation.
2025-08-23 12:53:41 -04:00
Andrew Gallant
330bb4efbf [ty] Add some unit tests for "query matches symbol"
There is a small amount of subtlety to this matching routine,
and it could be implemented in a faster way. So let's right some
tests for what we have to ensure we don't break anything when
we optimize it.
2025-08-23 12:53:41 -04:00
Andrew Gallant
ad8c98117a [ty] Move query filtering outside of symbol visitor
This is prep work for turning this into a Salsa query.
Specifically, we don't want the Salsa query to be
dependent upon the query string.
2025-08-23 12:53:41 -04:00
Andrew Gallant
06dbec8479 [ty] Add debug trace for workspace symbol elapsed time
Useful for ad hoc debugging, but it's also useful to have permanently to
enable serendipitous discovery of performance problems.
2025-08-23 12:53:41 -04:00
Andrew Gallant
85931ab594 [ty] Add a TODO for linting on todo! 2025-08-23 12:53:41 -04:00
Ibraheem Ahmed
b3cc733f06 [ty] Remove duplicate global lint registry (#20053)
## Summary

Looks like an oversight at some point that led to two identical globals,
the one in `ty_project` just calls `ty_python_semantic::register_lints`.
2025-08-22 19:43:12 -04:00
Ibraheem Ahmed
7abc41727b [ty] Shrink size of AstNodeRef (#20028)
## Summary

Removes the `module_ptr` field from `AstNodeRef` in release mode, and
change `NodeIndex` to a `NonZeroU32` to reduce the size of
`Option<AstNodeRef<_>>` fields.

I believe CI runs in debug mode, so this won't show up in the memory
report, but this reduces memory by ~2% in release mode.
2025-08-22 17:03:22 -04:00
chiri
886c4e4773 [flake8-use-pathlib] Fix PTH211 autofix (#20049)
## Summary
Part of #20009
2025-08-22 13:35:08 -05:00
Alex Waygood
bc6ea68733 [ty] Add precise iteration and unpacking inference for string literals and bytes literals (#20023)
## Summary

Previously we held off from doing this because we weren't sure that it
was worth the added complexity cost. But our code has changed in the
months since we made that initial decision, and I think the structure of
the code is such that it no longer really leads to much added complexity
to add precise inference when unpacking a string literal or a bytes
literal.

The improved inference we gain from this has real benefits to users (see
the mypy_primer report), and this PR doesn't appear to have a
performance impact.

## Test plan

mdtests
2025-08-22 19:33:08 +01:00
Micha Reiser
796819e7a0 [ty] Disallow std::env and io methods in most ty crates (#20046)
## Summary

We use the `System` abstraction in ty to abstract away the host/system
on which ty runs.
This has a few benefits:

* Tests can run in full isolation using a memory system (that uses an
in-memory file system)
* The LSP has a custom implementation where `read_to_string` returns the
content as seen by the editor (e.g. unsaved changes) instead of always
returning the content as it is stored on disk
* We don't require any file system polyfills for wasm in the browser


However, it does require extra care that we don't accidentally use
`std::fs` or `std::env` (etc.) methods in ty's code base (which is very
easy).

This PR sets up Clippy and disallows the most common methods, instead
pointing users towards the corresponding `System` methods.

The setup is a bit awkward because clippy doesn't support inheriting
configurations. That means, a crate can only override the entire
workspace configuration or not at all.
The approach taken in this PR is:

* Configure the disallowed methods at the workspace level
* Allow `disallowed_methods` at the workspace level
* Enable the lint at the crate level using the warn attribute (in code)


The obvious downside is that it won't work if we ever want to disallow
other methods, but we can figure that out once we reach that point.

What about false positives: Just add an `allow` and move on with your
life :) This isn't something that we have to enforce strictly; the goal
is to catch accidental misuse.

## Test Plan

Clippy found a place where we incorrectly used `std::fs::read_to_string`
2025-08-22 11:13:47 -07:00
Vivek Dasari
5508e8e528 Add testing helper to compare stable vs preview snapshots (#19715)
## Summary
This PR implements a diff test helper `assert_diagnostics_diff` as
described in #19351. The diff file includes both the settings ( e.g.
`+linter.preview = enabled`) and the snapshot data itself.

The current implementation looks for each old diagnostic in the new
snapshot. This works when the preview behavior adds/removes a couple
diagnostics. This implementation does not work well when every
diagnostic is modified (e.g. a "fix" is added).
https://github.com/astral-sh/ruff/pull/19715#discussion_r2259410763 has
ideas for future improvements to this implementation.

The example usage in this PR writes the diff to `preview_diff` file
instead of `preview` file, which might be a useful convention to keep.


## Test Plan
- Included a unit test at:
https://github.com/astral-sh/ruff/pull/19715/files#diff-d49487fe3e8a8585529f62c2df2a2b0a4c44267a1f93d1e859dff1d9f8771d36R523
- Example usage of this new test helper:
https://github.com/astral-sh/ruff/pull/19715/files#diff-2a33ac11146d1794c01a29549a6041d3af6fb6f9b423a31ade12a88d1951b0c2R1
2025-08-22 12:49:34 -05:00
chiri
0be3e1fbbf [flake8-use-pathlib] Add autofix for PTH211 (#20009)
## Summary
Part of https://github.com/astral-sh/ruff/issues/2331
2025-08-22 12:38:37 -05:00
Micha Reiser
5d217b7f46 [ty] Add type as detail to completion items (#20047)
## Summary

@BurntSushi was so kind as to find me an easy task to do some coding
before I'm off to PTO.

This PR adds the type to completion items (see the gray little text at
the end of a completion item).



https://github.com/user-attachments/assets/c0a86061-fa12-47b4-b43c-3c646771a69d
2025-08-22 12:32:53 -04:00
Dylan
0b6ce1c788 [ruff] Handle empty t-strings in unnecessary-empty-iterable-within-deque-call (RUF037) (#20045)
Adds a method to `TStringValue` to detect whether the t-string is empty
_as an iterable_. Note the subtlety here that, unlike f-strings, an
empty t-string is still truthy (i.e. `bool(t"")==True`).

Closes #19951
2025-08-22 10:23:49 -05:00
Matthew Mckee
0e9d77e43a Fix incorrect lsp inlay hint type (#20044) 2025-08-22 17:12:49 +02:00
Carl Meyer
8b827c3c6c [ty] rename BareTypeAliasType to ManualPEP695TypeAliasType (#20037)
## Summary

Rename `TypeAliasType::Bare` to `TypeAliasType::ManualPEP695`, and
`BareTypeAliasType` to `ManualPEP695TypeAliasType`.

Why?

Both existing variants of `TypeAliasType` are specific to features added
in PEP 695 (which introduced both the `type` statement and
`types.TypeAliasType`), so it doesn't make sense to name one with the
name `PEP695` and not the other.

A "bare" type alias, in my mind, is a legacy type alias like `IntOrStr =
int | str`, which is "bare" in that there is nothing at all
distinguishing it as a type alias. I will want to use the "bare" name
for this variant, in a future PR.

The renamed variant here describes a type alias created with `IntOrStr =
types.TypeAliasType("IntOrStr", int | str)`, which is not "bare", it's
just "manually" instantiated instead of using the `type` statement
syntax sugar. (This is useful when using the `typing_extensions`
backport of `TypeAliasType` on older Python versions.)

## Test Plan

Pure rename, existing tests pass.
2025-08-22 07:40:29 -07:00
Max Mynter
c22395dbc6 [ruff] Fix false positive for t-strings in default-factory-kwarg (RUF026) (#20032)
Closes #19993

## Summary
Recognize t strings as never being callable to avoid false positives on
RUF026.
2025-08-22 09:29:42 -05:00
Micha Reiser
11f521c768 [ty] Close signature help after ) (#20017) 2025-08-22 16:09:22 +02:00
Micha Reiser
c5e05df966 [ty] Cancel background tasks when shutdown is requested (#20039) 2025-08-22 10:20:13 +02:00
github-actions[bot]
7a44ea680e [ty] Sync vendored typeshed stubs (#20031)
Co-authored-by: typeshedbot <>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2025-08-21 21:32:48 +00:00
Alex Waygood
f82025d919 [ty] Improve diagnostics for bad calls to functions (#20022) 2025-08-21 22:00:44 +01:00
Micha Reiser
365f521c37 [ty] Fix incorrect docstring in call signature completion (#20021)
## Summary

This PR fixes https://github.com/astral-sh/ty/issues/1071

The core issue is that `CallableType` is a salsa interned but
`Signature` (which `CallableType` stores) ignores the `Definition` in
its `Eq` and `Hash` implementation.

This PR tries to simplest fix by removing the custom `Eq` and `Hash`
implementation. The main downside of this fix is that it can increase
memory usage because `CallableType`s that are equal except for their
`Definition` are now interned separately.

The alternative is to remove `Definition` from `CallableType` and
instead, call `bindings` directly on the callee (call_expression.func).
However, this would require
addressing the TODO 

here
39ee71c2a5/crates/ty_python_semantic/src/types.rs (L4582-L4586)

This might probably be worth addressing anyway, but is the more involved
fix. That's why I opted for removing the custom `Eq` implementation.

We already "ignore" the definition during normalization, thank's to
Alex's work in https://github.com/astral-sh/ruff/pull/19615

## Test Plan



https://github.com/user-attachments/assets/248d1cb1-12fd-4441-adab-b7e0866d23eb
2025-08-21 16:36:40 -04:00
Aria Desires
fc5321e000 [ty] fix GotoTargets for keyword args in nested function calls (#20013)
While implementing similar logic for initializers I noticed that this
code appeared to be walking the ancestors in the wrong direction, and so
if you have nested function calls it would always grab the outermost one
instead of the closest-ancestor.

The four copies of the test are because there's something really evil in
our caching that can't seem to be demonstrated in our cursor testing
framework, which I'm filing a followup for.
2025-08-21 20:19:52 +00:00
Dylan
c68ff8d90b Bump 0.12.10 (#20025) 2025-08-21 13:09:31 -05:00
Andrew Gallant
5931a5207d [ty] Stop running every mdtest twice
This was an accidental oversight introduced in commit
468eb37d75.
2025-08-21 13:37:08 -04:00
Brent Westbrook
692be72f5a Move diff rendering to ruff_db (#20006)
Summary
--

This is a preparatory PR in support of #19919. It moves our `Diff`
rendering code from `ruff_linter` to `ruff_db`, where we have direct
access to the `DiagnosticStylesheet` used by our other diagnostic
rendering code. As shown by the tests, this shouldn't cause any visible
changes. The colors aren't exactly the same, as I note in a TODO
comment, but I don't think there's any existing way to see those, even
in tests.

The `Diff` implementation is mostly unchanged. I just switched from a
Ruff-specific `SourceFile` to a `DiagnosticSource` (removing an
`expect_ruff_source_file` call) and updated the `LineStyle` struct and
other styling calls to use `fmt_styled` and our existing stylesheet.

In support of these changes, I added three styles to our stylesheet:
`insertion` and `deletion` for the corresponding diff operations, and
`underline`, which apparently we _can_ use, as I hoped on Discord. This
isn't supported in all terminals, though. It worked in ghostty but not
in st for me.

I moved the `calculate_print_width` function from the now-deleted
`diff.rs` to a method on `OneIndexed`, where it was available everywhere
we needed it. I'm not sure if that's desirable, or if my other changes
to the function are either (using `ilog10` instead of a loop). This does
make it `const` and slightly simplifies things in my opinion, but I'm
happy to revert it if preferred.

I also inlined a version of `show_nonprinting` from the
`ShowNonprinting` trait in `ruff_linter`:


f4be05a83b/crates/ruff_linter/src/text_helpers.rs (L3-L5)

This trait is now only used in `source_kind.rs`, so I'm not sure it's
worth having the trait or the macro-generated implementation (which is
only called once). This is obviously closely related to our unprintable
character handling in diagnostic rendering, but the usage seems
different enough not to try to combine them.


f4be05a83b/crates/ruff_db/src/diagnostic/render.rs (L990-L998)

We could also move the trait to another crate where we can use it in
`ruff_db` instead of inlining here, of course.

Finally, this PR makes `TextEmitter` a very thin wrapper around a
`DisplayDiagnosticsConfig`. It's still used in a few places, though,
unlike the other emitters we've replaced, so I figured it was worth
keeping around. It's a pretty nice API for setting all of the options on
the config and then passing that along to a `DisplayDiagnostics`.

Test Plan
--

Existing snapshot tests with diffs
2025-08-21 09:47:00 -04:00
Douglas Creager
14fe1228e7 [ty] Perform assignability etc checks using new Constraints trait (#19838)
"Why would you do this? This looks like you just replaced `bool` with an
overly complex trait"

Yes that's correct!

This should be a no-op refactoring. It replaces all of the logic in our
assignability, subtyping, equivalence, and disjointness methods to work
over an arbitrary `Constraints` trait instead of only working on `bool`.

The methods that `Constraints` provides looks very much like what we get
from `bool`. But soon we will add a new impl of this trait, and some new
methods, that let us express "fuzzy" constraints that aren't always true
or false. (In particular, a constraint will express the upper and lower
bounds of the allowed specializations of a typevar.)

Even once we have that, most of the operations that we perform on
constraint sets will be the usual boolean operations, just on sets.
(`false` becomes empty/never; `true` becomes universe/always; `or`
becomes union; `and` becomes intersection; `not` becomes negation.) So
it's helpful to have this separate PR to refactor how we invoke those
operations without introducing the new functionality yet.

Note that we also have translations of `Option::is_some_and` and
`is_none_or`, and of `Iterator::any` and `all`, and that the `and`,
`or`, `when_any`, and `when_all` methods are meant to short-circuit,
just like the corresponding boolean operations. For constraint sets,
that depends on being able to implement the `is_always` and `is_never`
trait methods.

---------

Co-authored-by: Carl Meyer <carl@astral.sh>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-08-21 09:30:09 -04:00
Micha Reiser
045cba382a [ty] Use dedent in cursor tests (#20019) 2025-08-21 10:31:54 +02:00
Brent Westbrook
a5cbca156c Fix rust feature activation (#20012) 2025-08-21 09:26:06 +02:00
Dhruv Manilawala
d43a3d34dd [ty] Avoid unnecessary argument type expansion (#19999)
## Summary

Part of: https://github.com/astral-sh/ty/issues/868

This PR adds a heuristic to avoid argument type expansion if it's going
to eventually lead to no matching overload.

This is done by checking whether the non-expandable argument types are
assignable to the corresponding annotated parameter type. If one of them
is not assignable to all of the remaining overloads, then argument type
expansion isn't going to help.

## Test Plan

Add mdtest that would otherwise take a long time because of the number
of arguments that it would need to expand (30).
2025-08-21 06:13:11 +00:00
Aria Desires
99111961c0 [ty] Add link for namespaces being partial (#20015)
As requested
2025-08-20 21:28:57 -07:00
Aria Desires
859475f017 [ty] add docstrings to completions based on type (#20008)
This is a fairly simple but effective way to add docstrings to like 95%
of completions from initial experimentation.

Fixes https://github.com/astral-sh/ty/issues/1036

Although ironically this approach *does not* work specifically for
`print` and I haven't looked into why.
2025-08-20 17:00:09 -04:00
Igor Drokin
7b75aee21d [pyupgrade] Avoid reporting __future__ features as unnecessary when they are used (UP010) (#19769)
## Summary
Resolves #19561

Fixes the [unnecessary-future-import
(UP010)](https://docs.astral.sh/ruff/rules/unnecessary-future-import/)
rule to correctly identify when imported __future__ modules are actually
used in the code, preventing false positives.

I assume there is no way to check usage in `analyze::statements`,
because we don't have any usage bindings for imports. To determine
unused imports, we have to fully scan the file to create bindings and
then check usage, similar to [unused-import
(F401)](https://docs.astral.sh/ruff/rules/unused-import/#unused-import-f401).
So, `Rule::UnnecessaryFutureImport` was moved from the
`analyze::statements` to the `analyze::deferred_scopes` stage. This
caused the need to change the logic of future import handling to a
bindings-based approach.

Also, the diagnostic report was changed.
Before
```
  |
1 | from __future__ import nested_scopes, generators
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP010
```
after
```
  |
1 | from __future__ import nested_scopes, generators
  |                        ^^^^^^^^^^^^^ UP010
```

I believe this is the correct way, because `generators` may be used, but
`nested_scopes` is not.

### Special case
I've found out about some specific case.
```python
from __future__ import nested_scopes

nested_scopes = 1
```
Here we can treat `nested_scopes` as an unused import because the
variable `nested_scopes` shadows it and we can safely remove the future
import (my fix does it).

But
[F401](https://docs.astral.sh/ruff/rules/unused-import/#unused-import-f401)
not triggered for such case
([sandbox](https://play.ruff.rs/296d9c7e-0f02-4659-b0c0-78cc21f3de76))
```
from foo import print_function

print_function = 1
```
In my mind, `print_function` here is an unused import and should be
deleted (my IDE highlight it). What do you think?

## Test Plan

Added test cases and snapshots:
- Split test file into separate _0 and _1 files for appropriate checks.
- Added test cases to verify fixes when future module are used.

---------

Co-authored-by: Igor Drokin <drokinii1017@gmail.com>
2025-08-20 15:22:03 -04:00
chiri
d04dcd991b [flake8-use-pathlib] Add fixes for PTH102 and PTH103 (#19514)
## Summary

Part of https://github.com/astral-sh/ruff/issues/2331

## Test Plan

<!-- How was it tested? -->
`cargo nextest run flake8_use_pathlib`
2025-08-20 14:36:07 -04:00
Leandro Braga
39ee71c2a5 [ty] correctly ignore field specifiers when not specified (#20002)
This commit corrects the type checker's behavior when handling
`dataclass_transform` decorators that don't explicitly specify
`field_specifiers`. According to [PEP 681 (Data Class
Transforms)](https://peps.python.org/pep-0681/#dataclass-transform-parameters),
when `field_specifiers` is not provided, it defaults to an empty tuple,
meaning no field specifiers are supported and
`dataclasses.field`/`dataclasses.Field` calls should be ignored.

Fixes https://github.com/astral-sh/ty/issues/980
2025-08-20 11:33:23 -07:00
Brent Westbrook
1a38831d53 Option::unwrap is now const (#20007)
Summary
--

I noticed while working on #20006 that we had a custom `unwrap` function
for `Option`. This has been const on stable since 1.83
([docs](https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap),
[release notes](https://blog.rust-lang.org/2024/11/28/Rust-1.83.0/)), so
I think it's safe to use now. I grepped a bit for related todos and
found this one for `AsciiCharSet` but no others.

Test Plan
--

Existing tests
2025-08-20 13:40:49 -04:00
Andrew Gallant
ddd4bab67c [ty] Re-arrange "list modules" implementation for Salsa caching
This basically splits `list_modules` into a higher level "aggregation"
routine and a lower level "get modules for one search path" routine.
This permits Salsa to cache the lower level components, e.g., many
search paths refer to directories that rarely change. This saves us
interaction with the system.

This did require a fair bit of surgery in terms of being careful about
adding file roots. Namely, now that we rely even more on file roots
existing for correct handling of cache invalidation, there were several
spots in our code that needed to be updated to add roots (that we
weren't previously doing). This feels Not Great, and it would be better
if we had some kind of abstraction that handled this for us. But it
isn't clear to me at this time what that looks like.
2025-08-20 10:41:47 -04:00
Andrew Gallant
468eb37d75 [ty] Test "list modules" versus "resolve module" in every mdtest
This ensures there is some level of consistency between the APIs.

This did require exposing a couple more things on `Module` for good
error messages. This also motivated a switch to an interned struct
instead of a tracked struct. This ensures that `list_modules` and
`resolve_modules` reuse the same `Module` values when the inputs are the
same.

Ref https://github.com/astral-sh/ruff/pull/19883#discussion_r2272520194
2025-08-20 10:27:54 -04:00
Andrew Gallant
2e9c241d7e [ty] Wire up "list modules" API to make module completions work
This makes `import <CURSOR>` and `from <CURSOR>` completions work.

This also makes `import os.<CURSOR>` and `from os.<CURSOR>`
completions work. In this case, we are careful to only offer
submodule completions.
2025-08-20 10:27:54 -04:00
Andrew Gallant
05478d5cc7 [ty] Tweak some completion tests
These tests were added as a regression check that a panic
didn't occur. So we were asserting a bit more than necessary.
In particular, these will soon return completions for modules,
which creates large snapshots that we don't need.

So modify these to just check there is sensible output that
doesn't panic.
2025-08-20 10:27:54 -04:00
Andrew Gallant
4db20f459c [ty] Add "list modules" implementation
The actual implementation wasn't too bad. It's not long
but pretty fiddly. I copied over the tests from the existing
module resolver and adapted them to work with this API. Then
I added a number of my own tests as well.
2025-08-20 10:27:54 -04:00
Andrew Gallant
ec7c2efef9 [ty] Lightly expose FileModule and NamespacePackage fields
This will make it easier to emit this info into snapshots for
testing.
2025-08-20 10:27:54 -04:00
Andrew Gallant
79b2754215 [ty] Add some more helper routines to ModulePath 2025-08-20 10:27:54 -04:00
Andrew Gallant
a0ddf1f7c4 [ty] Fix a bug when converting ModulePath to ModuleName
Previously, if the module was just `foo-stubs`, we'd skip over
stripping the `-stubs` suffix which would lead to us returning
`None`.

This function is now a little convoluted and could be simpler
if we did an intermediate allocation. But I kept the iterative
approach and added a special case to handle `foo-stubs`.
2025-08-20 10:27:54 -04:00
Andrew Gallant
5b00ec981b [ty] Split out another constructor for ModuleName
This makes it a little more flexible to call. For example,
we might have a `StmtImport` and not a `StmtImportFrom`.
2025-08-20 10:27:54 -04:00
Andrew Gallant
306ef3bb02 [ty] Add stub-file tests to existing module resolver
These tests capture existing behavior.

I added these when I stumbled upon what I thought was an
oddity: we prioritize `foo.pyi` over `foo.py`, but
prioritize `foo/__init__.py` over `foo.pyi`.

(I plan to investigate this more closely in follow-up
work. Particularly, to look at other type checkers. It
seems like we may want to change this to always prioritize
stubs.)
2025-08-20 10:27:54 -04:00
Andrew Gallant
a4cd13c6e2 [ty] Expose some routines in the module resolver
We'll want to use these when implementing the
"list modules" API.
2025-08-20 10:27:54 -04:00
Andrew Gallant
e0c98874e2 [ty] Add more path helper functions
This makes it easier to do exhaustive case analysis
on a `SearchPath` depending on whether it is a vendored
or system path.
2025-08-20 10:27:54 -04:00
Andrey
f4be05a83b [flake8-annotations] Remove unused import in example (ANN401) (#20000)
## Summary

Remove unused import in the  "Use instead" example.

## Test Plan

It's just a text description, no test needed
2025-08-20 09:19:18 -04:00
Aria Desires
1d2128f918 [ty] distinguish base conda from child conda (#19990)
This is a port of the logic in https://github.com/astral-sh/uv/pull/7691

The basic idea is we use CONDA_DEFAULT_ENV as a signal for whether
CONDA_PREFIX is just the ambient system conda install, or the user has
explicitly activated a custom one. If the former, then the conda is
treated like a system install (having lowest priority). If the latter,
the conda is treated like an activated venv (having priority over
everything but an Actual activated venv).

Fixes https://github.com/astral-sh/ty/issues/611
2025-08-20 09:07:42 -04:00
Micha Reiser
276405b44e [ty] Fix server hang (#19991) 2025-08-20 10:28:30 +02:00
Dhruv Manilawala
f019cfd15f [ty] Use specialized parameter type for overload filter (#19964)
## Summary

Closes: https://github.com/astral-sh/ty/issues/669

(This turned out to be simpler that I thought :))

## Test Plan

Update existing test cases.

### Ecosystem report

Most of them are basically because ty has now started inferring more
precise types for the return type to an overloaded call and a lot of the
types are defined using type aliases, here's some examples:

<details><summary>Details</summary>
<p>

> attrs (https://github.com/python-attrs/attrs)
> + tests/test_make.py:146:14: error[unresolved-attribute] Type
`Literal[42]` has no attribute `default`
> - Found 555 diagnostics
> + Found 556 diagnostics

This is accurate now that we infer the type as `Literal[42]` instead of
`Unknown` (Pyright infers it as `int`)

> optuna (https://github.com/optuna/optuna)
> + optuna/_gp/search_space.py:181:53: error[invalid-argument-type]
Argument to function `_round_one_normalized_param` is incorrect:
Expected `tuple[int | float, int | float]`, found `tuple[Unknown |
ndarray[Unknown, <class 'float'>], Unknown | ndarray[Unknown, <class
'float'>]]`
> + optuna/_gp/search_space.py:181:83: error[invalid-argument-type]
Argument to function `_round_one_normalized_param` is incorrect:
Expected `int | float`, found `Unknown | ndarray[Unknown, <class
'float'>]`
> + tests/gp_tests/test_search_space.py:109:13:
error[invalid-argument-type] Argument to function
`_unnormalize_one_param` is incorrect: Expected `tuple[int | float, int
| float]`, found `Unknown | ndarray[Unknown, <class 'float'>]`
> + tests/gp_tests/test_search_space.py:110:13:
error[invalid-argument-type] Argument to function
`_unnormalize_one_param` is incorrect: Expected `int | float`, found
`Unknown | ndarray[Unknown, <class 'float'>]`
> - Found 559 diagnostics
> + Found 563 diagnostics

Same as above where ty is now inferring a more precise type like
`Unknown | ndarray[tuple[int, int], <class 'float'>]` instead of just
`Unknown` as before

> jinja (https://github.com/pallets/jinja)
> + src/jinja2/bccache.py:298:39: error[invalid-argument-type] Argument
to bound method `write_bytecode` is incorrect: Expected `IO[bytes]`,
found `_TemporaryFileWrapper[str]`
> - Found 186 diagnostics
> + Found 187 diagnostics

This requires support for type aliases to match the correct overload.

> hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
> + src/hydra_zen/wrapper/_implementations.py:945:16:
error[invalid-return-type] Return type does not match returned value:
expected `DataClass_ | type[@Todo(type[T] for protocols)] | ListConfig |
DictConfig`, found `@Todo(unsupported type[X] special form) | (((...) ->
Any) & dict[Unknown, Unknown]) | (DataClass_ & dict[Unknown, Unknown]) |
dict[Any, Any] | (ListConfig & dict[Unknown, Unknown]) | (DictConfig &
dict[Unknown, Unknown]) | (((...) -> Any) & list[Unknown]) | (DataClass_
& list[Unknown]) | list[Any] | (ListConfig & list[Unknown]) |
(DictConfig & list[Unknown])`
> + tests/annotations/behaviors.py:60:28: error[call-non-callable]
Object of type `Path` is not callable
> + tests/annotations/behaviors.py:64:21: error[call-non-callable]
Object of type `Path` is not callable
> + tests/annotations/declarations.py:167:17: error[call-non-callable]
Object of type `Path` is not callable
> + tests/annotations/declarations.py:524:17:
error[unresolved-attribute] Type `<class 'int'>` has no attribute
`_target_`
> - Found 561 diagnostics
> + Found 566 diagnostics

Same as above, this requires support for type aliases to match the
correct overload.

> paasta (https://github.com/yelp/paasta)
> + paasta_tools/utils.py:4188:19: warning[redundant-cast] Value is
already of type `list[str]`
> - Found 888 diagnostics
> + Found 889 diagnostics

This is correct.

> colour (https://github.com/colour-science/colour)
> + colour/plotting/diagrams.py:448:13: error[invalid-argument-type]
Argument to bound method `__init__` is incorrect: Expected
`Sequence[@Todo(Support for `typing.TypeAlias`)]`, found
`ndarray[tuple[int, int, int], dtype[Unknown]]`
> + colour/plotting/diagrams.py:462:13: error[invalid-argument-type]
Argument to bound method `__init__` is incorrect: Expected
`Sequence[@Todo(Support for `typing.TypeAlias`)]`, found
`ndarray[tuple[int, int, int], dtype[Unknown]]`
> + colour/plotting/models.py:419:13: error[invalid-argument-type]
Argument to bound method `__init__` is incorrect: Expected
`Sequence[@Todo(Support for `typing.TypeAlias`)]`, found
`ndarray[tuple[int, int, int], dtype[Unknown]]`
> + colour/plotting/temperature.py:230:9: error[invalid-argument-type]
Argument to bound method `__init__` is incorrect: Expected
`Sequence[@Todo(Support for `typing.TypeAlias`)]`, found
`ndarray[tuple[int, int, int], dtype[Unknown]]`
> + colour/plotting/temperature.py:474:13: error[invalid-argument-type]
Argument to bound method `__init__` is incorrect: Expected
`Sequence[@Todo(Support for `typing.TypeAlias`)]`, found
`ndarray[tuple[int, int, int], dtype[Unknown]]`
> + colour/plotting/temperature.py:495:17: error[invalid-argument-type]
Argument to bound method `__init__` is incorrect: Expected
`Sequence[@Todo(Support for `typing.TypeAlias`)]`, found
`ndarray[tuple[int, int, int], dtype[Unknown]]`
> + colour/plotting/temperature.py:513:13: error[invalid-argument-type]
Argument to bound method `text` is incorrect: Expected `int | float`,
found `ndarray[@Todo(Support for `typing.TypeAlias`), dtype[Unknown]]`
> + colour/plotting/temperature.py:514:13: error[invalid-argument-type]
Argument to bound method `text` is incorrect: Expected `int | float`,
found `ndarray[@Todo(Support for `typing.TypeAlias`), dtype[Unknown]]`
> - Found 480 diagnostics
> + Found 488 diagnostics

Most of them are correct except for the last two diagnostics which I'm
not sure
what's happening, it's trying to index into an `np.ndarray` type (which
is
inferred correctly) but I think it might be picking up an incorrect
overload
for the `__getitem__` method.

Scipy's diagnostics also requires support for type alises to pick the
correct overload.

</p>
</details>
2025-08-20 09:39:05 +05:30
Eric Mark Martin
33030b34cd [ty] linear variance inference for PEP-695 type parameters (#18713)
## Summary

Implement linear-time variance inference for type variables
(https://github.com/astral-sh/ty/issues/488).

Inspired by Martin Huschenbett's [PyCon 2025
Talk](https://www.youtube.com/watch?v=7uixlNTOY4s&t=9705s).

## Test Plan

update tests, add new tests, including for mutually recursive classes

---------

Co-authored-by: Carl Meyer <carl@astral.sh>
2025-08-19 17:54:09 -07:00
Alex Waygood
656fc335f2 [ty] Strict validation of protocol members (#17750) 2025-08-19 22:45:41 +00:00
Dan Parizher
e0f4cec7a1 [pyupgrade] Handle nested Optionals (UP045) (#19770)
## Summary

Fixes #19746

---------

Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
2025-08-19 18:12:15 -04:00
Alex Waygood
662d18bd05 [ty] Add precise inference for unpacking a TypeVar if the TypeVar has an upper bound with a precise tuple spec (#19985) 2025-08-19 22:11:30 +01:00
Aria Desires
c82e255ca8 [ty] Fix namespace packages that behave like partial stubs (#19994)
In implementing partial stubs I had observed that this continue in the
namespace package code seemed erroneous since the same continue for
partial stubs didn't work. Unfortunately I wasn't confident enough to
push on that hunch. Fortunately I remembered that hunch to make this an
easy fix.

The issue with the continue is that it bails out of the current
search-path without testing any .py files. This breaks when for example
`google` and `google-stubs`/`types-google` are both in the same
site-packages dir -- failing to find a module in `types-google` has us
completely skip over `google`!

Fixes https://github.com/astral-sh/ty/issues/520
2025-08-19 16:34:39 -04:00
Eric Jolibois
58efd19f11 [ty] apply KW_ONLY sentinel only to local fields (#19986)
fix https://github.com/astral-sh/ty/issues/1047

## Summary

This PR fixes how `KW_ONLY` is applied in dataclasses. Previously, the
sentinel leaked into subclasses and incorrectly marked their fields as
keyword-only; now it only affects fields declared in the same class.

```py
from dataclasses import dataclass, KW_ONLY

@dataclass
class D:
    x: int
    _: KW_ONLY
    y: str

@dataclass
class E(D):
    z: bytes

# This should work: x=1 (positional), z=b"foo" (positional), y="foo" (keyword-only)
E(1, b"foo", y="foo")

reveal_type(E.__init__)  # revealed: (self: E, x: int, z: bytes, *, y: str) -> None
```

<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

<!-- How was it tested? -->
mdtests
2025-08-19 11:01:35 -07:00
Aria Desires
c6dcfe36d0 [ty] introduce multiline pretty printer (#19979)
Requires some iteration, but this includes the most tedious part --
threading a new concept of DisplaySettings through every type display
impl. Currently it only holds a boolean for multiline, but in the future
it could also take other things like "render to markdown" or "here's
your base indent if you make a newline".

For types which have exposed display functions I've left the old
signature as a compatibility polyfill to avoid having to audit
everywhere that prints types right off the bat (notably I originally
tried doing multiline functions unconditionally and a ton of things
churned that clearly weren't ready for multi-line (diagnostics).

The only real use of this API in this PR is to multiline render function
types in hovers, which is the highest impact (see snapshot changes).

Fixes https://github.com/astral-sh/ty/issues/1000
2025-08-19 17:31:44 +00:00
Avasam
59b078b1bf Update outdated links to https://typing.python.org/en/latest/source/stubs.html (#19992) 2025-08-19 18:12:08 +01:00
Andrew Gallant
5e943d3539 [ty] Ask the LSP client to watch all project search paths
This change rejiggers how we register globs for file watching with the
LSP client. Previously, we registered a few globs like `**/*.py`,
`**/pyproject.toml` and more. There were two problems with this
approach.

Firstly, it only watches files within the project root. Search paths may
be outside the project root. Such as virtualenv directory.

Secondly, there is variation on how tools interact with virtual
environments. In the case of uv, depending on its link mode, we might
not get any file change notifications after running `uv add foo` or
`uv remove foo`.

To remedy this, we instead just list for file change notifications on
all files for all search paths. This simplifies the globs we use, but
does potentially increase the number of notifications we'll get.
However, given the somewhat simplistic interface supported by the LSP
protocol, I think this is unavoidable (unless we used our own file
watcher, which has its own considerably downsides). Moreover, this is
seemingly consistent with how `ty check --watch` works.

This also required moving file watcher registration to *after*
workspaces are initialized, or else we don't know what the right search
paths are.

This change is in service of #19883, which in order for cache
invalidation to work right, the LSP client needs to send notifications
whenever a dependency is added or removed. This change should make that
possible.

I tried this patch with #19883 in addition to my work to activate Salsa
caching, and everything seems to work as I'd expect. That is,
completions no longer show stale results after a dependency is added or
removed.
2025-08-19 10:57:07 -04:00
renovate[bot]
0967e7e088 Update Rust crate glob to v0.3.3 (#19959)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [glob](https://redirect.github.com/rust-lang/glob) |
workspace.dependencies | patch | `0.3.2` -> `0.3.3` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>rust-lang/glob (glob)</summary>

###
[`v0.3.3`](https://redirect.github.com/rust-lang/glob/blob/HEAD/CHANGELOG.md#033---2025-08-11)

[Compare
Source](https://redirect.github.com/rust-lang/glob/compare/v0.3.2...v0.3.3)

- Optimize memory allocations
([#&#8203;147](https://redirect.github.com/rust-lang/glob/pull/147))
- Bump the MSRV to 1.63
([#&#8203;172](https://redirect.github.com/rust-lang/glob/pull/172))
- Fix spelling in pattern documentation
([#&#8203;164](https://redirect.github.com/rust-lang/glob/pull/164))
- Fix version numbers and some formatting
([#&#8203;157](https://redirect.github.com/rust-lang/glob/pull/157))
- Style fixes
([#&#8203;137](https://redirect.github.com/rust-lang/glob/pull/137))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
2025-08-19 10:39:23 -04:00
Alex Waygood
600245478c [ty] Look for site-packages directories in <sys.prefix>/lib64/ as well as <sys.prefix>/lib/ on non-Windows systems (#19978) 2025-08-19 11:53:06 +00:00
Alex Waygood
e5c091b850 [ty] Fix protocol interface inference for stub protocols and subprotocols (#19950) 2025-08-19 10:31:11 +00:00
David Peter
10301f6190 [ty] Enable virtual terminal on Windows (#19984)
## Summary

Should hopefully fix https://github.com/astral-sh/ty/issues/1045
2025-08-19 09:13:03 +00:00
Alex Waygood
4242905b36 [ty] Detect NamedTuple classes where fields without default values follow fields with default values (#19945) 2025-08-19 08:56:08 +00:00
Aria Desires
c20d906503 [ty] improve goto/hover for definitions (#19976)
By computing the actual Definition for, well, definitions, we unlock a
bunch of richer machinery in the goto/hover subsystems for free.

Fixes https://github.com/astral-sh/ty/issues/1001
Fixes https://github.com/astral-sh/ty/issues/1004
2025-08-18 21:42:53 -04:00
Carl Meyer
a04375173c [ty] fix unpacking a type alias with detailed tuple spec (#19981)
## Summary

Fixes https://github.com/astral-sh/ty/issues/1046

We special-case iteration of certain types because they may have a more
detailed tuple-spec. Now that type aliases are a distinct type variant,
we need to handle them as well.

I don't love that `Type::TypeAlias` means we have to remember to add a
case for it basically anywhere we are special-casing a certain kind of
type, but at the moment I don't have a better plan. It's another
argument for avoiding fallback cases in `Type` matches, which we usually
prefer; I've updated this match statement to be comprehensive.

## Test Plan

Added mdtest.
2025-08-18 17:54:05 -07:00
Alex Waygood
e6dcdd29f2 [ty] Add a Todo-type branch for type[P] where P is a protocol class (#19947) 2025-08-18 20:38:19 +00:00
Matthew Mckee
24f6d2dc13 [ty] Infer the correct type of Enum __eq__ and __ne__ comparisions (#19666)
## Summary

Resolves https://github.com/astral-sh/ty/issues/920

## Test Plan

Update `enums.md`

---------

Co-authored-by: David Peter <mail@david-peter.de>
2025-08-18 19:45:44 +02:00
Alex Waygood
3314cf90ed [ty] Add more regression tests for tuple (#19974) 2025-08-18 18:30:05 +01:00
Aria Desires
0cb1abc1fc [ty] Implement partial stubs (#19931)
Fixes https://github.com/astral-sh/ty/issues/184
2025-08-18 13:14:13 -04:00
Brent Westbrook
f6491cacd1 Add full output format changes to the changelog (#19968)
Summary
--

I thought this might warrant a small blog-style writeup, especially
since we already got a question about it (#19966), but I'm happy to
switch back to a one-liner under `### Other changes` if preferred.

I'll copy whatever we add here to the release notes too.

Do we need a note at the top about the late addition?
2025-08-18 11:46:16 -04:00
Alex Waygood
e4f1b587cc Upgrade mypy_primer pin (#19967) 2025-08-18 13:27:54 +01:00
Alex Waygood
fbf24be8ae [ty] Detect illegal multiple inheritance with NamedTuple (#19943) 2025-08-18 12:03:01 +00:00
Micha Reiser
5e4fa9e442 [ty] Speedup tracing checks (#19965) 2025-08-18 12:56:06 +02:00
Micha Reiser
67529edad6 [ty] Short-circuit inlayhints request if disabled in settings (#19963) 2025-08-18 10:35:40 +00:00
Alex Waygood
4ac2b2c222 [ty] Have SemanticIndex::place_table() and SemanticIndex::use_def_map return references (#19944) 2025-08-18 11:30:52 +01:00
renovate[bot]
083bb85d9d Update actions/checkout to v5.0.0 (#19952)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micha Reiser <micha@reiser.io>
2025-08-18 07:31:07 +00:00
Micha Reiser
c7af595fc1 [ty] Use debug builds for conformance tests and run them single threaded (#19938) 2025-08-18 07:20:49 +00:00
Micha Reiser
7d8f7c20da [ty] Log server version at info level (#19961) 2025-08-18 07:16:53 +00:00
renovate[bot]
76c933d10e Update dependency ruff to v0.12.9 (#19954)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 08:54:23 +02:00
renovate[bot]
d423191d94 Update Rust crate bitflags to v2.9.2 (#19957)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 08:54:09 +02:00
renovate[bot]
c8d155b2b9 Update Rust crate clap to v4.5.45 (#19958)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 08:53:51 +02:00
renovate[bot]
a5339a52c3 Update Rust crate libc to v0.2.175 (#19960)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 08:53:31 +02:00
renovate[bot]
48772c04d7 Update Rust crate anyhow to v1.0.99 (#19956)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 08:53:10 +02:00
renovate[bot]
510a07dee2 Update PyO3/maturin-action action to v1.49.4 (#19955)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 08:44:00 +02:00
gkowzan
47d44e5f7b Fix description of global config file discovery strategy (#19143) (#19188)
Contrary to docs, ruff uses etcetera's base strategy rather than the
native strategy.
2025-08-17 18:35:37 -05:00
Alex Waygood
ec3163781c [ty] Remove unused code (#19949) 2025-08-17 18:54:24 +01:00
Douglas Creager
b892e4548e [ty] Track when type variables are inferable or not (#19786)
`Type::TypeVar` now distinguishes whether the typevar in question is
inferable or not.

A typevar is _not inferable_ inside the body of the generic class or
function that binds it:

```py
def f[T](t: T) -> T:
    return t
```

The infered type of `t` in the function body is `TypeVar(T,
NotInferable)`. This represents how e.g. assignability checks need to be
valid for all possible specializations of the typevar. Most of the
existing assignability/etc logic only applies to non-inferable typevars.

Outside of the function body, the typevar is _inferable_:

```py
f(4)
```

Here, the parameter type of `f` is `TypeVar(T, Inferable)`. This
represents how e.g. assignability doesn't need to hold for _all_
specializations; instead, we need to find the constraints under which
this specific assignability check holds.

This is in support of starting to perform specialization inference _as
part of_ performing the assignability check at the call site.

In the [[POPL2015][]] paper, this concept is called _monomorphic_ /
_polymorphic_, but I thought _non-inferable_ / _inferable_ would be
clearer for us.

Depends on #19784 

[POPL2015]: https://doi.org/10.1145/2676726.2676991

---------

Co-authored-by: Carl Meyer <carl@astral.sh>
2025-08-16 18:25:03 -04:00
Alex Waygood
9ac39cee98 [ty] Ban protocols from inheriting from non-protocol generic classes (#19941) 2025-08-16 19:38:43 +01:00
Alex Waygood
f4d8826428 [ty] Fix error message for invalidly providing type arguments to NamedTuple when it occurs in a type expression (#19940) 2025-08-16 17:45:15 +00:00
Micha Reiser
527a690a73 [ty] Fix example in environment docs (#19937) 2025-08-16 14:37:28 +00:00
Dan Parizher
f0e9c1d8f9 [isort] Handle multiple continuation lines after module docstring (I002) (#19818)
## Summary

Fixes #19815

---------

Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
2025-08-15 17:17:50 -04:00
Frazer McLean
2e1d6623cd [flake8-simplify] Implement fix for maxsplit without separator (SIM905) (#19851)
**Stacked on top of #19849; diff will include that PR until it is
merged.**

---

<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary

As part of #19849, I noticed this fix could be implemented.

## Test Plan

Tests added based on CPython behaviour.
2025-08-15 15:18:06 -04:00
Dan Parizher
2dc2f68b0f [pycodestyle] Make E731 fix unsafe instead of display-only for class assignments (#19700)
## Summary

Fixes #19650

---------

Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
2025-08-15 19:09:55 +00:00
Alex Waygood
26d6c3831f [ty] Represent NamedTuple as an opaque special form, not a class (#19915) 2025-08-15 18:20:14 +01:00
Alex Waygood
9ced219ffc [ty] Remove incorrect type narrowing for if type(x) is C[int] (#19926) 2025-08-15 17:52:14 +01:00
Micha Reiser
f344dda82c Bump Rust MSRV to 1.87 (#19924) 2025-08-15 17:55:38 +02:00
Alex Waygood
6de84ed56e Add else-branch narrowing for if type(a) is A when A is @final (#19925) 2025-08-15 14:52:30 +01:00
github-actions[bot]
bd4506aac5 [ty] Sync vendored typeshed stubs (#19923)
Close and reopen this PR to trigger CI

---------

Co-authored-by: typeshedbot <>
Co-authored-by: Carl Meyer <carl@astral.sh>
2025-08-14 18:09:35 -07:00
Shunsuke Shibayama
0e5577ab56 [ty] fix lazy snapshot sweeping in nested scopes (#19908)
## Summary

This PR closes astral-sh/ty#955.

## Test Plan

New test cases in `narrowing/conditionals/nested.md`.
2025-08-14 17:52:52 -07:00
Andrii Turov
957320c0f1 [ty] Add diagnostics for invalid await expressions (#19711)
## Summary

This PR adds a new lint, `invalid-await`, for all sorts of reasons why
an object may not be `await`able, as discussed in astral-sh/ty#919.
Precisely, `__await__` is guarded against being missing, possibly
unbound, or improperly defined (expects additional arguments or doesn't
return an iterator).

Of course, diagnostics need to be fine-tuned. If `__await__` cannot be
called with no extra arguments, it indicates an error (or a quirk?) in
the method signature, not at the call site. Without any doubt, such an
object is not `Awaitable`, but I feel like talking about arguments for
an *implicit* call is a bit leaky.
I didn't reference any actual diagnostic messages in the lint
definition, because I want to hear feedback first.

Also, there's no mention of the actual required method signature for
`__await__` anywhere in the docs. The only reference I had is the
`typing` stub. I basically ended up linking `[Awaitable]` to ["must
implement
`__await__`"](https://docs.python.org/3/library/collections.abc.html#collections.abc.Awaitable),
which is insufficient on its own.

## Test Plan

The following code was tested:
```python
import asyncio
import typing


class Awaitable:
    def __await__(self) -> typing.Generator[typing.Any, None, int]:
        yield None
        return 5


class NoDunderMethod:
    pass


class InvalidAwaitArgs:
    def __await__(self, value: int) -> int:
        return value


class InvalidAwaitReturn:
    def __await__(self) -> int:
        return 5


class InvalidAwaitReturnImplicit:
    def __await__(self):
        pass


async def main() -> None:
    result = await Awaitable()  # valid
    result = await NoDunderMethod()  # `__await__` is missing
    result = await InvalidAwaitReturn()  # `__await__` returns `int`, which is not a valid iterator 
    result = await InvalidAwaitArgs()  # `__await__` expects additional arguments and cannot be called implicitly
    result = await InvalidAwaitReturnImplicit()  # `__await__` returns `Unknown`, which is not a valid iterator


asyncio.run(main())
```

---------

Co-authored-by: Carl Meyer <carl@astral.sh>
2025-08-14 14:38:33 -07:00
Alex Waygood
f6093452ed [ty] Synthesize read-only properties for all declared members on NamedTuple classes (#19899) 2025-08-14 21:25:45 +00:00
Alex Waygood
82350a398e [ty] Remove use of ClassBase::try_from_type from super() machinery (#19902) 2025-08-14 22:14:31 +01:00
2197 changed files with 120097 additions and 110294 deletions

View File

@@ -49,7 +49,7 @@ jobs:
- name: "Prep README.md"
run: python scripts/transform_readme.py --target pypi
- name: "Build sdist"
uses: PyO3/maturin-action@e10f6c464b90acceb5f640d31beda6d586ba7b4a # v1.49.3
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
with:
command: sdist
args: --out dist
@@ -79,7 +79,7 @@ jobs:
- name: "Prep README.md"
run: python scripts/transform_readme.py --target pypi
- name: "Build wheels - x86_64"
uses: PyO3/maturin-action@e10f6c464b90acceb5f640d31beda6d586ba7b4a # v1.49.3
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
with:
target: x86_64
args: --release --locked --out dist
@@ -121,7 +121,7 @@ jobs:
- name: "Prep README.md"
run: python scripts/transform_readme.py --target pypi
- name: "Build wheels - aarch64"
uses: PyO3/maturin-action@e10f6c464b90acceb5f640d31beda6d586ba7b4a # v1.49.3
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
with:
target: aarch64
args: --release --locked --out dist
@@ -177,7 +177,7 @@ jobs:
- name: "Prep README.md"
run: python scripts/transform_readme.py --target pypi
- name: "Build wheels"
uses: PyO3/maturin-action@e10f6c464b90acceb5f640d31beda6d586ba7b4a # v1.49.3
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
with:
target: ${{ matrix.platform.target }}
args: --release --locked --out dist
@@ -230,7 +230,7 @@ jobs:
- name: "Prep README.md"
run: python scripts/transform_readme.py --target pypi
- name: "Build wheels"
uses: PyO3/maturin-action@e10f6c464b90acceb5f640d31beda6d586ba7b4a # v1.49.3
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
with:
target: ${{ matrix.target }}
manylinux: auto
@@ -306,7 +306,7 @@ jobs:
- name: "Prep README.md"
run: python scripts/transform_readme.py --target pypi
- name: "Build wheels"
uses: PyO3/maturin-action@e10f6c464b90acceb5f640d31beda6d586ba7b4a # v1.49.3
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
with:
target: ${{ matrix.platform.target }}
manylinux: auto
@@ -372,7 +372,7 @@ jobs:
- name: "Prep README.md"
run: python scripts/transform_readme.py --target pypi
- name: "Build wheels"
uses: PyO3/maturin-action@e10f6c464b90acceb5f640d31beda6d586ba7b4a # v1.49.3
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
with:
target: ${{ matrix.target }}
manylinux: musllinux_1_2
@@ -437,7 +437,7 @@ jobs:
- name: "Prep README.md"
run: python scripts/transform_readme.py --target pypi
- name: "Build wheels"
uses: PyO3/maturin-action@e10f6c464b90acceb5f640d31beda6d586ba7b4a # v1.49.3
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
with:
target: ${{ matrix.platform.target }}
manylinux: musllinux_1_2

View File

@@ -250,7 +250,7 @@ jobs:
- name: "Install Rust toolchain"
run: rustup show
- name: "Install mold"
uses: rui314/setup-mold@7344740a9418dcdcb481c7df83d9fbd1d5072d7d # v1
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- name: "Install cargo nextest"
uses: taiki-e/install-action@6064345e6658255e90e9500fdf9a06ab77e6909c # v2.57.6
with:
@@ -308,7 +308,7 @@ jobs:
- name: "Install Rust toolchain"
run: rustup show
- name: "Install mold"
uses: rui314/setup-mold@7344740a9418dcdcb481c7df83d9fbd1d5072d7d # v1
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- name: "Install cargo nextest"
uses: taiki-e/install-action@6064345e6658255e90e9500fdf9a06ab77e6909c # v2.57.6
with:
@@ -393,7 +393,7 @@ jobs:
- name: "Install Rust toolchain"
run: rustup show
- name: "Install mold"
uses: rui314/setup-mold@7344740a9418dcdcb481c7df83d9fbd1d5072d7d # v1
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- name: "Build"
run: cargo build --release --locked
@@ -418,7 +418,7 @@ jobs:
MSRV: ${{ steps.msrv.outputs.value }}
run: rustup default "${MSRV}"
- name: "Install mold"
uses: rui314/setup-mold@7344740a9418dcdcb481c7df83d9fbd1d5072d7d # v1
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- name: "Build tests"
shell: bash
env:
@@ -441,7 +441,7 @@ jobs:
- name: "Install Rust toolchain"
run: rustup show
- name: "Install cargo-binstall"
uses: cargo-bins/cargo-binstall@79e4beb1e02f733a26129a6bf26c37dab4ab3307 # v1.14.4
uses: cargo-bins/cargo-binstall@2bb61346d075e720d4c3da92f23b6d612d5a7543 # v1.15.3
with:
tool: cargo-fuzz@0.11.2
- name: "Install cargo-fuzz"
@@ -463,7 +463,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
- uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
name: Download Ruff binary to test
id: download-cached-binary
@@ -664,7 +664,7 @@ jobs:
branch: ${{ github.event.pull_request.base.ref }}
workflow: "ci.yaml"
check_artifacts: true
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
- uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- name: Fuzz
env:
FORCE_COLOR: 1
@@ -694,7 +694,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: cargo-bins/cargo-binstall@79e4beb1e02f733a26129a6bf26c37dab4ab3307 # v1.14.4
- uses: cargo-bins/cargo-binstall@2bb61346d075e720d4c3da92f23b6d612d5a7543 # v1.15.3
- run: cargo binstall --no-confirm cargo-shear
- run: cargo shear
@@ -715,7 +715,7 @@ jobs:
- name: "Prep README.md"
run: python scripts/transform_readme.py --target pypi
- name: "Build wheels"
uses: PyO3/maturin-action@e10f6c464b90acceb5f640d31beda6d586ba7b4a # v1.49.3
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
with:
args: --out dist
- name: "Test wheel"
@@ -734,7 +734,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
- uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
@@ -777,7 +777,7 @@ jobs:
- name: "Install Rust toolchain"
run: rustup show
- name: Install uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- name: "Install Insiders dependencies"
if: ${{ env.MKDOCS_INSIDERS_SSH_KEY_EXISTS == 'true' }}
run: uv pip install -r docs/requirements-insiders.txt --system
@@ -909,7 +909,7 @@ jobs:
persist-credentials: false
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
- uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- name: "Install Rust toolchain"
run: rustup show
@@ -923,7 +923,7 @@ jobs:
run: cargo codspeed build --features "codspeed,instrumented" --no-default-features -p ruff_benchmark
- name: "Run benchmarks"
uses: CodSpeedHQ/action@0b6e7a3d96c9d2a6057e7bcea6b45aaf2f7ce60b # v3.8.0
uses: CodSpeedHQ/action@76578c2a7ddd928664caa737f0e962e3085d4e7c # v3.8.1
with:
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}
@@ -942,7 +942,7 @@ jobs:
persist-credentials: false
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
- uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- name: "Install Rust toolchain"
run: rustup show
@@ -956,7 +956,7 @@ jobs:
run: cargo codspeed build --features "codspeed,walltime" --no-default-features -p ruff_benchmark
- name: "Run benchmarks"
uses: CodSpeedHQ/action@0b6e7a3d96c9d2a6057e7bcea6b45aaf2f7ce60b # v3.8.0
uses: CodSpeedHQ/action@76578c2a7ddd928664caa737f0e962e3085d4e7c # v3.8.1
with:
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}

View File

@@ -34,11 +34,11 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
- uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- name: "Install Rust toolchain"
run: rustup show
- name: "Install mold"
uses: rui314/setup-mold@7344740a9418dcdcb481c7df83d9fbd1d5072d7d # v1
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- name: Build ruff
# A debug build means the script runs slower once it gets started,

View File

@@ -11,6 +11,7 @@ on:
- "crates/ruff_python_parser"
- ".github/workflows/mypy_primer.yaml"
- ".github/workflows/mypy_primer_comment.yaml"
- "scripts/mypy_primer.sh"
- "Cargo.lock"
- "!**.md"
@@ -38,7 +39,7 @@ jobs:
persist-credentials: false
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
with:
@@ -81,7 +82,7 @@ jobs:
persist-credentials: false
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
with:

View File

@@ -22,7 +22,7 @@ jobs:
id-token: write
steps:
- name: "Install uv"
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: wheels-*

View File

@@ -61,7 +61,7 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
with:
persist-credentials: false
submodules: recursive
@@ -124,7 +124,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
steps:
- uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
with:
persist-credentials: false
submodules: recursive
@@ -175,7 +175,7 @@ jobs:
outputs:
val: ${{ steps.host.outputs.manifest }}
steps:
- uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
with:
persist-credentials: false
submodules: recursive
@@ -251,7 +251,7 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
with:
persist-credentials: false
submodules: recursive

View File

@@ -65,7 +65,7 @@ jobs:
run: |
git config --global user.name typeshedbot
git config --global user.email '<>'
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
- uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- name: Sync typeshed stubs
run: |
rm -rf "ruff/${VENDORED_TYPESHED}"
@@ -117,7 +117,7 @@ jobs:
with:
persist-credentials: true
ref: ${{ env.UPSTREAM_BRANCH}}
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
- uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- name: Setup git
run: |
git config --global user.name typeshedbot
@@ -155,7 +155,7 @@ jobs:
with:
persist-credentials: true
ref: ${{ env.UPSTREAM_BRANCH}}
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
- uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- name: Setup git
run: |
git config --global user.name typeshedbot

View File

@@ -33,7 +33,7 @@ jobs:
persist-credentials: false
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
with:

View File

@@ -29,7 +29,7 @@ jobs:
persist-credentials: false
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
with:

View File

@@ -54,6 +54,9 @@ jobs:
- name: Compute diagnostic diff
shell: bash
env:
# TODO: Remove this once we fixed the remaining panics in the conformance suite.
TY_MAX_PARALLELISM: 1
run: |
RUFF_DIR="$GITHUB_WORKSPACE/ruff"
@@ -63,15 +66,15 @@ jobs:
echo "new commit"
git rev-list --format=%s --max-count=1 "$GITHUB_SHA"
cargo build --release --bin ty
mv target/release/ty ty-new
cargo build --bin ty
mv target/debug/ty ty-new
MERGE_BASE="$(git merge-base "$GITHUB_SHA" "origin/$GITHUB_BASE_REF")"
git checkout -b old_commit "$MERGE_BASE"
echo "old commit (merge base)"
git rev-list --format=%s --max-count=1 old_commit
cargo build --release --bin ty
mv target/release/ty ty-old
cargo build --bin ty
mv target/debug/ty ty-old
)
(

View File

@@ -1,5 +1,56 @@
# Changelog
## 0.12.11
### Preview features
- \[`airflow`\] Extend `AIR311` and `AIR312` rules ([#20082](https://github.com/astral-sh/ruff/pull/20082))
- \[`airflow`\] Replace wrong path `airflow.io.storage` with `airflow.io.store` (`AIR311`) ([#20081](https://github.com/astral-sh/ruff/pull/20081))
- \[`flake8-async`\] Implement `blocking-http-call-httpx-in-async-function` (`ASYNC212`) ([#20091](https://github.com/astral-sh/ruff/pull/20091))
- \[`flake8-logging-format`\] Add auto-fix for f-string logging calls (`G004`) ([#19303](https://github.com/astral-sh/ruff/pull/19303))
- \[`flake8-use-pathlib`\] Add autofix for `PTH211` ([#20009](https://github.com/astral-sh/ruff/pull/20009))
- \[`flake8-use-pathlib`\] Make `PTH100` fix unsafe because it can change behavior ([#20100](https://github.com/astral-sh/ruff/pull/20100))
### Bug fixes
- \[`pyflakes`, `pylint`\] Fix false positives caused by `__class__` cell handling (`F841`, `PLE0117`) ([#20048](https://github.com/astral-sh/ruff/pull/20048))
- \[`pyflakes`\] Fix `allowed-unused-imports` matching for top-level modules (`F401`) ([#20115](https://github.com/astral-sh/ruff/pull/20115))
- \[`ruff`\] Fix false positive for t-strings in `default-factory-kwarg` (`RUF026`) ([#20032](https://github.com/astral-sh/ruff/pull/20032))
- \[`ruff`\] Preserve relative whitespace in multi-line expressions (`RUF033`) ([#19647](https://github.com/astral-sh/ruff/pull/19647))
### Rule changes
- \[`ruff`\] Handle empty t-strings in `unnecessary-empty-iterable-within-deque-call` (`RUF037`) ([#20045](https://github.com/astral-sh/ruff/pull/20045))
### Documentation
- Fix incorrect `D413` links in docstrings convention FAQ ([#20089](https://github.com/astral-sh/ruff/pull/20089))
- \[`flake8-use-pathlib`\] Update links to the table showing the correspondence between `os` and `pathlib` ([#20103](https://github.com/astral-sh/ruff/pull/20103))
## 0.12.10
### Preview features
- \[`flake8-simplify`\] Implement fix for `maxsplit` without separator (`SIM905`) ([#19851](https://github.com/astral-sh/ruff/pull/19851))
- \[`flake8-use-pathlib`\] Add fixes for `PTH102` and `PTH103` ([#19514](https://github.com/astral-sh/ruff/pull/19514))
### Bug fixes
- \[`isort`\] Handle multiple continuation lines after module docstring (`I002`) ([#19818](https://github.com/astral-sh/ruff/pull/19818))
- \[`pyupgrade`\] Avoid reporting `__future__` features as unnecessary when they are used (`UP010`) ([#19769](https://github.com/astral-sh/ruff/pull/19769))
- \[`pyupgrade`\] Handle nested `Optional`s (`UP045`) ([#19770](https://github.com/astral-sh/ruff/pull/19770))
### Rule changes
- \[`pycodestyle`\] Make `E731` fix unsafe instead of display-only for class assignments ([#19700](https://github.com/astral-sh/ruff/pull/19700))
- \[`pyflakes`\] Add secondary annotation showing previous definition (`F811`) ([#19900](https://github.com/astral-sh/ruff/pull/19900))
### Documentation
- Fix description of global config file discovery strategy ([#19188](https://github.com/astral-sh/ruff/pull/19188))
- Update outdated links to <https://typing.python.org/en/latest/source/stubs.html> ([#19992](https://github.com/astral-sh/ruff/pull/19992))
- \[`flake8-annotations`\] Remove unused import in example (`ANN401`) ([#20000](https://github.com/astral-sh/ruff/pull/20000))
## 0.12.9
### Preview features
@@ -24,8 +75,31 @@
### Other changes
- Build `riscv64` binaries for release ([#19819](https://github.com/astral-sh/ruff/pull/19819))
- Add rule code to error description in GitLab output ([#19896](https://github.com/astral-sh/ruff/pull/19896))
- Improve rendering of the `full` output format ([#19415](https://github.com/astral-sh/ruff/pull/19415))
Below is an example diff for [`F401`](https://docs.astral.sh/ruff/rules/unused-import/):
```diff
-unused.py:8:19: F401 [*] `pathlib` imported but unused
+F401 [*] `pathlib` imported but unused
+ --> unused.py:8:19
|
7 | # Unused, _not_ marked as required (due to the alias).
8 | import pathlib as non_alias
- | ^^^^^^^^^ F401
+ | ^^^^^^^^^
9 |
10 | # Unused, marked as required.
|
- = help: Remove unused import: `pathlib`
+help: Remove unused import: `pathlib`
```
For now, the primary difference is the movement of the filename, line number, and column information to a second line in the header. This new representation will allow us to make further additions to Ruff's diagnostics, such as adding sub-diagnostics and multiple annotations to the same snippet.
## 0.12.8
### Preview features

209
Cargo.lock generated
View File

@@ -128,9 +128,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.98"
version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
[[package]]
name = "approx"
@@ -257,9 +257,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.9.1"
version = "2.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d"
[[package]]
name = "bitvec"
@@ -295,7 +295,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4"
dependencies = [
"memchr",
"regex-automata 0.4.9",
"regex-automata 0.4.10",
"serde",
]
@@ -322,9 +322,9 @@ dependencies = [
[[package]]
name = "camino"
version = "1.1.11"
version = "1.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d07aa9a93b00c76f71bc35d598bed923f6d4f3a9ca5c24b7737ae1a292841c0"
checksum = "dd0b03af37dad7a14518b7691d81acb0f8222604ad3d1b02f6b4bed5188c0cd5"
dependencies = [
"serde",
]
@@ -408,9 +408,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.43"
version = "4.5.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50fd97c9dc2399518aa331917ac6f274280ec5eb34e555dd291899745c48ec6f"
checksum = "2c5e4fcf9c21d2e544ca1ee9d8552de13019a42aa7dbf32747fa7aaf1df76e57"
dependencies = [
"clap_builder",
"clap_derive",
@@ -418,9 +418,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.43"
version = "4.5.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c35b5830294e1fa0462034af85cc95225a4cb07092c088c55bda3147cfcd8f65"
checksum = "fecb53a0e6fcfb055f686001bc2e2592fa527efaf38dbe81a6a9563562e57d41"
dependencies = [
"anstream",
"anstyle",
@@ -461,9 +461,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.41"
version = "4.5.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491"
checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6"
dependencies = [
"heck",
"proc-macro2",
@@ -485,7 +485,7 @@ checksum = "85a8ab73a1c02b0c15597b22e09c7dc36e63b2f601f9d1e83ac0c3decd38b1ae"
dependencies = [
"nix 0.29.0",
"terminfo",
"thiserror 2.0.12",
"thiserror 2.0.16",
"which",
"windows-sys 0.59.0",
]
@@ -1084,14 +1084,14 @@ dependencies = [
[[package]]
name = "filetime"
version = "0.2.25"
version = "0.2.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586"
checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed"
dependencies = [
"cfg-if",
"libc",
"libredox",
"windows-sys 0.59.0",
"windows-sys 0.60.2",
]
[[package]]
@@ -1118,9 +1118,9 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
[[package]]
name = "form_urlencoded"
version = "1.2.1"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
dependencies = [
"percent-encoding",
]
@@ -1218,9 +1218,9 @@ dependencies = [
[[package]]
name = "glob"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
[[package]]
name = "globset"
@@ -1231,7 +1231,7 @@ dependencies = [
"aho-corasick",
"bstr",
"log",
"regex-automata 0.4.9",
"regex-automata 0.4.10",
"regex-syntax 0.8.5",
]
@@ -1241,7 +1241,7 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"ignore",
"walkdir",
]
@@ -1430,9 +1430,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "1.0.3"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e"
checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
dependencies = [
"idna_adapter",
"smallvec",
@@ -1459,7 +1459,7 @@ dependencies = [
"globset",
"log",
"memchr",
"regex-automata 0.4.9",
"regex-automata 0.4.10",
"same-file",
"walkdir",
"winapi-util",
@@ -1486,9 +1486,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.10.0"
version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9"
dependencies = [
"equivalent",
"hashbrown 0.15.5",
@@ -1521,7 +1521,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"inotify-sys",
"libc",
]
@@ -1764,9 +1764,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.174"
version = "0.2.175"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
[[package]]
name = "libcst"
@@ -1780,7 +1780,7 @@ dependencies = [
"paste",
"peg",
"regex",
"thiserror 2.0.12",
"thiserror 2.0.16",
]
[[package]]
@@ -1795,9 +1795,9 @@ dependencies = [
[[package]]
name = "libmimalloc-sys"
version = "0.1.43"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf88cd67e9de251c1781dbe2f641a1a3ad66eaae831b8a2c38fbdc5ddae16d4d"
checksum = "667f4fec20f29dfc6bc7357c582d91796c169ad7e2fce709468aefeb2c099870"
dependencies = [
"cc",
"libc",
@@ -1809,7 +1809,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"libc",
"redox_syscall",
]
@@ -1949,9 +1949,9 @@ dependencies = [
[[package]]
name = "mimalloc"
version = "0.1.47"
version = "0.1.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1791cbe101e95af5764f06f20f6760521f7158f69dbf9d6baf941ee1bf6bc40"
checksum = "e1ee66a4b64c74f4ef288bcbb9192ad9c3feaad75193129ac8509af543894fd8"
dependencies = [
"libmimalloc-sys",
]
@@ -2014,7 +2014,7 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"cfg-if",
"cfg_aliases",
"libc",
@@ -2026,7 +2026,7 @@ version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"cfg-if",
"cfg_aliases",
"libc",
@@ -2054,7 +2054,7 @@ version = "8.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"fsevent-sys",
"inotify",
"kqueue",
@@ -2127,9 +2127,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "ordermap"
version = "0.5.8"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d6bff06e4a5dc6416bead102d3e63c480dd852ffbb278bf8cfeb4966b329609"
checksum = "2fd6fedcd996c8c97932075cc3811d83f53280f48d5620e4e3cab7f6a12678c4"
dependencies = [
"indexmap",
"serde",
@@ -2283,9 +2283,9 @@ dependencies = [
[[package]]
name = "percent-encoding"
version = "2.3.1"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "pest"
@@ -2294,7 +2294,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323"
dependencies = [
"memchr",
"thiserror 2.0.12",
"thiserror 2.0.16",
"ucd-trie",
]
@@ -2473,9 +2473,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.96"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "beef09f85ae72cea1ef96ba6870c51e6382ebfa4f0e85b643459331f3daa5be0"
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
dependencies = [
"unicode-ident",
]
@@ -2490,7 +2490,7 @@ dependencies = [
"pep440_rs",
"pep508_rs",
"serde",
"thiserror 2.0.12",
"thiserror 2.0.16",
"toml 0.8.23",
]
@@ -2505,7 +2505,7 @@ dependencies = [
"newtype-uuid",
"quick-xml",
"strip-ansi-escapes",
"thiserror 2.0.12",
"thiserror 2.0.16",
"uuid",
]
@@ -2666,7 +2666,7 @@ version = "0.5.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
]
[[package]]
@@ -2677,18 +2677,18 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
dependencies = [
"getrandom 0.2.16",
"libredox",
"thiserror 2.0.12",
"thiserror 2.0.16",
]
[[package]]
name = "regex"
version = "1.11.1"
version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata 0.4.9",
"regex-automata 0.4.10",
"regex-syntax 0.8.5",
]
@@ -2703,9 +2703,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.9"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6"
dependencies = [
"aho-corasick",
"memchr",
@@ -2743,13 +2743,13 @@ dependencies = [
[[package]]
name = "ruff"
version = "0.12.9"
version = "0.12.11"
dependencies = [
"anyhow",
"argfile",
"assert_fs",
"bincode 2.0.1",
"bitflags 2.9.1",
"bitflags 2.9.3",
"cachedir",
"clap",
"clap_complete_command",
@@ -2793,7 +2793,7 @@ dependencies = [
"strum",
"tempfile",
"test-case",
"thiserror 2.0.12",
"thiserror 2.0.16",
"tikv-jemallocator",
"toml 0.9.5",
"tracing",
@@ -2870,6 +2870,7 @@ dependencies = [
"insta",
"matchit",
"path-slash",
"pathdiff",
"quick-junit",
"ruff_annotate_snippets",
"ruff_cache",
@@ -2886,8 +2887,9 @@ dependencies = [
"schemars",
"serde",
"serde_json",
"similar",
"tempfile",
"thiserror 2.0.12",
"thiserror 2.0.16",
"tracing",
"tracing-subscriber",
"ty_static",
@@ -2934,6 +2936,7 @@ dependencies = [
"tracing-subscriber",
"ty",
"ty_project",
"ty_python_semantic",
"ty_static",
"url",
]
@@ -2996,11 +2999,11 @@ dependencies = [
[[package]]
name = "ruff_linter"
version = "0.12.9"
version = "0.12.11"
dependencies = [
"aho-corasick",
"anyhow",
"bitflags 2.9.1",
"bitflags 2.9.3",
"clap",
"colored 3.0.0",
"fern",
@@ -3018,7 +3021,6 @@ dependencies = [
"memchr",
"natord",
"path-absolutize",
"pathdiff",
"pep440_rs",
"pyproject-toml",
"regex",
@@ -3047,7 +3049,7 @@ dependencies = [
"strum_macros",
"tempfile",
"test-case",
"thiserror 2.0.12",
"thiserror 2.0.16",
"toml 0.9.5",
"typed-arena",
"unicode-normalization",
@@ -3090,7 +3092,7 @@ dependencies = [
"serde_json",
"serde_with",
"test-case",
"thiserror 2.0.12",
"thiserror 2.0.16",
"uuid",
]
@@ -3106,7 +3108,7 @@ name = "ruff_python_ast"
version = "0.0.0"
dependencies = [
"aho-corasick",
"bitflags 2.9.1",
"bitflags 2.9.3",
"compact_str",
"get-size2",
"is-macro",
@@ -3121,7 +3123,7 @@ dependencies = [
"salsa",
"schemars",
"serde",
"thiserror 2.0.12",
"thiserror 2.0.16",
]
[[package]]
@@ -3175,7 +3177,7 @@ dependencies = [
"similar",
"smallvec",
"static_assertions",
"thiserror 2.0.12",
"thiserror 2.0.16",
"tracing",
]
@@ -3194,7 +3196,7 @@ dependencies = [
name = "ruff_python_literal"
version = "0.0.0"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"itertools 0.14.0",
"ruff_python_ast",
"unic-ucd-category",
@@ -3205,7 +3207,7 @@ name = "ruff_python_parser"
version = "0.0.0"
dependencies = [
"anyhow",
"bitflags 2.9.1",
"bitflags 2.9.3",
"bstr",
"compact_str",
"get-size2",
@@ -3230,7 +3232,7 @@ dependencies = [
name = "ruff_python_semantic"
version = "0.0.0"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"insta",
"is-macro",
"ruff_cache",
@@ -3251,7 +3253,7 @@ dependencies = [
name = "ruff_python_stdlib"
version = "0.0.0"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"unicode-ident",
]
@@ -3305,7 +3307,7 @@ dependencies = [
"serde",
"serde_json",
"shellexpand",
"thiserror 2.0.12",
"thiserror 2.0.16",
"toml 0.9.5",
"tracing",
"tracing-log",
@@ -3335,7 +3337,7 @@ dependencies = [
[[package]]
name = "ruff_wasm"
version = "0.12.9"
version = "0.12.11"
dependencies = [
"console_error_panic_hook",
"console_log",
@@ -3428,7 +3430,7 @@ version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"errno",
"libc",
"linux-raw-sys",
@@ -3450,7 +3452,7 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]]
name = "salsa"
version = "0.23.0"
source = "git+https://github.com/salsa-rs/salsa.git?rev=918d35d873b2b73a0237536144ef4d22e8d57f27#918d35d873b2b73a0237536144ef4d22e8d57f27"
source = "git+https://github.com/salsa-rs/salsa.git?rev=a3ffa22cb26756473d56f867aedec3fd907c4dd9#a3ffa22cb26756473d56f867aedec3fd907c4dd9"
dependencies = [
"boxcar",
"compact_str",
@@ -3474,12 +3476,12 @@ dependencies = [
[[package]]
name = "salsa-macro-rules"
version = "0.23.0"
source = "git+https://github.com/salsa-rs/salsa.git?rev=918d35d873b2b73a0237536144ef4d22e8d57f27#918d35d873b2b73a0237536144ef4d22e8d57f27"
source = "git+https://github.com/salsa-rs/salsa.git?rev=a3ffa22cb26756473d56f867aedec3fd907c4dd9#a3ffa22cb26756473d56f867aedec3fd907c4dd9"
[[package]]
name = "salsa-macros"
version = "0.23.0"
source = "git+https://github.com/salsa-rs/salsa.git?rev=918d35d873b2b73a0237536144ef4d22e8d57f27#918d35d873b2b73a0237536144ef4d22e8d57f27"
source = "git+https://github.com/salsa-rs/salsa.git?rev=a3ffa22cb26756473d56f867aedec3fd907c4dd9#a3ffa22cb26756473d56f867aedec3fd907c4dd9"
dependencies = [
"proc-macro2",
"quote",
@@ -3576,9 +3578,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.142"
version = "1.0.143"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7"
checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a"
dependencies = [
"itoa",
"memchr",
@@ -3789,9 +3791,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.104"
version = "2.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
dependencies = [
"proc-macro2",
"quote",
@@ -3915,11 +3917,11 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.12"
version = "2.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"
dependencies = [
"thiserror-impl 2.0.12",
"thiserror-impl 2.0.16",
]
[[package]]
@@ -3935,9 +3937,9 @@ dependencies = [
[[package]]
name = "thiserror-impl"
version = "2.0.12"
version = "2.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"
dependencies = [
"proc-macro2",
"quote",
@@ -4136,9 +4138,9 @@ dependencies = [
[[package]]
name = "tracing-indicatif"
version = "0.3.12"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1983afead46ff13a3c93581e0cec31d20b29efdd22cbdaa8b9f850eccf2c352"
checksum = "04d4e11e0e27acef25a47f27e9435355fecdc488867fa2bc90e75b0700d2823d"
dependencies = [
"indicatif",
"tracing",
@@ -4238,17 +4240,22 @@ dependencies = [
name = "ty_ide"
version = "0.0.0"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
"get-size2",
"insta",
"itertools 0.14.0",
"rayon",
"regex",
"ruff_db",
"ruff_index",
"ruff_memory_usage",
"ruff_python_ast",
"ruff_python_parser",
"ruff_python_trivia",
"ruff_source_file",
"ruff_text_size",
"rustc-hash",
"salsa",
"smallvec",
"tracing",
"ty_project",
@@ -4271,7 +4278,7 @@ dependencies = [
"pep440_rs",
"rayon",
"regex",
"regex-automata 0.4.9",
"regex-automata 0.4.10",
"ruff_cache",
"ruff_db",
"ruff_macros",
@@ -4284,7 +4291,7 @@ dependencies = [
"salsa",
"schemars",
"serde",
"thiserror 2.0.12",
"thiserror 2.0.16",
"toml 0.9.5",
"tracing",
"ty_combine",
@@ -4297,7 +4304,7 @@ name = "ty_python_semantic"
version = "0.0.0"
dependencies = [
"anyhow",
"bitflags 2.9.1",
"bitflags 2.9.3",
"bitvec",
"camino",
"colored 3.0.0",
@@ -4337,7 +4344,7 @@ dependencies = [
"strum_macros",
"tempfile",
"test-case",
"thiserror 2.0.12",
"thiserror 2.0.16",
"tracing",
"ty_python_semantic",
"ty_static",
@@ -4350,7 +4357,7 @@ name = "ty_server"
version = "0.0.0"
dependencies = [
"anyhow",
"bitflags 2.9.1",
"bitflags 2.9.3",
"crossbeam",
"dunce",
"insta",
@@ -4371,7 +4378,7 @@ dependencies = [
"serde_json",
"shellexpand",
"tempfile",
"thiserror 2.0.12",
"thiserror 2.0.16",
"tracing",
"tracing-subscriber",
"ty_combine",
@@ -4393,7 +4400,7 @@ name = "ty_test"
version = "0.0.0"
dependencies = [
"anyhow",
"bitflags 2.9.1",
"bitflags 2.9.3",
"camino",
"colored 3.0.0",
"insta",
@@ -4412,7 +4419,7 @@ dependencies = [
"serde",
"smallvec",
"tempfile",
"thiserror 2.0.12",
"thiserror 2.0.16",
"toml 0.9.5",
"tracing",
"ty_python_semantic",
@@ -4589,9 +4596,9 @@ checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae"
[[package]]
name = "url"
version = "2.5.4"
version = "2.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
dependencies = [
"form_urlencoded",
"idna",
@@ -5143,7 +5150,7 @@ version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
dependencies = [
"bitflags 2.9.1",
"bitflags 2.9.3",
]
[[package]]

View File

@@ -5,7 +5,7 @@ resolver = "2"
[workspace.package]
# Please update rustfmt.toml when bumping the Rust edition
edition = "2024"
rust-version = "1.86"
rust-version = "1.87"
homepage = "https://docs.astral.sh/ruff"
documentation = "https://docs.astral.sh/ruff"
repository = "https://github.com/astral-sh/ruff"
@@ -143,7 +143,7 @@ regex-automata = { version = "0.4.9" }
rustc-hash = { version = "2.0.0" }
rustc-stable-hash = { version = "0.1.2" }
# When updating salsa, make sure to also update the revision in `fuzz/Cargo.toml`
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "918d35d873b2b73a0237536144ef4d22e8d57f27", default-features = false, features = [
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "a3ffa22cb26756473d56f867aedec3fd907c4dd9", default-features = false, features = [
"compact_str",
"macros",
"salsa_unstable",
@@ -215,6 +215,8 @@ unexpected_cfgs = { level = "warn", check-cfg = [
[workspace.lints.clippy]
pedantic = { level = "warn", priority = -2 }
# Enabled at the crate level
disallowed_methods = "allow"
# Allowed pedantic lints
char_lit_as_u8 = "allow"
collapsible_else_if = "allow"
@@ -253,6 +255,7 @@ unused_peekable = "warn"
# Diagnostics are not actionable: Enable once https://github.com/rust-lang/rust-clippy/issues/13774 is resolved.
large_stack_arrays = "allow"
[profile.release]
# Note that we set these explicitly, and these values
# were chosen based on a trade-off between compile times

View File

@@ -148,8 +148,8 @@ curl -LsSf https://astral.sh/ruff/install.sh | sh
powershell -c "irm https://astral.sh/ruff/install.ps1 | iex"
# For a specific version.
curl -LsSf https://astral.sh/ruff/0.12.9/install.sh | sh
powershell -c "irm https://astral.sh/ruff/0.12.9/install.ps1 | iex"
curl -LsSf https://astral.sh/ruff/0.12.11/install.sh | sh
powershell -c "irm https://astral.sh/ruff/0.12.11/install.ps1 | iex"
```
You can also install Ruff via [Homebrew](https://formulae.brew.sh/formula/ruff), [Conda](https://anaconda.org/conda-forge/ruff),
@@ -182,7 +182,7 @@ Ruff can also be used as a [pre-commit](https://pre-commit.com/) hook via [`ruff
```yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.12.9
rev: v0.12.11
hooks:
# Run the linter.
- id: ruff-check

View File

@@ -24,3 +24,20 @@ ignore-interior-mutability = [
# The expression is read-only.
"ruff_python_ast::hashable::HashableExpr",
]
disallowed-methods = [
{ path = "std::env::var", reason = "Use System::env_var instead in ty crates" },
{ path = "std::env::current_dir", reason = "Use System::current_directory instead in ty crates" },
{ path = "std::fs::read_to_string", reason = "Use System::read_to_string instead in ty crates" },
{ path = "std::fs::metadata", reason = "Use System::path_metadata instead in ty crates" },
{ path = "std::fs::canonicalize", reason = "Use System::canonicalize_path instead in ty crates" },
{ path = "dunce::canonicalize", reason = "Use System::canonicalize_path instead in ty crates" },
{ path = "std::fs::read_dir", reason = "Use System::read_directory instead in ty crates" },
{ path = "std::fs::write", reason = "Use WritableSystem::write_file instead in ty crates" },
{ path = "std::fs::create_dir_all", reason = "Use WritableSystem::create_directory_all instead in ty crates" },
{ path = "std::fs::File::create_new", reason = "Use WritableSystem::create_new_file instead in ty crates" },
# Path methods that have System trait equivalents
{ path = "std::path::Path::exists", reason = "Use System::path_exists instead in ty crates" },
{ path = "std::path::Path::is_dir", reason = "Use System::is_directory instead in ty crates" },
{ path = "std::path::Path::is_file", reason = "Use System::is_file instead in ty crates" },
]

View File

@@ -1,6 +1,6 @@
[package]
name = "ruff"
version = "0.12.9"
version = "0.12.11"
publish = true
authors = { workspace = true }
edition = { workspace = true }

View File

@@ -15,8 +15,7 @@ use ruff_db::diagnostic::{
use ruff_linter::fs::relativize_path;
use ruff_linter::logging::LogLevel;
use ruff_linter::message::{
Emitter, EmitterContext, GithubEmitter, GitlabEmitter, GroupedEmitter, SarifEmitter,
TextEmitter,
Emitter, EmitterContext, GithubEmitter, GroupedEmitter, SarifEmitter, TextEmitter,
};
use ruff_linter::notify_user;
use ruff_linter::settings::flags::{self};
@@ -31,8 +30,6 @@ bitflags! {
const SHOW_VIOLATIONS = 1 << 0;
/// Whether to show a summary of the fixed violations when emitting diagnostics.
const SHOW_FIX_SUMMARY = 1 << 1;
/// Whether to show a diff of each fixed violation when emitting diagnostics.
const SHOW_FIX_DIFF = 1 << 2;
}
}
@@ -261,9 +258,9 @@ impl Printer {
OutputFormat::Concise | OutputFormat::Full => {
TextEmitter::default()
.with_show_fix_status(show_fix_status(self.fix_mode, fixables.as_ref()))
.with_show_fix_diff(self.flags.intersects(Flags::SHOW_FIX_DIFF))
.with_show_fix_diff(self.format == OutputFormat::Full && preview)
.with_show_source(self.format == OutputFormat::Full)
.with_unsafe_fixes(self.unsafe_fixes)
.with_fix_applicability(self.unsafe_fixes.required_applicability())
.with_preview(preview)
.emit(writer, &diagnostics.inner, &context)?;
@@ -296,7 +293,11 @@ impl Printer {
GithubEmitter.emit(writer, &diagnostics.inner, &context)?;
}
OutputFormat::Gitlab => {
GitlabEmitter::default().emit(writer, &diagnostics.inner, &context)?;
let config = DisplayDiagnosticConfig::default()
.format(DiagnosticFormat::Gitlab)
.preview(preview);
let value = DisplayDiagnostics::new(&context, &config, &diagnostics.inner);
write!(writer, "{value}")?;
}
OutputFormat::Pylint => {
let config = DisplayDiagnosticConfig::default()
@@ -461,7 +462,7 @@ impl Printer {
TextEmitter::default()
.with_show_fix_status(show_fix_status(self.fix_mode, fixables.as_ref()))
.with_show_source(preview)
.with_unsafe_fixes(self.unsafe_fixes)
.with_fix_applicability(self.unsafe_fixes.required_applicability())
.emit(writer, &diagnostics.inner, &context)?;
}
writer.flush()?;

View File

@@ -5801,3 +5801,62 @@ fn future_annotations_preview_warning() {
",
);
}
#[test]
fn up045_nested_optional_flatten_all() {
let contents = "\
from typing import Optional
nested_optional: Optional[Optional[Optional[str]]] = None
";
assert_cmd_snapshot!(
Command::new(get_cargo_bin(BIN_NAME))
.args(STDIN_BASE_OPTIONS)
.args(["--select", "UP045", "--diff", "--target-version", "py312"])
.arg("-")
.pass_stdin(contents),
@r"
success: false
exit_code: 1
----- stdout -----
@@ -1,2 +1,2 @@
from typing import Optional
-nested_optional: Optional[Optional[Optional[str]]] = None
+nested_optional: str | None = None
----- stderr -----
Would fix 1 error.
",
);
}
#[test]
fn show_fixes_in_full_output_with_preview_enabled() {
assert_cmd_snapshot!(
Command::new(get_cargo_bin(BIN_NAME))
.args(["check", "--no-cache", "--output-format", "full"])
.args(["--select", "F401"])
.arg("--preview")
.arg("-")
.pass_stdin("import math"),
@r"
success: false
exit_code: 1
----- stdout -----
F401 [*] `math` imported but unused
--> -:1:8
|
1 | import math
| ^^^^
|
help: Remove unused import: `math`
- import math
Found 1 error.
[*] 1 fixable with the `--fix` option.
----- stderr -----
",
);
}

View File

@@ -20,59 +20,59 @@ exit_code: 1
{
"check_name": "F401",
"description": "F401: `os` imported but unused",
"severity": "major",
"fingerprint": "4dbad37161e65c72",
"location": {
"path": "input.py",
"positions": {
"begin": {
"column": 8,
"line": 1
"line": 1,
"column": 8
},
"end": {
"column": 10,
"line": 1
"line": 1,
"column": 10
}
}
},
"severity": "major"
}
},
{
"check_name": "F821",
"description": "F821: Undefined name `y`",
"severity": "major",
"fingerprint": "7af59862a085230",
"location": {
"path": "input.py",
"positions": {
"begin": {
"column": 5,
"line": 2
"line": 2,
"column": 5
},
"end": {
"column": 6,
"line": 2
"line": 2,
"column": 6
}
}
},
"severity": "major"
}
},
{
"check_name": "invalid-syntax",
"description": "invalid-syntax: Cannot use `match` statement on Python 3.9 (syntax was added in Python 3.10)",
"severity": "major",
"fingerprint": "e558cec859bb66e8",
"location": {
"path": "input.py",
"positions": {
"begin": {
"column": 1,
"line": 3
"line": 3,
"column": 1
},
"end": {
"column": 6,
"line": 3
"line": 3,
"column": 6
}
}
},
"severity": "major"
}
}
]
----- stderr -----

View File

@@ -450,9 +450,6 @@ fn benchmark_complex_constrained_attributes_2(criterion: &mut Criterion) {
r#"
class C:
def f(self: "C"):
self.a = ""
self.b = ""
if isinstance(self.a, str):
return
@@ -466,6 +463,56 @@ fn benchmark_complex_constrained_attributes_2(criterion: &mut Criterion) {
return
if isinstance(self.b, str):
return
if isinstance(self.b, str):
return
if isinstance(self.b, str):
return
self.a = ""
self.b = ""
"#,
)
},
|case| {
let Case { db, .. } = case;
let result = db.check();
assert_eq!(result.len(), 0);
},
BatchSize::SmallInput,
);
});
}
fn benchmark_complex_constrained_attributes_3(criterion: &mut Criterion) {
setup_rayon();
criterion.bench_function("ty_micro[complex_constrained_attributes_3]", |b| {
b.iter_batched_ref(
|| {
// This is a regression test for https://github.com/astral-sh/ty/issues/758
setup_micro_case(
r#"
class GridOut:
def __init__(self: "GridOut") -> None:
self._buffer = b""
def _read_size_or_line(self: "GridOut", size: int = -1):
if size > self._position:
size = self._position
pass
if size == 0:
return bytes()
while size > 0:
if self._buffer:
buf = self._buffer
self._buffer = b""
else:
buf = b""
if len(buf) > size:
self._buffer = buf
self._position -= len(self._buffer)
"#,
)
},
@@ -668,6 +715,7 @@ criterion_group!(
benchmark_tuple_implicit_instance_attributes,
benchmark_complex_constrained_attributes_1,
benchmark_complex_constrained_attributes_2,
benchmark_complex_constrained_attributes_3,
benchmark_many_enum_members,
);
criterion_group!(project, anyio, attrs, hydra, datetype);

View File

@@ -34,12 +34,14 @@ glob = { workspace = true }
ignore = { workspace = true, optional = true }
matchit = { workspace = true }
path-slash = { workspace = true }
pathdiff = { workspace = true }
quick-junit = { workspace = true, optional = true }
rustc-hash = { workspace = true }
salsa = { workspace = true }
schemars = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
serde_json = { workspace = true, optional = true }
similar = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, optional = true }
@@ -52,7 +54,7 @@ web-time = { version = "1.1.0" }
etcetera = { workspace = true, optional = true }
[dev-dependencies]
insta = { workspace = true }
insta = { workspace = true, features = ["filters"] }
tempfile = { workspace = true }
[features]

View File

@@ -325,6 +325,11 @@ impl Diagnostic {
self.inner.fix.as_ref()
}
#[cfg(test)]
pub(crate) fn fix_mut(&mut self) -> Option<&mut Fix> {
Arc::make_mut(&mut self.inner).fix.as_mut()
}
/// Set the fix for this diagnostic.
pub fn set_fix(&mut self, fix: Fix) {
debug_assert!(
@@ -344,6 +349,13 @@ impl Diagnostic {
self.fix().is_some()
}
/// Returns `true` if the diagnostic is [`fixable`](Diagnostic::fixable) and applies at the
/// configured applicability level.
pub fn has_applicable_fix(&self, config: &DisplayDiagnosticConfig) -> bool {
self.fix()
.is_some_and(|fix| fix.applies(config.fix_applicability))
}
/// Returns the offset of the parent statement for this diagnostic if it exists.
///
/// This is primarily used for checking noqa/secondary code suppressions.
@@ -1294,6 +1306,10 @@ pub struct DisplayDiagnosticConfig {
hide_severity: bool,
/// Whether to show the availability of a fix in a diagnostic.
show_fix_status: bool,
/// Whether to show the diff for an available fix after the main diagnostic.
///
/// This currently only applies to `DiagnosticFormat::Full`.
show_fix_diff: bool,
/// The lowest applicability that should be shown when reporting diagnostics.
fix_applicability: Applicability,
}
@@ -1341,6 +1357,14 @@ impl DisplayDiagnosticConfig {
}
}
/// Whether to show a diff for an available fix after the main diagnostic.
pub fn show_fix_diff(self, yes: bool) -> DisplayDiagnosticConfig {
DisplayDiagnosticConfig {
show_fix_diff: yes,
..self
}
}
/// Set the lowest fix applicability that should be shown.
///
/// In other words, an applicability of `Safe` (the default) would suppress showing fixes or fix
@@ -1364,6 +1388,7 @@ impl Default for DisplayDiagnosticConfig {
preview: false,
hide_severity: false,
show_fix_status: false,
show_fix_diff: false,
fix_applicability: Applicability::Safe,
}
}
@@ -1417,6 +1442,11 @@ pub enum DiagnosticFormat {
/// Print diagnostics in the format expected by JUnit.
#[cfg(feature = "junit")]
Junit,
/// Print diagnostics in the JSON format used by GitLab [Code Quality] reports.
///
/// [Code Quality]: https://docs.gitlab.com/ee/ci/testing/code_quality.html#implement-a-custom-tool
#[cfg(feature = "serde")]
Gitlab,
}
/// A representation of the kinds of messages inside a diagnostic.

View File

@@ -31,6 +31,8 @@ mod azure;
mod concise;
mod full;
#[cfg(feature = "serde")]
mod gitlab;
#[cfg(feature = "serde")]
mod json;
#[cfg(feature = "serde")]
mod json_lines;
@@ -136,6 +138,10 @@ impl std::fmt::Display for DisplayDiagnostics<'_> {
DiagnosticFormat::Junit => {
junit::JunitRenderer::new(self.resolver).render(f, self.diagnostics)?;
}
#[cfg(feature = "serde")]
DiagnosticFormat::Gitlab => {
gitlab::GitlabRenderer::new(self.resolver).render(f, self.diagnostics)?;
}
}
Ok(())
@@ -248,9 +254,7 @@ impl<'a> ResolvedDiagnostic<'a> {
id,
message: diag.inner.message.as_str().to_string(),
annotations,
is_fixable: diag
.fix()
.is_some_and(|fix| fix.applies(config.fix_applicability)),
is_fixable: diag.has_applicable_fix(config),
}
}
@@ -2622,6 +2626,13 @@ watermelon
self.config = config;
}
/// Show a diff for the fix when rendering.
pub(super) fn show_fix_diff(&mut self, yes: bool) {
let mut config = std::mem::take(&mut self.config);
config = config.show_fix_diff(yes);
self.config = config;
}
/// The lowest fix applicability to show when rendering.
pub(super) fn fix_applicability(&mut self, applicability: Applicability) {
let mut config = std::mem::take(&mut self.config);

View File

@@ -77,11 +77,9 @@ impl<'a> ConciseRenderer<'a> {
)?;
}
if self.config.show_fix_status {
if let Some(fix) = diag.fix() {
// Do not display an indicator for inapplicable fixes
if fix.applies(self.config.fix_applicability) {
write!(f, "[{fix}] ", fix = fmt_styled("*", stylesheet.separator))?;
}
// Do not display an indicator for inapplicable fixes
if diag.has_applicable_fix(self.config) {
write!(f, "[{fix}] ", fix = fmt_styled("*", stylesheet.separator))?;
}
}
} else {

View File

@@ -1,7 +1,17 @@
use std::borrow::Cow;
use std::num::NonZeroUsize;
use similar::{ChangeTag, TextDiff};
use ruff_annotate_snippets::Renderer as AnnotateRenderer;
use ruff_diagnostics::{Applicability, Fix};
use ruff_notebook::NotebookIndex;
use ruff_source_file::OneIndexed;
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
use crate::diagnostic::render::{FileResolver, Resolved};
use crate::diagnostic::{Diagnostic, DisplayDiagnosticConfig, stylesheet::DiagnosticStylesheet};
use crate::diagnostic::stylesheet::{DiagnosticStylesheet, fmt_styled};
use crate::diagnostic::{Diagnostic, DiagnosticSource, DisplayDiagnosticConfig};
pub(super) struct FullRenderer<'a> {
resolver: &'a dyn FileResolver,
@@ -47,6 +57,13 @@ impl<'a> FullRenderer<'a> {
for diag in renderable.diagnostics.iter() {
writeln!(f, "{}", renderer.render(diag.to_annotate()))?;
}
if self.config.show_fix_diff && diag.has_applicable_fix(self.config) {
if let Some(diff) = Diff::from_diagnostic(diag, &stylesheet, self.resolver) {
write!(f, "{diff}")?;
}
}
writeln!(f)?;
}
@@ -54,9 +71,227 @@ impl<'a> FullRenderer<'a> {
}
}
/// Renders a diff that shows the code fixes.
///
/// The implementation isn't fully fledged out and only used by tests. Before using in production, try
/// * Improve layout
/// * Replace tabs with spaces for a consistent experience across terminals
/// * Replace zero-width whitespaces
/// * Print a simpler diff if only a single line has changed
/// * Compute the diff from the `Edit` because diff calculation is expensive.
struct Diff<'a> {
fix: &'a Fix,
diagnostic_source: DiagnosticSource,
notebook_index: Option<NotebookIndex>,
stylesheet: &'a DiagnosticStylesheet,
}
impl<'a> Diff<'a> {
fn from_diagnostic(
diagnostic: &'a Diagnostic,
stylesheet: &'a DiagnosticStylesheet,
resolver: &'a dyn FileResolver,
) -> Option<Diff<'a>> {
let file = &diagnostic.primary_span_ref()?.file;
Some(Diff {
fix: diagnostic.fix()?,
diagnostic_source: file.diagnostic_source(resolver),
notebook_index: resolver.notebook_index(file),
stylesheet,
})
}
}
impl std::fmt::Display for Diff<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let source_code = self.diagnostic_source.as_source_code();
let source_text = source_code.text();
// Partition the source code into end offsets for each cell. If `self.notebook_index` is
// `None`, indicating a regular script file, all the lines will be in one "cell" under the
// `None` key.
let cells = if let Some(notebook_index) = &self.notebook_index {
let mut last_cell = OneIndexed::MIN;
let mut cells: Vec<(Option<OneIndexed>, TextSize)> = Vec::new();
for (row, cell) in notebook_index.iter() {
if cell != last_cell {
let offset = source_code.line_start(row);
cells.push((Some(last_cell), offset));
last_cell = cell;
}
}
cells.push((Some(last_cell), source_text.text_len()));
cells
} else {
vec![(None, source_text.text_len())]
};
let mut last_end = TextSize::ZERO;
for (cell, offset) in cells {
let range = TextRange::new(last_end, offset);
last_end = offset;
let input = source_code.slice(range);
let mut output = String::with_capacity(input.len());
let mut last_end = range.start();
let mut applied = 0;
for edit in self.fix.edits() {
if range.contains_range(edit.range()) {
output.push_str(source_code.slice(TextRange::new(last_end, edit.start())));
output.push_str(edit.content().unwrap_or_default());
last_end = edit.end();
applied += 1;
}
}
// No edits were applied, so there's no need to diff.
if applied == 0 {
continue;
}
output.push_str(&source_text[usize::from(last_end)..usize::from(range.end())]);
let diff = TextDiff::from_lines(input, &output);
let grouped_ops = diff.grouped_ops(3);
// Find the new line number with the largest number of digits to align all of the line
// number separators.
let last_op = grouped_ops.last().and_then(|group| group.last());
let largest_new = last_op.map(|op| op.new_range().end).unwrap_or_default();
let digit_with = OneIndexed::new(largest_new).unwrap_or_default().digits();
if let Some(cell) = cell {
// Room for 1 digit, 1 space, 1 `|`, and 1 more following space. This centers the
// three colons on the pipe.
writeln!(f, "{:>1$} cell {cell}", ":::", digit_with.get() + 3)?;
}
for (idx, group) in grouped_ops.iter().enumerate() {
if idx > 0 {
writeln!(f, "{:-^1$}", "-", 80)?;
}
for op in group {
for change in diff.iter_inline_changes(op) {
let (sign, style, line_no_style, index) = match change.tag() {
ChangeTag::Delete => (
"-",
self.stylesheet.deletion,
self.stylesheet.deletion_line_no,
None,
),
ChangeTag::Insert => (
"+",
self.stylesheet.insertion,
self.stylesheet.insertion_line_no,
change.new_index(),
),
ChangeTag::Equal => (
"|",
self.stylesheet.none,
self.stylesheet.line_no,
change.new_index(),
),
};
let line = Line {
index: index.map(OneIndexed::from_zero_indexed),
width: digit_with,
};
write!(
f,
"{line} {sign} ",
line = fmt_styled(line, self.stylesheet.line_no),
sign = fmt_styled(sign, line_no_style),
)?;
for (emphasized, value) in change.iter_strings_lossy() {
let value = show_nonprinting(&value);
let styled = fmt_styled(value, style);
if emphasized {
write!(f, "{}", fmt_styled(styled, self.stylesheet.emphasis))?;
} else {
write!(f, "{styled}")?;
}
}
if change.missing_newline() {
writeln!(f)?;
}
}
}
}
}
match self.fix.applicability() {
Applicability::Safe => {}
Applicability::Unsafe => {
writeln!(
f,
"{note}: {msg}",
note = fmt_styled("note", self.stylesheet.warning),
msg = fmt_styled(
"This is an unsafe fix and may change runtime behavior",
self.stylesheet.emphasis
)
)?;
}
Applicability::DisplayOnly => {
// Note that this is still only used in tests. There's no `--display-only-fixes`
// analog to `--unsafe-fixes` for users to activate this or see the styling.
writeln!(
f,
"{note}: {msg}",
note = fmt_styled("note", self.stylesheet.error),
msg = fmt_styled(
"This is a display-only fix and is likely to be incorrect",
self.stylesheet.emphasis
)
)?;
}
}
Ok(())
}
}
struct Line {
index: Option<OneIndexed>,
width: NonZeroUsize,
}
impl std::fmt::Display for Line {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self.index {
None => {
for _ in 0..self.width.get() {
f.write_str(" ")?;
}
Ok(())
}
Some(idx) => write!(f, "{:<width$}", idx, width = self.width.get()),
}
}
}
fn show_nonprinting(s: &str) -> Cow<'_, str> {
if s.find(['\x07', '\x08', '\x1b', '\x7f']).is_some() {
Cow::Owned(
s.replace('\x07', "")
.replace('\x08', "")
.replace('\x1b', "")
.replace('\x7f', ""),
)
} else {
Cow::Borrowed(s)
}
}
#[cfg(test)]
mod tests {
use ruff_diagnostics::Applicability;
use ruff_diagnostics::{Applicability, Edit, Fix};
use ruff_text_size::{TextLen, TextRange, TextSize};
use crate::diagnostic::{
@@ -457,6 +692,104 @@ print()
");
}
/// Test that we remap notebook cell line numbers in the diff as well as the main diagnostic.
#[test]
fn notebook_output_with_diff() {
let (mut env, diagnostics) = create_notebook_diagnostics(DiagnosticFormat::Full);
env.show_fix_diff(true);
env.fix_applicability(Applicability::DisplayOnly);
insta::assert_snapshot!(env.render_diagnostics(&diagnostics), @r"
error[unused-import][*]: `os` imported but unused
--> notebook.ipynb:cell 1:2:8
|
1 | # cell 1
2 | import os
| ^^
|
help: Remove unused import: `os`
::: cell 1
1 | # cell 1
- import os
error[unused-import][*]: `math` imported but unused
--> notebook.ipynb:cell 2:2:8
|
1 | # cell 2
2 | import math
| ^^^^
3 |
4 | print('hello world')
|
help: Remove unused import: `math`
::: cell 2
1 | # cell 2
- import math
2 |
3 | print('hello world')
error[unused-variable][*]: Local variable `x` is assigned to but never used
--> notebook.ipynb:cell 3:4:5
|
2 | def foo():
3 | print()
4 | x = 1
| ^
|
help: Remove assignment to unused variable `x`
::: cell 3
1 | # cell 3
2 | def foo():
3 | print()
- x = 1
4 |
note: This is an unsafe fix and may change runtime behavior
");
}
#[test]
fn notebook_output_with_diff_spanning_cells() {
let (mut env, mut diagnostics) = create_notebook_diagnostics(DiagnosticFormat::Full);
env.show_fix_diff(true);
env.fix_applicability(Applicability::DisplayOnly);
// Move all of the edits from the later diagnostics to the first diagnostic to simulate a
// single diagnostic with edits in different cells.
let mut diagnostic = diagnostics.swap_remove(0);
let fix = diagnostic.fix_mut().unwrap();
let mut edits = fix.edits().to_vec();
for diag in diagnostics {
edits.extend_from_slice(diag.fix().unwrap().edits());
}
*fix = Fix::unsafe_edits(edits.remove(0), edits);
insta::assert_snapshot!(env.render(&diagnostic), @r"
error[unused-import][*]: `os` imported but unused
--> notebook.ipynb:cell 1:2:8
|
1 | # cell 1
2 | import os
| ^^
|
help: Remove unused import: `os`
::: cell 1
1 | # cell 1
- import os
::: cell 2
1 | # cell 2
- import math
2 |
3 | print('hello world')
::: cell 3
1 | # cell 3
2 | def foo():
3 | print()
- x = 1
4 |
note: This is an unsafe fix and may change runtime behavior
");
}
/// Carriage return (`\r`) is a valid line-ending in Python, so we should normalize this to a
/// line feed (`\n`) for rendering. Otherwise we report a single long line for this case.
#[test]
@@ -559,4 +892,74 @@ print()
|
");
}
/// Test that we handle the width calculation for the line number correctly even for context
/// lines at the end of a diff. For example, we want it to render like this:
///
/// ```
/// 8 |
/// 9 |
/// 10 |
/// ```
///
/// and not like this:
///
/// ```
/// 8 |
/// 9 |
/// 10 |
/// ```
#[test]
fn longer_line_number_end_of_context() {
let mut env = TestEnvironment::new();
let contents = "\
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
";
env.add("example.py", contents);
env.format(DiagnosticFormat::Full);
env.show_fix_diff(true);
env.fix_applicability(Applicability::DisplayOnly);
let mut diagnostic = env.err().primary("example.py", "3", "3", "label").build();
diagnostic.help("Start of diff:");
let target = "line 7";
let line9 = contents.find(target).unwrap();
let range = TextRange::at(TextSize::try_from(line9).unwrap(), target.text_len());
diagnostic.set_fix(Fix::unsafe_edit(Edit::range_replacement(
format!("fixed {target}"),
range,
)));
insta::assert_snapshot!(env.render(&diagnostic), @r"
error[test-diagnostic][*]: main diagnostic message
--> example.py:3:1
|
1 | line 1
2 | line 2
3 | line 3
| ^^^^^^ label
4 | line 4
5 | line 5
|
help: Start of diff:
4 | line 4
5 | line 5
6 | line 6
- line 7
7 + fixed line 7
8 | line 8
9 | line 9
10 | line 10
note: This is an unsafe fix and may change runtime behavior
");
}
}

View File

@@ -0,0 +1,205 @@
use std::{
collections::HashSet,
hash::{DefaultHasher, Hash, Hasher},
path::Path,
};
use ruff_source_file::LineColumn;
use serde::{Serialize, Serializer, ser::SerializeSeq};
use crate::diagnostic::{Diagnostic, Severity};
use super::FileResolver;
pub(super) struct GitlabRenderer<'a> {
resolver: &'a dyn FileResolver,
}
impl<'a> GitlabRenderer<'a> {
pub(super) fn new(resolver: &'a dyn FileResolver) -> Self {
Self { resolver }
}
}
impl GitlabRenderer<'_> {
pub(super) fn render(
&self,
f: &mut std::fmt::Formatter,
diagnostics: &[Diagnostic],
) -> std::fmt::Result {
write!(
f,
"{}",
serde_json::to_string_pretty(&SerializedMessages {
diagnostics,
resolver: self.resolver,
#[expect(
clippy::disallowed_methods,
reason = "We don't have access to a `System` here, \
and this is only intended for use by GitLab CI, \
which runs on a real `System`."
)]
project_dir: std::env::var("CI_PROJECT_DIR").ok().as_deref(),
})
.unwrap()
)
}
}
struct SerializedMessages<'a> {
diagnostics: &'a [Diagnostic],
resolver: &'a dyn FileResolver,
project_dir: Option<&'a str>,
}
impl Serialize for SerializedMessages<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut s = serializer.serialize_seq(Some(self.diagnostics.len()))?;
let mut fingerprints = HashSet::<u64>::with_capacity(self.diagnostics.len());
for diagnostic in self.diagnostics {
let location = diagnostic
.primary_span()
.map(|span| {
let file = span.file();
let positions = if self.resolver.is_notebook(file) {
// We can't give a reasonable location for the structured formats,
// so we show one that's clearly a fallback
Default::default()
} else {
let diagnostic_source = file.diagnostic_source(self.resolver);
let source_code = diagnostic_source.as_source_code();
span.range()
.map(|range| Positions {
begin: source_code.line_column(range.start()),
end: source_code.line_column(range.end()),
})
.unwrap_or_default()
};
let path = self.project_dir.as_ref().map_or_else(
|| file.relative_path(self.resolver).display().to_string(),
|project_dir| relativize_path_to(file.path(self.resolver), project_dir),
);
Location { path, positions }
})
.unwrap_or_default();
let mut message_fingerprint = fingerprint(diagnostic, &location.path, 0);
// Make sure that we do not get a fingerprint that is already in use
// by adding in the previously generated one.
while fingerprints.contains(&message_fingerprint) {
message_fingerprint = fingerprint(diagnostic, &location.path, message_fingerprint);
}
fingerprints.insert(message_fingerprint);
let description = diagnostic.body();
let check_name = diagnostic.secondary_code_or_id();
let severity = match diagnostic.severity() {
Severity::Info => "info",
Severity::Warning => "minor",
Severity::Error => "major",
// Another option here is `blocker`
Severity::Fatal => "critical",
};
let value = Message {
check_name,
// GitLab doesn't display the separate `check_name` field in a Code Quality report,
// so prepend it to the description too.
description: format!("{check_name}: {description}"),
severity,
fingerprint: format!("{:x}", message_fingerprint),
location,
};
s.serialize_element(&value)?;
}
s.end()
}
}
#[derive(Serialize)]
struct Message<'a> {
check_name: &'a str,
description: String,
severity: &'static str,
fingerprint: String,
location: Location,
}
/// The place in the source code where the issue was discovered.
///
/// According to the CodeClimate report format [specification] linked from the GitLab [docs], this
/// field is required, so we fall back on a default `path` and position if the diagnostic doesn't
/// have a primary span.
///
/// [specification]: https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types
/// [docs]: https://docs.gitlab.com/ci/testing/code_quality/#code-quality-report-format
#[derive(Default, Serialize)]
struct Location {
path: String,
positions: Positions,
}
#[derive(Default, Serialize)]
struct Positions {
begin: LineColumn,
end: LineColumn,
}
/// Generate a unique fingerprint to identify a violation.
fn fingerprint(diagnostic: &Diagnostic, project_path: &str, salt: u64) -> u64 {
let mut hasher = DefaultHasher::new();
salt.hash(&mut hasher);
diagnostic.name().hash(&mut hasher);
project_path.hash(&mut hasher);
hasher.finish()
}
/// Convert an absolute path to be relative to the specified project root.
fn relativize_path_to<P: AsRef<Path>, R: AsRef<Path>>(path: P, project_root: R) -> String {
format!(
"{}",
pathdiff::diff_paths(&path, project_root)
.expect("Could not diff paths")
.display()
)
}
#[cfg(test)]
mod tests {
use crate::diagnostic::{
DiagnosticFormat,
render::tests::{create_diagnostics, create_syntax_error_diagnostics},
};
const FINGERPRINT_FILTERS: [(&str, &str); 1] = [(
r#""fingerprint": "[a-z0-9]+","#,
r#""fingerprint": "<redacted>","#,
)];
#[test]
fn output() {
let (env, diagnostics) = create_diagnostics(DiagnosticFormat::Gitlab);
insta::with_settings!({filters => FINGERPRINT_FILTERS}, {
insta::assert_snapshot!(env.render_diagnostics(&diagnostics));
});
}
#[test]
fn syntax_errors() {
let (env, diagnostics) = create_syntax_error_diagnostics(DiagnosticFormat::Gitlab);
insta::with_settings!({filters => FINGERPRINT_FILTERS}, {
insta::assert_snapshot!(env.render_diagnostics(&diagnostics));
});
}
}

View File

@@ -1,63 +1,63 @@
---
source: crates/ruff_linter/src/message/gitlab.rs
expression: redact_fingerprint(&content)
source: crates/ruff_db/src/diagnostic/render/gitlab.rs
expression: env.render_diagnostics(&diagnostics)
---
[
{
"check_name": "F401",
"description": "F401: `os` imported but unused",
"severity": "major",
"fingerprint": "<redacted>",
"location": {
"path": "fib.py",
"positions": {
"begin": {
"column": 8,
"line": 1
"line": 1,
"column": 8
},
"end": {
"column": 10,
"line": 1
"line": 1,
"column": 10
}
}
},
"severity": "major"
}
},
{
"check_name": "F841",
"description": "F841: Local variable `x` is assigned to but never used",
"severity": "major",
"fingerprint": "<redacted>",
"location": {
"path": "fib.py",
"positions": {
"begin": {
"column": 5,
"line": 6
"line": 6,
"column": 5
},
"end": {
"column": 6,
"line": 6
"line": 6,
"column": 6
}
}
},
"severity": "major"
}
},
{
"check_name": "F821",
"description": "F821: Undefined name `a`",
"severity": "major",
"fingerprint": "<redacted>",
"location": {
"path": "undef.py",
"positions": {
"begin": {
"column": 4,
"line": 1
"line": 1,
"column": 4
},
"end": {
"column": 5,
"line": 1
"line": 1,
"column": 5
}
}
},
"severity": "major"
}
}
]

View File

@@ -1,44 +1,44 @@
---
source: crates/ruff_linter/src/message/gitlab.rs
expression: redact_fingerprint(&content)
source: crates/ruff_db/src/diagnostic/render/gitlab.rs
expression: env.render_diagnostics(&diagnostics)
---
[
{
"check_name": "invalid-syntax",
"description": "invalid-syntax: Expected one or more symbol names after import",
"severity": "major",
"fingerprint": "<redacted>",
"location": {
"path": "syntax_errors.py",
"positions": {
"begin": {
"column": 15,
"line": 1
"line": 1,
"column": 15
},
"end": {
"column": 1,
"line": 2
"line": 2,
"column": 1
}
}
},
"severity": "major"
}
},
{
"check_name": "invalid-syntax",
"description": "invalid-syntax: Expected ')', found newline",
"severity": "major",
"fingerprint": "<redacted>",
"location": {
"path": "syntax_errors.py",
"positions": {
"begin": {
"column": 12,
"line": 3
"line": 3,
"column": 12
},
"end": {
"column": 1,
"line": 4
"line": 4,
"column": 1
}
}
},
"severity": "major"
}
}
]

View File

@@ -43,6 +43,10 @@ pub struct DiagnosticStylesheet {
pub(crate) none: Style,
pub(crate) separator: Style,
pub(crate) secondary_code: Style,
pub(crate) insertion: Style,
pub(crate) deletion: Style,
pub(crate) insertion_line_no: Style,
pub(crate) deletion_line_no: Style,
}
impl Default for DiagnosticStylesheet {
@@ -66,6 +70,10 @@ impl DiagnosticStylesheet {
none: Style::new(),
separator: AnsiColor::Cyan.on_default(),
secondary_code: AnsiColor::Red.on_default().effects(Effects::BOLD),
insertion: AnsiColor::Green.on_default(),
deletion: AnsiColor::Red.on_default(),
insertion_line_no: AnsiColor::Green.on_default().effects(Effects::BOLD),
deletion_line_no: AnsiColor::Red.on_default().effects(Effects::BOLD),
}
}
@@ -81,6 +89,10 @@ impl DiagnosticStylesheet {
none: Style::new(),
separator: Style::new(),
secondary_code: Style::new(),
insertion: Style::new(),
deletion: Style::new(),
insertion_line_no: Style::new(),
deletion_line_no: Style::new(),
}
}
}

View File

@@ -1,3 +1,8 @@
#![warn(
clippy::disallowed_methods,
reason = "Prefer System trait methods over std methods"
)]
use crate::files::Files;
use crate::system::System;
use crate::vendored::VendoredFileSystem;
@@ -65,6 +70,10 @@ pub trait Db: salsa::Database {
/// to process work in parallel. For example, to index a directory or checking the files of a project.
/// ty can still spawn more threads for other tasks, e.g. to wait for a Ctrl+C signal or
/// watching the files for changes.
#[expect(
clippy::disallowed_methods,
reason = "We don't have access to System here, but this is also only used by the CLI and the server which always run on a real system."
)]
pub fn max_parallelism() -> NonZeroUsize {
std::env::var(EnvVars::TY_MAX_PARALLELISM)
.or_else(|_| std::env::var(EnvVars::RAYON_NUM_THREADS))

View File

@@ -92,14 +92,14 @@ impl ParsedModule {
self.inner.store(None);
}
/// Returns a pointer for this [`ParsedModule`].
/// Returns the pointer address of this [`ParsedModule`].
///
/// The pointer uniquely identifies the module within the current Salsa revision,
/// regardless of whether particular [`ParsedModuleRef`] instances are garbage collected.
pub fn as_ptr(&self) -> *const () {
pub fn addr(&self) -> usize {
// Note that the outer `Arc` in `inner` is stable across garbage collection, while the inner
// `Arc` within the `ArcSwap` may change.
Arc::as_ptr(&self.inner).cast()
Arc::as_ptr(&self.inner).addr()
}
}
@@ -202,9 +202,13 @@ mod indexed {
/// Returns the node at the given index.
pub fn get_by_index<'ast>(&'ast self, index: NodeIndex) -> AnyRootNodeRef<'ast> {
let index = index
.as_u32()
.expect("attempted to access uninitialized `NodeIndex`");
// Note that this method restores the correct lifetime: the nodes are valid for as
// long as the reference to `IndexedModule` is alive.
self.index[index.as_usize()]
self.index[index as usize]
}
}
@@ -220,7 +224,7 @@ mod indexed {
T: HasNodeIndex + std::fmt::Debug,
AnyRootNodeRef<'a>: From<&'a T>,
{
node.node_index().set(self.index);
node.node_index().set(NodeIndex::from(self.index));
self.nodes.push(AnyRootNodeRef::from(node));
self.index += 1;
}

View File

@@ -46,7 +46,7 @@ pub type Result<T> = std::io::Result<T>;
/// * File watching isn't supported.
///
/// Abstracting the system also enables tests to use a more efficient in-memory file system.
pub trait System: Debug {
pub trait System: Debug + Sync + Send {
/// Reads the metadata of the file or directory at `path`.
///
/// This function will traverse symbolic links to query information about the destination file.
@@ -197,6 +197,8 @@ pub trait System: Debug {
fn as_any(&self) -> &dyn std::any::Any;
fn as_any_mut(&mut self) -> &mut dyn std::any::Any;
fn dyn_clone(&self) -> Box<dyn System>;
}
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq)]

View File

@@ -1,3 +1,5 @@
#![allow(clippy::disallowed_methods)]
use super::walk_directory::{
self, DirectoryWalker, WalkDirectoryBuilder, WalkDirectoryConfiguration,
WalkDirectoryVisitorBuilder, WalkState,
@@ -255,6 +257,10 @@ impl System for OsSystem {
fn env_var(&self, name: &str) -> std::result::Result<String, std::env::VarError> {
std::env::var(name)
}
fn dyn_clone(&self) -> Box<dyn System> {
Box::new(self.clone())
}
}
impl OsSystem {

View File

@@ -146,6 +146,10 @@ impl System for TestSystem {
fn case_sensitivity(&self) -> CaseSensitivity {
self.system().case_sensitivity()
}
fn dyn_clone(&self) -> Box<dyn System> {
Box::new(self.clone())
}
}
impl Default for TestSystem {
@@ -394,6 +398,13 @@ impl System for InMemorySystem {
fn case_sensitivity(&self) -> CaseSensitivity {
CaseSensitivity::CaseSensitive
}
fn dyn_clone(&self) -> Box<dyn System> {
Box::new(Self {
user_config_directory: Mutex::new(self.user_config_directory.lock().unwrap().clone()),
memory_fs: self.memory_fs.clone(),
})
}
}
impl WritableSystem for InMemorySystem {

View File

@@ -13,6 +13,7 @@ license = { workspace = true }
[dependencies]
ty = { workspace = true }
ty_project = { workspace = true, features = ["schemars"] }
ty_python_semantic = { workspace = true }
ty_static = { workspace = true }
ruff = { workspace = true }
ruff_formatter = { workspace = true }

View File

@@ -52,7 +52,7 @@ pub(crate) fn main(args: &Args) -> Result<()> {
}
fn generate_markdown() -> String {
let registry = &*ty_project::DEFAULT_LINT_REGISTRY;
let registry = ty_python_semantic::default_lint_registry();
let mut output = String::new();

View File

@@ -14,8 +14,11 @@ license = { workspace = true }
doctest = false
[dependencies]
ruff_text_size = { workspace = true }
ruff_text_size = { workspace = true, features = ["get-size"] }
get-size2 = { workspace = true }
is-macro = { workspace = true }
serde = { workspace = true, optional = true, features = [] }
[features]
serde = ["dep:serde", "ruff_text_size/serde"]

View File

@@ -1,6 +1,6 @@
[package]
name = "ruff_linter"
version = "0.12.9"
version = "0.12.11"
publish = false
authors = { workspace = true }
edition = { workspace = true }
@@ -51,7 +51,6 @@ path-absolutize = { workspace = true, features = [
"once_cell_cache",
"use_unix_paths_on_wasm",
] }
pathdiff = { workspace = true }
pep440_rs = { workspace = true }
pyproject-toml = { workspace = true }
regex = { workspace = true }

View File

@@ -34,7 +34,7 @@ task_group()
setup()
from airflow.decorators import teardown
from airflow.io.path import ObjectStoragePath
from airflow.io.storage import attach
from airflow.io.store import attach
from airflow.models import DAG as DAGFromModel
from airflow.models import (
Connection,
@@ -74,3 +74,36 @@ DatasetOrTimeSchedule()
# airflow.utils.dag_parsing_context
get_parsing_context()
from airflow.decorators.base import (
DecoratedMappedOperator,
DecoratedOperator,
TaskDecorator,
get_unique_task_id,
task_decorator_factory,
)
# airflow.decorators.base
DecoratedMappedOperator()
DecoratedOperator()
TaskDecorator()
get_unique_task_id()
task_decorator_factory()
from airflow.models import Param
# airflow.models
Param()
from airflow.sensors.base import (
BaseSensorOperator,
PokeReturnValue,
poke_mode_only,
)
# airflow.sensors.base
BaseSensorOperator()
PokeReturnValue()
poke_mode_only()

View File

@@ -9,7 +9,6 @@ from airflow.operators.empty import EmptyOperator
from airflow.operators.latest_only import LatestOnlyOperator
from airflow.operators.trigger_dagrun import TriggerDagRunOperator
from airflow.operators.weekday import BranchDayOfWeekOperator
from airflow.sensors.date_time import DateTimeSensor
FSHook()
PackageIndexHook()
@@ -22,7 +21,6 @@ EmptyOperator()
LatestOnlyOperator()
BranchDayOfWeekOperator()
DateTimeSensor()
from airflow.operators.python import (
BranchPythonOperator,
@@ -30,16 +28,23 @@ from airflow.operators.python import (
PythonVirtualenvOperator,
ShortCircuitOperator,
)
from airflow.sensors.bash import BashSensor
from airflow.sensors.date_time import DateTimeSensor
BranchPythonOperator()
PythonOperator()
PythonVirtualenvOperator()
ShortCircuitOperator()
BashSensor()
DateTimeSensor()
from airflow.sensors.date_time import DateTimeSensorAsync
from airflow.sensors.external_task import (
ExternalTaskMarker,
ExternalTaskSensor,
)
from airflow.sensors.time_sensor import (
TimeSensor,
TimeSensorAsync,
)
from airflow.sensors.filesystem import FileSensor
from airflow.sensors.python import PythonSensor
BranchPythonOperator()
PythonOperator()
@@ -49,6 +54,13 @@ DateTimeSensorAsync()
ExternalTaskMarker()
ExternalTaskSensor()
FileSensor()
PythonSensor()
from airflow.sensors.time_sensor import (
TimeSensor,
TimeSensorAsync,
)
TimeSensor()
TimeSensorAsync()

View File

@@ -213,3 +213,17 @@ async def get_id_pydantic_full(
async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()]): ...
@app.get("/{my_id}")
async def get_id_init_not_annotated(params = Depends(InitParams)): ...
@app.get("/things/{ thing_id }")
async def read_thing(query: str):
return {"query": query}
@app.get("/things/{ thing_id : path }")
async def read_thing(query: str):
return {"query": query}
@app.get("/things/{ thing_id : str }")
async def read_thing(query: str):
return {"query": query}

View File

@@ -0,0 +1,75 @@
from typing import Optional
import httpx
def foo():
client = httpx.Client()
client.close() # Ok
client.delete() # Ok
client.get() # Ok
client.head() # Ok
client.options() # Ok
client.patch() # Ok
client.post() # Ok
client.put() # Ok
client.request() # Ok
client.send() # Ok
client.stream() # Ok
client.anything() # Ok
client.build_request() # Ok
client.is_closed # Ok
async def foo():
client = httpx.Client()
client.close() # ASYNC212
client.delete() # ASYNC212
client.get() # ASYNC212
client.head() # ASYNC212
client.options() # ASYNC212
client.patch() # ASYNC212
client.post() # ASYNC212
client.put() # ASYNC212
client.request() # ASYNC212
client.send() # ASYNC212
client.stream() # ASYNC212
client.anything() # Ok
client.build_request() # Ok
client.is_closed # Ok
async def foo(client: httpx.Client):
client.request() # ASYNC212
client.anything() # Ok
async def foo(client: httpx.Client | None):
client.request() # ASYNC212
client.anything() # Ok
async def foo(client: Optional[httpx.Client]):
client.request() # ASYNC212
client.anything() # Ok
async def foo():
client: httpx.Client = ...
client.request() # ASYNC212
client.anything() # Ok
global_client = httpx.Client()
async def foo():
global_client.request() # ASYNC212
global_client.anything() # Ok
async def foo():
async with httpx.AsyncClient() as client:
await client.get() # Ok

View File

@@ -0,0 +1,22 @@
def foo():
k = input() # Ok
input("hello world") # Ok
async def foo():
k = input() # ASYNC250
input("hello world") # ASYNC250
import builtins
import fake
def foo():
builtins.input("testing") # Ok
async def foo():
builtins.input("testing") # ASYNC250
fake.input("whatever") # Ok

View File

@@ -17,3 +17,50 @@ info(f"{__name__}")
# Don't trigger for t-strings
info(t"{name}")
info(t"{__name__}")
count = 5
total = 9
directory_path = "/home/hamir/ruff/crates/ruff_linter/resources/test/"
logging.info(f"{count} out of {total} files in {directory_path} checked")
x = 99
fmt = "08d"
logger.info(f"{x:{'08d'}}")
logger.info(f"{x:>10} {x:{fmt}}")
logging.info(f"")
logging.info(f"This message doesn't have any variables.")
obj = {"key": "value"}
logging.info(f"Object: {obj!r}")
items_count = 3
logging.warning(f"Items: {items_count:d}")
data = {"status": "active"}
logging.info(f"Processing {len(data)} items")
logging.info(f"Status: {data.get('status', 'unknown').upper()}")
result = 123
logging.info(f"Calculated result: {result + 100}")
temperature = 123
logging.info(f"Temperature: {temperature:.1f}°C")
class FilePath:
def __init__(self, name: str):
self.name = name
logging.info(f"No changes made to {file_path.name}.")
user = "tron"
balance = 123.45
logging.error(f"Error {404}: User {user} has insufficient balance ${balance:.2f}")
import logging
x = 1
logging.error(f"{x} -> %s", x)

View File

@@ -0,0 +1,10 @@
"""Test f-string argument order."""
import logging
logger = logging.getLogger(__name__)
X = 1
Y = 2
logger.error(f"{X} -> %s", Y)
logger.error(f"{Y} -> %s", X)

View File

@@ -23,3 +23,11 @@ def test_error():
assert list([])
assert set(set())
assert tuple("")
# https://github.com/astral-sh/ruff/issues/19935
def test_all_ok():
assert f"{b""}"
assert f"{""=}"
assert f"{""!a}"
assert f"{""!r}"
assert f"{"":1}"

View File

@@ -166,3 +166,7 @@ r"""first
print("S\x1cP\x1dL\x1eI\x1fT".split())
print("\x1c\x1d\x1e\x1f>".split(maxsplit=0))
print("<\x1c\x1d\x1e\x1f".rsplit(maxsplit=0))
# leading/trailing whitespace should not count towards maxsplit
" a b c d ".split(maxsplit=2) # ["a", "b", "c d "]
" a b c d ".rsplit(maxsplit=2) # [" a b", "c", "d"]

View File

@@ -13,3 +13,11 @@ Path("tmp/python").symlink_to("usr/bin/python", target_is_directory=True) # Ok
fd = os.open(".", os.O_RDONLY)
os.symlink("source.txt", "link.txt", dir_fd=fd) # Ok: dir_fd is not supported by pathlib
os.close(fd)
os.symlink(src="usr/bin/python", dst="tmp/python", unknown=True)
os.symlink("usr/bin/python", dst="tmp/python", target_is_directory=False)
os.symlink(src="usr/bin/python", dst="tmp/python", dir_fd=None)
os.symlink("usr/bin/python", dst="tmp/python", target_is_directory= True )
os.symlink("usr/bin/python", dst="tmp/python", target_is_directory="nonboolean")

View File

@@ -106,4 +106,22 @@ os.replace("src", "dst", src_dir_fd=1)
os.replace("src", "dst", dst_dir_fd=2)
os.getcwd()
os.getcwdb()
os.getcwdb()
os.mkdir(path="directory")
os.mkdir(
# comment 1
"directory",
mode=0o777
)
os.mkdir("directory", mode=0o777, dir_fd=1)
os.makedirs("name", 0o777, exist_ok=False)
os.makedirs("name", 0o777, False)
os.makedirs(name="name", mode=0o777, exist_ok=False)
os.makedirs("name", unknown_kwarg=True)

View File

@@ -0,0 +1,4 @@
"""Hello, world!"""\
\
x = 1; y = 2

View File

@@ -192,3 +192,24 @@ def issue_19005_3():
c = {}
for a[0], a[1] in ():
c[a[0]] = a[1]
def issue_19153_1():
v = {}
for o, (x,) in ["ox"]:
v[x,] = o
return v
def issue_19153_2():
v = {}
for (o, p), x in [("op", "x")]:
v[x] = o, p
return v
def issue_19153_3():
v = {}
for o, (x,) in ["ox"]:
v[(x,)] = o
return v

View File

@@ -190,3 +190,12 @@ foo_tooltip = (
more
)
# https://github.com/astral-sh/ruff/issues/20097
def scope():
from collections.abc import Callable
from typing import ParamSpec
P = ParamSpec("P")
f1: Callable[P, str] = lambda x: str(x)
f2: Callable[..., str] = lambda x: str(x)

View File

@@ -0,0 +1,16 @@
"""
Test: allowed-unused-imports-top-level-module
"""
# No errors
def f():
import hvplot
def f():
import hvplot.pandas
def f():
import hvplot.pandas.plots
def f():
from hvplot.pandas import scatter_matrix
def f():
from hvplot.pandas.plots import scatter_matrix

View File

@@ -151,3 +151,39 @@ def f():
pass
except Exception as _:
pass
# OK, `__class__` in this case is not the special `__class__` cell, so we don't
# emit a diagnostic. (It has its own special semantics -- see
# https://github.com/astral-sh/ruff/pull/20048#discussion_r2298338048 -- but
# those aren't relevant here.)
class A:
__class__ = 1
# The following three cases are flagged because they declare local `__class__`
# variables that don't refer to the special `__class__` cell.
class A:
def set_class(self, cls):
__class__ = cls # F841
class A:
class B:
def set_class(self, cls):
__class__ = cls # F841
class A:
def foo():
class B:
print(__class__)
def set_class(self, cls):
__class__ = cls # F841
# OK, the `__class__` cell is nonlocal and declared as such.
class NonlocalDunderClass:
def foo():
nonlocal __class__
__class__ = 1

View File

@@ -4,6 +4,9 @@ print("שלום‬")
# E2502
example = "x" * 100 # "x" is assigned
# E2502
another = "x؜" * 50 # "؜x" is assigned
# E2502
if access_level != "none": # Check if admin ' and access_level != 'user
print("You are an admin.")

View File

@@ -44,3 +44,8 @@ def f():
def g():
nonlocal x
x = 2
# OK
class A:
def method(self):
nonlocal __class__

View File

@@ -0,0 +1,18 @@
from __future__ import nested_scopes, generators
from __future__ import with_statement, unicode_literals
from __future__ import absolute_import, division
from __future__ import generator_stop
from __future__ import print_function, nested_scopes, generator_stop
print(with_statement)
generators = 1
class Foo():
def boo(self):
print(division)
__all__ = ["print_function", "generator_stop"]

View File

@@ -69,3 +69,10 @@ a7: OptionalTE[typing.NamedTuple] = None
a8: typing_extensions.Optional[typing.NamedTuple] = None
a9: "Optional[NamedTuple]" = None
a10: Optional[NamedTupleTE] = None
# Test for: https://github.com/astral-sh/ruff/issues/19746
# Nested Optional types should be flattened
nested_optional: Optional[Optional[str]] = None
nested_optional_typing: typing.Optional[Optional[int]] = None
triple_nested_optional: Optional[Optional[Optional[str]]] = None

View File

@@ -118,3 +118,10 @@ def func():
return lambda: value
defaultdict(constant_factory("<missing>"))
def func():
defaultdict(default_factory=t"") # OK
def func():
defaultdict(default_factory=t"hello") # OK

View File

@@ -124,3 +124,19 @@ def fun_with_python_syntax():
...
return Foo
@dataclass
class C:
def __post_init__(self, x: tuple[int, ...] = (
1,
2,
)) -> None:
self.x = x
@dataclass
class D:
def __post_init__(self, x: int = """
""") -> None:
self.x = x

View File

@@ -102,3 +102,17 @@ deque("abc") # OK
deque(b"abc") # OK
deque(f"" "a") # OK
deque(f"{x}" "") # OK
# https://github.com/astral-sh/ruff/issues/19951
deque(t"")
deque(t"" t"")
deque(t"{""}") # OK
# https://github.com/astral-sh/ruff/issues/20050
deque(f"{""}") # RUF037
deque(f"{b""}")
deque(f"{""=}")
deque(f"{""!a}")
deque(f"{""!r}")
deque(f"{"":1}")

View File

@@ -1,10 +1,11 @@
use ruff_python_ast::PythonVersion;
use ruff_python_semantic::{Binding, ScopeKind};
use crate::checkers::ast::Checker;
use crate::codes::Rule;
use crate::rules::{
flake8_builtins, flake8_pyi, flake8_type_checking, flake8_unused_arguments, pep8_naming,
pyflakes, pylint, ruff,
pyflakes, pylint, pyupgrade, ruff,
};
/// Run lint rules over all deferred scopes in the [`SemanticModel`].
@@ -45,6 +46,7 @@ pub(crate) fn deferred_scopes(checker: &Checker) {
Rule::UnusedStaticMethodArgument,
Rule::UnusedUnpackedVariable,
Rule::UnusedVariable,
Rule::UnnecessaryFutureImport,
]) {
return;
}
@@ -224,6 +226,11 @@ pub(crate) fn deferred_scopes(checker: &Checker) {
if checker.is_rule_enabled(Rule::UnusedImport) {
pyflakes::rules::unused_import(checker, scope);
}
if checker.is_rule_enabled(Rule::UnnecessaryFutureImport) {
if checker.target_version() >= PythonVersion::PY37 {
pyupgrade::rules::unnecessary_future_import(checker, scope);
}
}
if checker.is_rule_enabled(Rule::ImportPrivateName) {
pylint::rules::import_private_name(checker, scope);

View File

@@ -660,6 +660,9 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
if checker.is_rule_enabled(Rule::BlockingHttpCallInAsyncFunction) {
flake8_async::rules::blocking_http_call(checker, call);
}
if checker.is_rule_enabled(Rule::BlockingHttpCallHttpxInAsyncFunction) {
flake8_async::rules::blocking_http_call_httpx(checker, call);
}
if checker.is_rule_enabled(Rule::BlockingOpenCallInAsyncFunction) {
flake8_async::rules::blocking_open_call(checker, call);
}
@@ -670,6 +673,9 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
]) {
flake8_async::rules::blocking_process_invocation(checker, call);
}
if checker.is_rule_enabled(Rule::BlockingInputInAsyncFunction) {
flake8_async::rules::blocking_input(checker, call);
}
if checker.is_rule_enabled(Rule::BlockingSleepInAsyncFunction) {
flake8_async::rules::blocking_sleep(checker, call);
}
@@ -1039,8 +1045,6 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
flake8_simplify::rules::zip_dict_keys_and_values(checker, call);
}
if checker.any_rule_enabled(&[
Rule::OsMkdir,
Rule::OsMakedirs,
Rule::OsStat,
Rule::OsPathJoin,
Rule::OsPathSplitext,
@@ -1048,7 +1052,6 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
Rule::PyPath,
Rule::Glob,
Rule::OsListdir,
Rule::OsSymlink,
]) {
flake8_use_pathlib::rules::replaceable_by_pathlib(checker, call);
}
@@ -1120,6 +1123,15 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
if checker.is_rule_enabled(Rule::OsPathSamefile) {
flake8_use_pathlib::rules::os_path_samefile(checker, call, segments);
}
if checker.is_rule_enabled(Rule::OsMkdir) {
flake8_use_pathlib::rules::os_mkdir(checker, call, segments);
}
if checker.is_rule_enabled(Rule::OsMakedirs) {
flake8_use_pathlib::rules::os_makedirs(checker, call, segments);
}
if checker.is_rule_enabled(Rule::OsSymlink) {
flake8_use_pathlib::rules::os_symlink(checker, call, segments);
}
if checker.is_rule_enabled(Rule::PathConstructorCurrentDirectory) {
flake8_use_pathlib::rules::path_constructor_current_directory(
checker, call, segments,

View File

@@ -728,13 +728,6 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
pylint::rules::non_ascii_module_import(checker, alias);
}
}
if checker.is_rule_enabled(Rule::UnnecessaryFutureImport) {
if checker.target_version() >= PythonVersion::PY37 {
if let Some("__future__") = module {
pyupgrade::rules::unnecessary_future_import(checker, stmt, names);
}
}
}
if checker.is_rule_enabled(Rule::DeprecatedMockImport) {
pyupgrade::rules::deprecated_mock_import(checker, stmt);
}

View File

@@ -703,7 +703,10 @@ impl SemanticSyntaxContext for Checker<'_> {
match scope.kind {
ScopeKind::Class(_) | ScopeKind::Lambda(_) => return false,
ScopeKind::Function(ast::StmtFunctionDef { is_async, .. }) => return *is_async,
ScopeKind::Generator { .. } | ScopeKind::Module | ScopeKind::Type => {}
ScopeKind::Generator { .. }
| ScopeKind::Module
| ScopeKind::Type
| ScopeKind::DunderClassCell => {}
}
}
false
@@ -714,7 +717,10 @@ impl SemanticSyntaxContext for Checker<'_> {
match scope.kind {
ScopeKind::Class(_) => return false,
ScopeKind::Function(_) | ScopeKind::Lambda(_) => return true,
ScopeKind::Generator { .. } | ScopeKind::Module | ScopeKind::Type => {}
ScopeKind::Generator { .. }
| ScopeKind::Module
| ScopeKind::Type
| ScopeKind::DunderClassCell => {}
}
}
false
@@ -725,7 +731,7 @@ impl SemanticSyntaxContext for Checker<'_> {
match scope.kind {
ScopeKind::Class(_) | ScopeKind::Generator { .. } => return false,
ScopeKind::Function(_) | ScopeKind::Lambda(_) => return true,
ScopeKind::Module | ScopeKind::Type => {}
ScopeKind::Module | ScopeKind::Type | ScopeKind::DunderClassCell => {}
}
}
false
@@ -1092,6 +1098,24 @@ impl<'a> Visitor<'a> for Checker<'a> {
}
}
// Here we add the implicit scope surrounding a method which allows code in the
// method to access `__class__` at runtime. See the `ScopeKind::DunderClassCell`
// docs for more information.
let added_dunder_class_scope = if self.semantic.current_scope().kind.is_class() {
self.semantic.push_scope(ScopeKind::DunderClassCell);
let binding_id = self.semantic.push_binding(
TextRange::default(),
BindingKind::DunderClassCell,
BindingFlags::empty(),
);
self.semantic
.current_scope_mut()
.add("__class__", binding_id);
true
} else {
false
};
self.semantic.push_scope(ScopeKind::Type);
if let Some(type_params) = type_params {
@@ -1155,6 +1179,9 @@ impl<'a> Visitor<'a> for Checker<'a> {
self.semantic.pop_scope(); // Function scope
self.semantic.pop_definition();
self.semantic.pop_scope(); // Type parameter scope
if added_dunder_class_scope {
self.semantic.pop_scope(); // `__class__` cell closure scope
}
self.add_binding(
name,
stmt.identifier(),

View File

@@ -336,10 +336,12 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
(Flake8Async, "115") => (RuleGroup::Stable, rules::flake8_async::rules::AsyncZeroSleep),
(Flake8Async, "116") => (RuleGroup::Preview, rules::flake8_async::rules::LongSleepNotForever),
(Flake8Async, "210") => (RuleGroup::Stable, rules::flake8_async::rules::BlockingHttpCallInAsyncFunction),
(Flake8Async, "212") => (RuleGroup::Preview, rules::flake8_async::rules::BlockingHttpCallHttpxInAsyncFunction),
(Flake8Async, "220") => (RuleGroup::Stable, rules::flake8_async::rules::CreateSubprocessInAsyncFunction),
(Flake8Async, "221") => (RuleGroup::Stable, rules::flake8_async::rules::RunProcessInAsyncFunction),
(Flake8Async, "222") => (RuleGroup::Stable, rules::flake8_async::rules::WaitForProcessInAsyncFunction),
(Flake8Async, "230") => (RuleGroup::Stable, rules::flake8_async::rules::BlockingOpenCallInAsyncFunction),
(Flake8Async, "250") => (RuleGroup::Preview, rules::flake8_async::rules::BlockingInputInAsyncFunction),
(Flake8Async, "251") => (RuleGroup::Stable, rules::flake8_async::rules::BlockingSleepInAsyncFunction),
// flake8-builtins
@@ -921,8 +923,8 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
// flake8-use-pathlib
(Flake8UsePathlib, "100") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::OsPathAbspath),
(Flake8UsePathlib, "101") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::OsChmod),
(Flake8UsePathlib, "102") => (RuleGroup::Stable, rules::flake8_use_pathlib::violations::OsMkdir),
(Flake8UsePathlib, "103") => (RuleGroup::Stable, rules::flake8_use_pathlib::violations::OsMakedirs),
(Flake8UsePathlib, "102") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::OsMkdir),
(Flake8UsePathlib, "103") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::OsMakedirs),
(Flake8UsePathlib, "104") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::OsRename),
(Flake8UsePathlib, "105") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::OsReplace),
(Flake8UsePathlib, "106") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::OsRmdir),
@@ -954,7 +956,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
(Flake8UsePathlib, "207") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::Glob),
(Flake8UsePathlib, "208") => (RuleGroup::Stable, rules::flake8_use_pathlib::violations::OsListdir),
(Flake8UsePathlib, "210") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::InvalidPathlibWithSuffix),
(Flake8UsePathlib, "211") => (RuleGroup::Preview, rules::flake8_use_pathlib::violations::OsSymlink),
(Flake8UsePathlib, "211") => (RuleGroup::Preview, rules::flake8_use_pathlib::rules::OsSymlink),
// flake8-logging-format
(Flake8LoggingFormat, "001") => (RuleGroup::Stable, rules::flake8_logging_format::violations::LoggingStringFormat),

View File

@@ -58,13 +58,3 @@ pub fn relativize_path<P: AsRef<Path>>(path: P) -> String {
}
format!("{}", path.display())
}
/// Convert an absolute path to be relative to the specified project root.
pub fn relativize_path_to<P: AsRef<Path>, R: AsRef<Path>>(path: P, project_root: R) -> String {
format!(
"{}",
pathdiff::diff_paths(&path, project_root)
.expect("Could not diff paths")
.display()
)
}

View File

@@ -63,9 +63,9 @@ impl<'a> Insertion<'a> {
return Insertion::inline(" ", location.add(offset).add(TextSize::of(';')), ";");
}
// If the first token after the docstring is a continuation character (i.e. "\"), advance
// an additional row to prevent inserting in the same logical line.
if match_continuation(locator.after(location)).is_some() {
// While the first token after the docstring is a continuation character (i.e. "\"), advance
// additional rows to prevent inserting in the same logical line.
while match_continuation(locator.after(location)).is_some() {
location = locator.full_line_end(location);
}
@@ -379,6 +379,17 @@ mod tests {
Insertion::own_line("", TextSize::from(22), "\n")
);
let contents = r#"
"""Hello, world!"""\
\
"#
.trim_start();
assert_eq!(
insert(contents)?,
Insertion::own_line("", TextSize::from(24), "\n")
);
let contents = r"
x = 1
"

View File

@@ -1,202 +0,0 @@
use std::fmt::{Display, Formatter};
use std::num::NonZeroUsize;
use colored::{Color, ColoredString, Colorize, Styles};
use similar::{ChangeTag, TextDiff};
use ruff_db::diagnostic::Diagnostic;
use ruff_source_file::{OneIndexed, SourceFile};
use ruff_text_size::{Ranged, TextRange, TextSize};
use crate::text_helpers::ShowNonprinting;
use crate::{Applicability, Fix};
/// Renders a diff that shows the code fixes.
///
/// The implementation isn't fully fledged out and only used by tests. Before using in production, try
/// * Improve layout
/// * Replace tabs with spaces for a consistent experience across terminals
/// * Replace zero-width whitespaces
/// * Print a simpler diff if only a single line has changed
/// * Compute the diff from the [`Edit`] because diff calculation is expensive.
pub(super) struct Diff<'a> {
fix: &'a Fix,
source_code: &'a SourceFile,
}
impl<'a> Diff<'a> {
pub(crate) fn from_message(message: &'a Diagnostic) -> Option<Diff<'a>> {
message.fix().map(|fix| Diff {
source_code: message.expect_ruff_source_file(),
fix,
})
}
}
impl Display for Diff<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
// TODO(dhruvmanila): Add support for Notebook cells once it's user-facing
let mut output = String::with_capacity(self.source_code.source_text().len());
let mut last_end = TextSize::default();
for edit in self.fix.edits() {
output.push_str(
self.source_code
.slice(TextRange::new(last_end, edit.start())),
);
output.push_str(edit.content().unwrap_or_default());
last_end = edit.end();
}
output.push_str(&self.source_code.source_text()[usize::from(last_end)..]);
let diff = TextDiff::from_lines(self.source_code.source_text(), &output);
let message = match self.fix.applicability() {
// TODO(zanieb): Adjust this messaging once it's user-facing
Applicability::Safe => "Safe fix",
Applicability::Unsafe => "Unsafe fix",
Applicability::DisplayOnly => "Display-only fix",
};
writeln!(f, " {}", message.blue())?;
let (largest_old, largest_new) = diff
.ops()
.last()
.map(|op| (op.old_range().start, op.new_range().start))
.unwrap_or_default();
let digit_with =
calculate_print_width(OneIndexed::from_zero_indexed(largest_new.max(largest_old)));
for (idx, group) in diff.grouped_ops(3).iter().enumerate() {
if idx > 0 {
writeln!(f, "{:-^1$}", "-", 80)?;
}
for op in group {
for change in diff.iter_inline_changes(op) {
let sign = match change.tag() {
ChangeTag::Delete => "-",
ChangeTag::Insert => "+",
ChangeTag::Equal => " ",
};
let line_style = LineStyle::from(change.tag());
let old_index = change.old_index().map(OneIndexed::from_zero_indexed);
let new_index = change.new_index().map(OneIndexed::from_zero_indexed);
write!(
f,
"{} {} |{}",
Line {
index: old_index,
width: digit_with
},
Line {
index: new_index,
width: digit_with
},
line_style.apply_to(sign).bold()
)?;
for (emphasized, value) in change.iter_strings_lossy() {
let value = value.show_nonprinting();
if emphasized {
write!(f, "{}", line_style.apply_to(&value).underline().on_black())?;
} else {
write!(f, "{}", line_style.apply_to(&value))?;
}
}
if change.missing_newline() {
writeln!(f)?;
}
}
}
}
Ok(())
}
}
struct LineStyle {
fgcolor: Option<Color>,
style: Option<Styles>,
}
impl LineStyle {
fn apply_to(&self, input: &str) -> ColoredString {
let mut colored = ColoredString::from(input);
if let Some(color) = self.fgcolor {
colored = colored.color(color);
}
if let Some(style) = self.style {
match style {
Styles::Clear => colored.clear(),
Styles::Bold => colored.bold(),
Styles::Dimmed => colored.dimmed(),
Styles::Underline => colored.underline(),
Styles::Reversed => colored.reversed(),
Styles::Italic => colored.italic(),
Styles::Blink => colored.blink(),
Styles::Hidden => colored.hidden(),
Styles::Strikethrough => colored.strikethrough(),
}
} else {
colored
}
}
}
impl From<ChangeTag> for LineStyle {
fn from(value: ChangeTag) -> Self {
match value {
ChangeTag::Equal => LineStyle {
fgcolor: None,
style: Some(Styles::Dimmed),
},
ChangeTag::Delete => LineStyle {
fgcolor: Some(Color::Red),
style: None,
},
ChangeTag::Insert => LineStyle {
fgcolor: Some(Color::Green),
style: None,
},
}
}
}
struct Line {
index: Option<OneIndexed>,
width: NonZeroUsize,
}
impl Display for Line {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
match self.index {
None => {
for _ in 0..self.width.get() {
f.write_str(" ")?;
}
Ok(())
}
Some(idx) => write!(f, "{:<width$}", idx, width = self.width.get()),
}
}
}
/// Calculate the length of the string representation of `value`
pub(super) fn calculate_print_width(mut value: OneIndexed) -> NonZeroUsize {
const TEN: OneIndexed = OneIndexed::from_zero_indexed(9);
let mut width = OneIndexed::ONE;
while value >= TEN {
value = OneIndexed::new(value.get() / 10).unwrap_or(OneIndexed::MIN);
width = width.checked_add(1).unwrap();
}
width
}

View File

@@ -1,174 +0,0 @@
use std::collections::HashSet;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::io::Write;
use serde::ser::SerializeSeq;
use serde::{Serialize, Serializer};
use serde_json::json;
use ruff_db::diagnostic::Diagnostic;
use crate::fs::{relativize_path, relativize_path_to};
use crate::message::{Emitter, EmitterContext};
/// Generate JSON with violations in GitLab CI format
// https://docs.gitlab.com/ee/ci/testing/code_quality.html#implement-a-custom-tool
pub struct GitlabEmitter {
project_dir: Option<String>,
}
impl Default for GitlabEmitter {
fn default() -> Self {
Self {
project_dir: std::env::var("CI_PROJECT_DIR").ok(),
}
}
}
impl Emitter for GitlabEmitter {
fn emit(
&mut self,
writer: &mut dyn Write,
diagnostics: &[Diagnostic],
context: &EmitterContext,
) -> anyhow::Result<()> {
serde_json::to_writer_pretty(
writer,
&SerializedMessages {
diagnostics,
context,
project_dir: self.project_dir.as_deref(),
},
)?;
Ok(())
}
}
struct SerializedMessages<'a> {
diagnostics: &'a [Diagnostic],
context: &'a EmitterContext<'a>,
project_dir: Option<&'a str>,
}
impl Serialize for SerializedMessages<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut s = serializer.serialize_seq(Some(self.diagnostics.len()))?;
let mut fingerprints = HashSet::<u64>::with_capacity(self.diagnostics.len());
for diagnostic in self.diagnostics {
let filename = diagnostic.expect_ruff_filename();
let (start_location, end_location) = if self.context.is_notebook(&filename) {
// We can't give a reasonable location for the structured formats,
// so we show one that's clearly a fallback
Default::default()
} else {
(
diagnostic.expect_ruff_start_location(),
diagnostic.expect_ruff_end_location(),
)
};
let path = self.project_dir.as_ref().map_or_else(
|| relativize_path(&filename),
|project_dir| relativize_path_to(&filename, project_dir),
);
let mut message_fingerprint = fingerprint(diagnostic, &path, 0);
// Make sure that we do not get a fingerprint that is already in use
// by adding in the previously generated one.
while fingerprints.contains(&message_fingerprint) {
message_fingerprint = fingerprint(diagnostic, &path, message_fingerprint);
}
fingerprints.insert(message_fingerprint);
let description = diagnostic.body();
let check_name = diagnostic.secondary_code_or_id();
let value = json!({
"check_name": check_name,
// GitLab doesn't display the separate `check_name` field in a Code Quality report,
// so prepend it to the description too.
"description": format!("{check_name}: {description}"),
"severity": "major",
"fingerprint": format!("{:x}", message_fingerprint),
"location": {
"path": path,
"positions": {
"begin": start_location,
"end": end_location,
},
},
});
s.serialize_element(&value)?;
}
s.end()
}
}
/// Generate a unique fingerprint to identify a violation.
fn fingerprint(message: &Diagnostic, project_path: &str, salt: u64) -> u64 {
let mut hasher = DefaultHasher::new();
salt.hash(&mut hasher);
message.name().hash(&mut hasher);
project_path.hash(&mut hasher);
hasher.finish()
}
#[cfg(test)]
mod tests {
use insta::assert_snapshot;
use crate::message::GitlabEmitter;
use crate::message::tests::{
capture_emitter_output, create_diagnostics, create_syntax_error_diagnostics,
};
#[test]
fn output() {
let mut emitter = GitlabEmitter::default();
let content = capture_emitter_output(&mut emitter, &create_diagnostics());
assert_snapshot!(redact_fingerprint(&content));
}
#[test]
fn syntax_errors() {
let mut emitter = GitlabEmitter::default();
let content = capture_emitter_output(&mut emitter, &create_syntax_error_diagnostics());
assert_snapshot!(redact_fingerprint(&content));
}
// Redact the fingerprint because the default hasher isn't stable across platforms.
fn redact_fingerprint(content: &str) -> String {
static FINGERPRINT_HAY_KEY: &str = r#""fingerprint": ""#;
let mut output = String::with_capacity(content.len());
let mut last = 0;
for (start, _) in content.match_indices(FINGERPRINT_HAY_KEY) {
let fingerprint_hash_start = start + FINGERPRINT_HAY_KEY.len();
output.push_str(&content[last..fingerprint_hash_start]);
output.push_str("<redacted>");
last = fingerprint_hash_start
+ content[fingerprint_hash_start..]
.find('"')
.expect("Expected terminating quote");
}
output.push_str(&content[last..]);
output
}
}

View File

@@ -10,7 +10,6 @@ use ruff_notebook::NotebookIndex;
use ruff_source_file::{LineColumn, OneIndexed};
use crate::fs::relativize_path;
use crate::message::diff::calculate_print_width;
use crate::message::{Emitter, EmitterContext};
use crate::settings::types::UnsafeFixes;
@@ -53,8 +52,8 @@ impl Emitter for GroupedEmitter {
max_column_length = max_column_length.max(message.start_location.column);
}
let row_length = calculate_print_width(max_row_length);
let column_length = calculate_print_width(max_column_length);
let row_length = max_row_length.digits();
let column_length = max_column_length.digits();
// Print the filename.
writeln!(writer, "{}:", relativize_path(&*filename).underline())?;
@@ -131,8 +130,7 @@ impl Display for DisplayGroupedMessage<'_> {
write!(
f,
" {row_padding}",
row_padding = " "
.repeat(self.row_length.get() - calculate_print_width(start_location.line).get())
row_padding = " ".repeat(self.row_length.get() - start_location.line.digits().get())
)?;
// Check if we're working on a jupyter notebook and translate positions with cell accordingly
@@ -159,9 +157,8 @@ impl Display for DisplayGroupedMessage<'_> {
f,
"{row}{sep}{col}{col_padding} {code_and_body}",
sep = ":".cyan(),
col_padding = " ".repeat(
self.column_length.get() - calculate_print_width(start_location.column).get()
),
col_padding =
" ".repeat(self.column_length.get() - start_location.column.digits().get()),
code_and_body = RuleCodeAndBody {
message,
show_fix_status: self.show_fix_status,

View File

@@ -10,7 +10,6 @@ use ruff_db::diagnostic::{
use ruff_db::files::File;
pub use github::GithubEmitter;
pub use gitlab::GitlabEmitter;
pub use grouped::GroupedEmitter;
use ruff_notebook::NotebookIndex;
use ruff_source_file::SourceFile;
@@ -21,9 +20,7 @@ pub use text::TextEmitter;
use crate::Fix;
use crate::registry::Rule;
mod diff;
mod github;
mod gitlab;
mod grouped;
mod sarif;
mod text;

View File

@@ -1,23 +1,19 @@
use std::io::Write;
use ruff_db::diagnostic::{Diagnostic, DiagnosticFormat, DisplayDiagnosticConfig};
use ruff_db::diagnostic::{
Diagnostic, DiagnosticFormat, DisplayDiagnosticConfig, DisplayDiagnostics,
};
use ruff_diagnostics::Applicability;
use crate::message::diff::Diff;
use crate::message::{Emitter, EmitterContext};
use crate::settings::types::UnsafeFixes;
pub struct TextEmitter {
/// Whether to show the diff of a fix, for diagnostics that have a fix.
///
/// Note that this is not currently exposed in the CLI (#7352) and is only used in tests.
show_fix_diff: bool,
config: DisplayDiagnosticConfig,
}
impl Default for TextEmitter {
fn default() -> Self {
Self {
show_fix_diff: false,
config: DisplayDiagnosticConfig::default()
.format(DiagnosticFormat::Concise)
.hide_severity(true)
@@ -35,7 +31,7 @@ impl TextEmitter {
#[must_use]
pub fn with_show_fix_diff(mut self, show_fix_diff: bool) -> Self {
self.show_fix_diff = show_fix_diff;
self.config = self.config.show_fix_diff(show_fix_diff);
self
}
@@ -50,10 +46,8 @@ impl TextEmitter {
}
#[must_use]
pub fn with_unsafe_fixes(mut self, unsafe_fixes: UnsafeFixes) -> Self {
self.config = self
.config
.fix_applicability(unsafe_fixes.required_applicability());
pub fn with_fix_applicability(mut self, applicability: Applicability) -> Self {
self.config = self.config.fix_applicability(applicability);
self
}
@@ -77,15 +71,11 @@ impl Emitter for TextEmitter {
diagnostics: &[Diagnostic],
context: &EmitterContext,
) -> anyhow::Result<()> {
for message in diagnostics {
write!(writer, "{}", message.display(context, &self.config))?;
if self.show_fix_diff {
if let Some(diff) = Diff::from_message(message) {
writeln!(writer, "{diff}")?;
}
}
}
write!(
writer,
"{}",
DisplayDiagnostics::new(context, &self.config, diagnostics)
)?;
Ok(())
}
@@ -94,13 +84,13 @@ impl Emitter for TextEmitter {
#[cfg(test)]
mod tests {
use insta::assert_snapshot;
use ruff_diagnostics::Applicability;
use crate::message::TextEmitter;
use crate::message::tests::{
capture_emitter_notebook_output, capture_emitter_output, create_diagnostics,
create_notebook_diagnostics, create_syntax_error_diagnostics,
};
use crate::settings::types::UnsafeFixes;
#[test]
fn default() {
@@ -125,7 +115,7 @@ mod tests {
let mut emitter = TextEmitter::default()
.with_show_fix_status(true)
.with_show_source(true)
.with_unsafe_fixes(UnsafeFixes::Enabled);
.with_fix_applicability(Applicability::Unsafe);
let content = capture_emitter_output(&mut emitter, &create_diagnostics());
assert_snapshot!(content);
@@ -136,7 +126,7 @@ mod tests {
let mut emitter = TextEmitter::default()
.with_show_fix_status(true)
.with_show_source(true)
.with_unsafe_fixes(UnsafeFixes::Enabled);
.with_fix_applicability(Applicability::Unsafe);
let (messages, notebook_indexes) = create_notebook_diagnostics();
let content = capture_emitter_notebook_output(&mut emitter, &messages, &notebook_indexes);

View File

@@ -40,6 +40,11 @@ pub(crate) const fn is_bad_version_info_in_non_stub_enabled(settings: &LinterSet
settings.preview.is_enabled()
}
/// <https://github.com/astral-sh/ruff/pull/19303>
pub(crate) const fn is_fix_f_string_logging_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled()
}
// https://github.com/astral-sh/ruff/pull/16719
pub(crate) const fn is_fix_manual_dict_comprehension_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled()
@@ -159,6 +164,21 @@ pub(crate) const fn is_fix_os_getcwd_enabled(settings: &LinterSettings) -> bool
settings.preview.is_enabled()
}
// https://github.com/astral-sh/ruff/pull/19514
pub(crate) const fn is_fix_os_mkdir_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled()
}
// https://github.com/astral-sh/ruff/pull/19514
pub(crate) const fn is_fix_os_makedirs_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled()
}
// https://github.com/astral-sh/ruff/pull/20009
pub(crate) const fn is_fix_os_symlink_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled()
}
// https://github.com/astral-sh/ruff/pull/11436
// https://github.com/astral-sh/ruff/pull/11168
pub(crate) const fn is_dunder_init_fix_unused_import_enabled(settings: &LinterSettings) -> bool {
@@ -230,3 +250,13 @@ pub(crate) const fn is_add_future_annotations_imports_enabled(settings: &LinterS
pub(crate) const fn is_trailing_comma_type_params_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled()
}
// https://github.com/astral-sh/ruff/pull/19851
pub(crate) const fn is_maxsplit_without_separator_fix_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled()
}
// https://github.com/astral-sh/ruff/pull/20106
pub(crate) const fn is_bidi_forbid_arabic_letter_mark_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled()
}

View File

@@ -354,7 +354,10 @@ impl Renamer {
))
}
// Avoid renaming builtins and other "special" bindings.
BindingKind::FutureImport | BindingKind::Builtin | BindingKind::Export(_) => None,
BindingKind::FutureImport
| BindingKind::Builtin
| BindingKind::Export(_)
| BindingKind::DunderClassCell => None,
// By default, replace the binding's name with the target name.
BindingKind::Annotation
| BindingKind::Argument

View File

@@ -215,6 +215,12 @@ fn check_names_moved_to_provider(checker: &Checker, expr: &Expr, ranged: TextRan
version: "0.0.1",
}
}
["airflow", "sensors", "bash", "BashSensor"] => ProviderReplacement::AutoImport {
module: "airflow.providers.standard.sensor.bash",
name: "BashSensor",
provider: "standard",
version: "0.0.1",
},
[
"airflow",
"sensors",
@@ -243,6 +249,12 @@ fn check_names_moved_to_provider(checker: &Checker, expr: &Expr, ranged: TextRan
provider: "standard",
version: "0.0.2",
},
["airflow", "sensors", "python", "PythonSensor"] => ProviderReplacement::AutoImport {
module: "airflow.providers.standard.sensors.python",
name: "PythonSensor",
provider: "standard",
version: "0.0.1",
},
[
"airflow",
"sensors",

View File

@@ -227,13 +227,26 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
module: "airflow.sdk",
name: (*rest).to_string(),
},
[
"airflow",
"decorators",
"base",
rest @ ("DecoratedMappedOperator"
| "DecoratedOperator"
| "TaskDecorator"
| "get_unique_task_id"
| "task_decorator_factory"),
] => Replacement::SourceModuleMoved {
module: "airflow.sdk.bases.decorator",
name: (*rest).to_string(),
},
// airflow.io
["airflow", "io", "path", "ObjectStoragePath"] => Replacement::SourceModuleMoved {
module: "airflow.sdk",
name: "ObjectStoragePath".to_string(),
},
["airflow", "io", "storage", "attach"] => Replacement::SourceModuleMoved {
["airflow", "io", "store", "attach"] => Replacement::SourceModuleMoved {
module: "airflow.sdk.io",
name: "attach".to_string(),
},
@@ -245,6 +258,10 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
name: (*rest).to_string(),
}
}
["airflow", "models", "Param"] => Replacement::AutoImport {
module: "airflow.sdk.definitions.param",
name: "Param",
},
// airflow.models.baseoperator
[
@@ -260,16 +277,30 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
module: "airflow.sdk",
name: "BaseOperatorLink",
},
// airflow.model..DAG
["airflow", "models", .., "DAG"] => Replacement::SourceModuleMoved {
module: "airflow.sdk",
name: "DAG".to_string(),
},
// airflow.sensors.base
[
"airflow",
"sensors",
"base",
rest @ ("BaseSensorOperator" | "PokeReturnValue" | "poke_mode_only"),
] => Replacement::SourceModuleMoved {
module: "airflow.sdk",
name: (*rest).to_string(),
},
// airflow.timetables
["airflow", "timetables", "datasets", "DatasetOrTimeSchedule"] => Replacement::AutoImport {
module: "airflow.timetables.assets",
name: "AssetOrTimeSchedule",
},
// airflow.utils
[
"airflow",

View File

@@ -12,16 +12,14 @@ AIR301 [*] `schedule_interval` is removed in Airflow 3.0
23 | DAG(dag_id="class_timetable", timetable=NullTimetable())
|
help: Use `schedule` instead
Safe fix
18 18 |
19 19 | DAG(dag_id="class_schedule", schedule="@hourly")
20 20 |
21 |-DAG(dag_id="class_schedule_interval", schedule_interval="@hourly")
21 |+DAG(dag_id="class_schedule_interval", schedule="@hourly")
22 22 |
23 23 | DAG(dag_id="class_timetable", timetable=NullTimetable())
24 24 |
18 |
19 | DAG(dag_id="class_schedule", schedule="@hourly")
20 |
- DAG(dag_id="class_schedule_interval", schedule_interval="@hourly")
21 + DAG(dag_id="class_schedule_interval", schedule="@hourly")
22 |
23 | DAG(dag_id="class_timetable", timetable=NullTimetable())
24 |
AIR301 [*] `timetable` is removed in Airflow 3.0
--> AIR301_args.py:23:31
@@ -32,16 +30,14 @@ AIR301 [*] `timetable` is removed in Airflow 3.0
| ^^^^^^^^^
|
help: Use `schedule` instead
Safe fix
20 20 |
21 21 | DAG(dag_id="class_schedule_interval", schedule_interval="@hourly")
22 22 |
23 |-DAG(dag_id="class_timetable", timetable=NullTimetable())
23 |+DAG(dag_id="class_timetable", schedule=NullTimetable())
24 24 |
25 25 |
26 26 | DAG(dag_id="class_fail_stop", fail_stop=True)
20 |
21 | DAG(dag_id="class_schedule_interval", schedule_interval="@hourly")
22 |
- DAG(dag_id="class_timetable", timetable=NullTimetable())
23 + DAG(dag_id="class_timetable", schedule=NullTimetable())
24 |
25 |
26 | DAG(dag_id="class_fail_stop", fail_stop=True)
AIR301 [*] `fail_stop` is removed in Airflow 3.0
--> AIR301_args.py:26:31
@@ -52,16 +48,14 @@ AIR301 [*] `fail_stop` is removed in Airflow 3.0
28 | DAG(dag_id="class_default_view", default_view="dag_default_view")
|
help: Use `fail_fast` instead
Safe fix
23 23 | DAG(dag_id="class_timetable", timetable=NullTimetable())
24 24 |
25 25 |
26 |-DAG(dag_id="class_fail_stop", fail_stop=True)
26 |+DAG(dag_id="class_fail_stop", fail_fast=True)
27 27 |
28 28 | DAG(dag_id="class_default_view", default_view="dag_default_view")
29 29 |
23 | DAG(dag_id="class_timetable", timetable=NullTimetable())
24 |
25 |
- DAG(dag_id="class_fail_stop", fail_stop=True)
26 + DAG(dag_id="class_fail_stop", fail_fast=True)
27 |
28 | DAG(dag_id="class_default_view", default_view="dag_default_view")
29 |
AIR301 `default_view` is removed in Airflow 3.0
--> AIR301_args.py:28:34
@@ -94,16 +88,14 @@ AIR301 [*] `schedule_interval` is removed in Airflow 3.0
43 | pass
|
help: Use `schedule` instead
Safe fix
38 38 | pass
39 39 |
40 40 |
41 |-@dag(schedule_interval="0 * * * *")
41 |+@dag(schedule="0 * * * *")
42 42 | def decorator_schedule_interval():
43 43 | pass
44 44 |
38 | pass
39 |
40 |
- @dag(schedule_interval="0 * * * *")
41 + @dag(schedule="0 * * * *")
42 | def decorator_schedule_interval():
43 | pass
44 |
AIR301 [*] `timetable` is removed in Airflow 3.0
--> AIR301_args.py:46:6
@@ -114,16 +106,14 @@ AIR301 [*] `timetable` is removed in Airflow 3.0
48 | pass
|
help: Use `schedule` instead
Safe fix
43 43 | pass
44 44 |
45 45 |
46 |-@dag(timetable=NullTimetable())
46 |+@dag(schedule=NullTimetable())
47 47 | def decorator_timetable():
48 48 | pass
49 49 |
43 | pass
44 |
45 |
- @dag(timetable=NullTimetable())
46 + @dag(schedule=NullTimetable())
47 | def decorator_timetable():
48 | pass
49 |
AIR301 [*] `execution_date` is removed in Airflow 3.0
--> AIR301_args.py:54:62
@@ -136,16 +126,14 @@ AIR301 [*] `execution_date` is removed in Airflow 3.0
56 | trigger_dagrun_op2 = TriggerDagRunOperator(
|
help: Use `logical_date` instead
Safe fix
51 51 | @dag()
52 52 | def decorator_deprecated_operator_args():
53 53 | trigger_dagrun_op = trigger_dagrun.TriggerDagRunOperator(
54 |- task_id="trigger_dagrun_op1", trigger_dag_id="test", execution_date="2024-12-04"
54 |+ task_id="trigger_dagrun_op1", trigger_dag_id="test", logical_date="2024-12-04"
55 55 | )
56 56 | trigger_dagrun_op2 = TriggerDagRunOperator(
57 57 | task_id="trigger_dagrun_op2", trigger_dag_id="test", execution_date="2024-12-04"
51 | @dag()
52 | def decorator_deprecated_operator_args():
53 | trigger_dagrun_op = trigger_dagrun.TriggerDagRunOperator(
- task_id="trigger_dagrun_op1", trigger_dag_id="test", execution_date="2024-12-04"
54 + task_id="trigger_dagrun_op1", trigger_dag_id="test", logical_date="2024-12-04"
55 | )
56 | trigger_dagrun_op2 = TriggerDagRunOperator(
57 | task_id="trigger_dagrun_op2", trigger_dag_id="test", execution_date="2024-12-04"
AIR301 [*] `execution_date` is removed in Airflow 3.0
--> AIR301_args.py:57:62
@@ -157,16 +145,14 @@ AIR301 [*] `execution_date` is removed in Airflow 3.0
58 | )
|
help: Use `logical_date` instead
Safe fix
54 54 | task_id="trigger_dagrun_op1", trigger_dag_id="test", execution_date="2024-12-04"
55 55 | )
56 56 | trigger_dagrun_op2 = TriggerDagRunOperator(
57 |- task_id="trigger_dagrun_op2", trigger_dag_id="test", execution_date="2024-12-04"
57 |+ task_id="trigger_dagrun_op2", trigger_dag_id="test", logical_date="2024-12-04"
58 58 | )
59 59 |
60 60 | branch_dt_op = datetime.BranchDateTimeOperator(
54 | task_id="trigger_dagrun_op1", trigger_dag_id="test", execution_date="2024-12-04"
55 | )
56 | trigger_dagrun_op2 = TriggerDagRunOperator(
- task_id="trigger_dagrun_op2", trigger_dag_id="test", execution_date="2024-12-04"
57 + task_id="trigger_dagrun_op2", trigger_dag_id="test", logical_date="2024-12-04"
58 | )
59 |
60 | branch_dt_op = datetime.BranchDateTimeOperator(
AIR301 [*] `use_task_execution_day` is removed in Airflow 3.0
--> AIR301_args.py:61:33
@@ -178,16 +164,14 @@ AIR301 [*] `use_task_execution_day` is removed in Airflow 3.0
63 | branch_dt_op2 = BranchDateTimeOperator(
|
help: Use `use_task_logical_date` instead
Safe fix
58 58 | )
59 59 |
60 60 | branch_dt_op = datetime.BranchDateTimeOperator(
61 |- task_id="branch_dt_op", use_task_execution_day=True, task_concurrency=5
61 |+ task_id="branch_dt_op", use_task_logical_date=True, task_concurrency=5
62 62 | )
63 63 | branch_dt_op2 = BranchDateTimeOperator(
64 64 | task_id="branch_dt_op2",
58 | )
59 |
60 | branch_dt_op = datetime.BranchDateTimeOperator(
- task_id="branch_dt_op", use_task_execution_day=True, task_concurrency=5
61 + task_id="branch_dt_op", use_task_logical_date=True, task_concurrency=5
62 | )
63 | branch_dt_op2 = BranchDateTimeOperator(
64 | task_id="branch_dt_op2",
AIR301 [*] `task_concurrency` is removed in Airflow 3.0
--> AIR301_args.py:61:62
@@ -199,16 +183,14 @@ AIR301 [*] `task_concurrency` is removed in Airflow 3.0
63 | branch_dt_op2 = BranchDateTimeOperator(
|
help: Use `max_active_tis_per_dag` instead
Safe fix
58 58 | )
59 59 |
60 60 | branch_dt_op = datetime.BranchDateTimeOperator(
61 |- task_id="branch_dt_op", use_task_execution_day=True, task_concurrency=5
61 |+ task_id="branch_dt_op", use_task_execution_day=True, max_active_tis_per_dag=5
62 62 | )
63 63 | branch_dt_op2 = BranchDateTimeOperator(
64 64 | task_id="branch_dt_op2",
58 | )
59 |
60 | branch_dt_op = datetime.BranchDateTimeOperator(
- task_id="branch_dt_op", use_task_execution_day=True, task_concurrency=5
61 + task_id="branch_dt_op", use_task_execution_day=True, max_active_tis_per_dag=5
62 | )
63 | branch_dt_op2 = BranchDateTimeOperator(
64 | task_id="branch_dt_op2",
AIR301 [*] `use_task_execution_day` is removed in Airflow 3.0
--> AIR301_args.py:65:9
@@ -221,16 +203,14 @@ AIR301 [*] `use_task_execution_day` is removed in Airflow 3.0
67 | )
|
help: Use `use_task_logical_date` instead
Safe fix
62 62 | )
63 63 | branch_dt_op2 = BranchDateTimeOperator(
64 64 | task_id="branch_dt_op2",
65 |- use_task_execution_day=True,
65 |+ use_task_logical_date=True,
66 66 | sla=timedelta(seconds=10),
67 67 | )
68 68 |
62 | )
63 | branch_dt_op2 = BranchDateTimeOperator(
64 | task_id="branch_dt_op2",
- use_task_execution_day=True,
65 + use_task_logical_date=True,
66 | sla=timedelta(seconds=10),
67 | )
68 |
AIR301 [*] `use_task_execution_day` is removed in Airflow 3.0
--> AIR301_args.py:92:9
@@ -242,16 +222,14 @@ AIR301 [*] `use_task_execution_day` is removed in Airflow 3.0
93 | )
|
help: Use `use_task_logical_date` instead
Safe fix
89 89 | follow_task_ids_if_false=None,
90 90 | follow_task_ids_if_true=None,
91 91 | week_day=1,
92 |- use_task_execution_day=True,
92 |+ use_task_logical_date=True,
93 93 | )
94 94 |
95 95 | trigger_dagrun_op >> trigger_dagrun_op2
89 | follow_task_ids_if_false=None,
90 | follow_task_ids_if_true=None,
91 | week_day=1,
- use_task_execution_day=True,
92 + use_task_logical_date=True,
93 | )
94 |
95 | trigger_dagrun_op >> trigger_dagrun_op2
AIR301 `filename_template` is removed in Airflow 3.0
--> AIR301_args.py:102:15

View File

@@ -11,16 +11,14 @@ AIR301 [*] `iter_datasets` is removed in Airflow 3.0
26 | dataset_from_root.iter_dataset_aliases()
|
help: Use `iter_assets` instead
Safe fix
22 22 |
23 23 | # airflow.Dataset
24 24 | dataset_from_root = DatasetFromRoot()
25 |-dataset_from_root.iter_datasets()
25 |+dataset_from_root.iter_assets()
26 26 | dataset_from_root.iter_dataset_aliases()
27 27 |
28 28 | # airflow.datasets
22 |
23 | # airflow.Dataset
24 | dataset_from_root = DatasetFromRoot()
- dataset_from_root.iter_datasets()
25 + dataset_from_root.iter_assets()
26 | dataset_from_root.iter_dataset_aliases()
27 |
28 | # airflow.datasets
AIR301 [*] `iter_dataset_aliases` is removed in Airflow 3.0
--> AIR301_class_attribute.py:26:19
@@ -33,16 +31,14 @@ AIR301 [*] `iter_dataset_aliases` is removed in Airflow 3.0
28 | # airflow.datasets
|
help: Use `iter_asset_aliases` instead
Safe fix
23 23 | # airflow.Dataset
24 24 | dataset_from_root = DatasetFromRoot()
25 25 | dataset_from_root.iter_datasets()
26 |-dataset_from_root.iter_dataset_aliases()
26 |+dataset_from_root.iter_asset_aliases()
27 27 |
28 28 | # airflow.datasets
29 29 | dataset_to_test_method_call = Dataset()
23 | # airflow.Dataset
24 | dataset_from_root = DatasetFromRoot()
25 | dataset_from_root.iter_datasets()
- dataset_from_root.iter_dataset_aliases()
26 + dataset_from_root.iter_asset_aliases()
27 |
28 | # airflow.datasets
29 | dataset_to_test_method_call = Dataset()
AIR301 [*] `iter_datasets` is removed in Airflow 3.0
--> AIR301_class_attribute.py:30:29
@@ -54,16 +50,14 @@ AIR301 [*] `iter_datasets` is removed in Airflow 3.0
31 | dataset_to_test_method_call.iter_dataset_aliases()
|
help: Use `iter_assets` instead
Safe fix
27 27 |
28 28 | # airflow.datasets
29 29 | dataset_to_test_method_call = Dataset()
30 |-dataset_to_test_method_call.iter_datasets()
30 |+dataset_to_test_method_call.iter_assets()
31 31 | dataset_to_test_method_call.iter_dataset_aliases()
32 32 |
33 33 | alias_to_test_method_call = DatasetAlias()
27 |
28 | # airflow.datasets
29 | dataset_to_test_method_call = Dataset()
- dataset_to_test_method_call.iter_datasets()
30 + dataset_to_test_method_call.iter_assets()
31 | dataset_to_test_method_call.iter_dataset_aliases()
32 |
33 | alias_to_test_method_call = DatasetAlias()
AIR301 [*] `iter_dataset_aliases` is removed in Airflow 3.0
--> AIR301_class_attribute.py:31:29
@@ -76,16 +70,14 @@ AIR301 [*] `iter_dataset_aliases` is removed in Airflow 3.0
33 | alias_to_test_method_call = DatasetAlias()
|
help: Use `iter_asset_aliases` instead
Safe fix
28 28 | # airflow.datasets
29 29 | dataset_to_test_method_call = Dataset()
30 30 | dataset_to_test_method_call.iter_datasets()
31 |-dataset_to_test_method_call.iter_dataset_aliases()
31 |+dataset_to_test_method_call.iter_asset_aliases()
32 32 |
33 33 | alias_to_test_method_call = DatasetAlias()
34 34 | alias_to_test_method_call.iter_datasets()
28 | # airflow.datasets
29 | dataset_to_test_method_call = Dataset()
30 | dataset_to_test_method_call.iter_datasets()
- dataset_to_test_method_call.iter_dataset_aliases()
31 + dataset_to_test_method_call.iter_asset_aliases()
32 |
33 | alias_to_test_method_call = DatasetAlias()
34 | alias_to_test_method_call.iter_datasets()
AIR301 [*] `iter_datasets` is removed in Airflow 3.0
--> AIR301_class_attribute.py:34:27
@@ -96,16 +88,14 @@ AIR301 [*] `iter_datasets` is removed in Airflow 3.0
35 | alias_to_test_method_call.iter_dataset_aliases()
|
help: Use `iter_assets` instead
Safe fix
31 31 | dataset_to_test_method_call.iter_dataset_aliases()
32 32 |
33 33 | alias_to_test_method_call = DatasetAlias()
34 |-alias_to_test_method_call.iter_datasets()
34 |+alias_to_test_method_call.iter_assets()
35 35 | alias_to_test_method_call.iter_dataset_aliases()
36 36 |
37 37 | any_to_test_method_call = DatasetAny()
31 | dataset_to_test_method_call.iter_dataset_aliases()
32 |
33 | alias_to_test_method_call = DatasetAlias()
- alias_to_test_method_call.iter_datasets()
34 + alias_to_test_method_call.iter_assets()
35 | alias_to_test_method_call.iter_dataset_aliases()
36 |
37 | any_to_test_method_call = DatasetAny()
AIR301 [*] `iter_dataset_aliases` is removed in Airflow 3.0
--> AIR301_class_attribute.py:35:27
@@ -118,16 +108,14 @@ AIR301 [*] `iter_dataset_aliases` is removed in Airflow 3.0
37 | any_to_test_method_call = DatasetAny()
|
help: Use `iter_asset_aliases` instead
Safe fix
32 32 |
33 33 | alias_to_test_method_call = DatasetAlias()
34 34 | alias_to_test_method_call.iter_datasets()
35 |-alias_to_test_method_call.iter_dataset_aliases()
35 |+alias_to_test_method_call.iter_asset_aliases()
36 36 |
37 37 | any_to_test_method_call = DatasetAny()
38 38 | any_to_test_method_call.iter_datasets()
32 |
33 | alias_to_test_method_call = DatasetAlias()
34 | alias_to_test_method_call.iter_datasets()
- alias_to_test_method_call.iter_dataset_aliases()
35 + alias_to_test_method_call.iter_asset_aliases()
36 |
37 | any_to_test_method_call = DatasetAny()
38 | any_to_test_method_call.iter_datasets()
AIR301 [*] `iter_datasets` is removed in Airflow 3.0
--> AIR301_class_attribute.py:38:25
@@ -138,16 +126,14 @@ AIR301 [*] `iter_datasets` is removed in Airflow 3.0
39 | any_to_test_method_call.iter_dataset_aliases()
|
help: Use `iter_assets` instead
Safe fix
35 35 | alias_to_test_method_call.iter_dataset_aliases()
36 36 |
37 37 | any_to_test_method_call = DatasetAny()
38 |-any_to_test_method_call.iter_datasets()
38 |+any_to_test_method_call.iter_assets()
39 39 | any_to_test_method_call.iter_dataset_aliases()
40 40 |
41 41 | # airflow.datasets.manager
35 | alias_to_test_method_call.iter_dataset_aliases()
36 |
37 | any_to_test_method_call = DatasetAny()
- any_to_test_method_call.iter_datasets()
38 + any_to_test_method_call.iter_assets()
39 | any_to_test_method_call.iter_dataset_aliases()
40 |
41 | # airflow.datasets.manager
AIR301 [*] `iter_dataset_aliases` is removed in Airflow 3.0
--> AIR301_class_attribute.py:39:25
@@ -160,16 +146,14 @@ AIR301 [*] `iter_dataset_aliases` is removed in Airflow 3.0
41 | # airflow.datasets.manager
|
help: Use `iter_asset_aliases` instead
Safe fix
36 36 |
37 37 | any_to_test_method_call = DatasetAny()
38 38 | any_to_test_method_call.iter_datasets()
39 |-any_to_test_method_call.iter_dataset_aliases()
39 |+any_to_test_method_call.iter_asset_aliases()
40 40 |
41 41 | # airflow.datasets.manager
42 42 | dm = DatasetManager()
36 |
37 | any_to_test_method_call = DatasetAny()
38 | any_to_test_method_call.iter_datasets()
- any_to_test_method_call.iter_dataset_aliases()
39 + any_to_test_method_call.iter_asset_aliases()
40 |
41 | # airflow.datasets.manager
42 | dm = DatasetManager()
AIR301 [*] `airflow.datasets.manager.DatasetManager` is removed in Airflow 3.0
--> AIR301_class_attribute.py:42:6
@@ -181,24 +165,22 @@ AIR301 [*] `airflow.datasets.manager.DatasetManager` is removed in Airflow 3.0
44 | dm.create_datasets()
|
help: Use `AssetManager` from `airflow.assets.manager` instead.
Safe fix
19 19 | from airflow.providers_manager import ProvidersManager
20 20 | from airflow.secrets.base_secrets import BaseSecretsBackend
21 21 | from airflow.secrets.local_filesystem import LocalFilesystemBackend
22 |+from airflow.assets.manager import AssetManager
22 23 |
23 24 | # airflow.Dataset
24 25 | dataset_from_root = DatasetFromRoot()
19 | from airflow.providers_manager import ProvidersManager
20 | from airflow.secrets.base_secrets import BaseSecretsBackend
21 | from airflow.secrets.local_filesystem import LocalFilesystemBackend
22 + from airflow.assets.manager import AssetManager
23 |
24 | # airflow.Dataset
25 | dataset_from_root = DatasetFromRoot()
--------------------------------------------------------------------------------
39 40 | any_to_test_method_call.iter_dataset_aliases()
40 41 |
41 42 | # airflow.datasets.manager
42 |-dm = DatasetManager()
43 |+dm = AssetManager()
43 44 | dm.register_dataset_change()
44 45 | dm.create_datasets()
45 46 | dm.notify_dataset_created()
40 | any_to_test_method_call.iter_dataset_aliases()
41 |
42 | # airflow.datasets.manager
- dm = DatasetManager()
43 + dm = AssetManager()
44 | dm.register_dataset_change()
45 | dm.create_datasets()
46 | dm.notify_dataset_created()
AIR301 [*] `register_dataset_change` is removed in Airflow 3.0
--> AIR301_class_attribute.py:43:4
@@ -211,16 +193,14 @@ AIR301 [*] `register_dataset_change` is removed in Airflow 3.0
45 | dm.notify_dataset_created()
|
help: Use `register_asset_change` instead
Safe fix
40 40 |
41 41 | # airflow.datasets.manager
42 42 | dm = DatasetManager()
43 |-dm.register_dataset_change()
43 |+dm.register_asset_change()
44 44 | dm.create_datasets()
45 45 | dm.notify_dataset_created()
46 46 | dm.notify_dataset_changed()
40 |
41 | # airflow.datasets.manager
42 | dm = DatasetManager()
- dm.register_dataset_change()
43 + dm.register_asset_change()
44 | dm.create_datasets()
45 | dm.notify_dataset_created()
46 | dm.notify_dataset_changed()
AIR301 [*] `create_datasets` is removed in Airflow 3.0
--> AIR301_class_attribute.py:44:4
@@ -233,16 +213,14 @@ AIR301 [*] `create_datasets` is removed in Airflow 3.0
46 | dm.notify_dataset_changed()
|
help: Use `create_assets` instead
Safe fix
41 41 | # airflow.datasets.manager
42 42 | dm = DatasetManager()
43 43 | dm.register_dataset_change()
44 |-dm.create_datasets()
44 |+dm.create_assets()
45 45 | dm.notify_dataset_created()
46 46 | dm.notify_dataset_changed()
47 47 | dm.notify_dataset_alias_created()
41 | # airflow.datasets.manager
42 | dm = DatasetManager()
43 | dm.register_dataset_change()
- dm.create_datasets()
44 + dm.create_assets()
45 | dm.notify_dataset_created()
46 | dm.notify_dataset_changed()
47 | dm.notify_dataset_alias_created()
AIR301 [*] `notify_dataset_created` is removed in Airflow 3.0
--> AIR301_class_attribute.py:45:4
@@ -255,16 +233,14 @@ AIR301 [*] `notify_dataset_created` is removed in Airflow 3.0
47 | dm.notify_dataset_alias_created()
|
help: Use `notify_asset_created` instead
Safe fix
42 42 | dm = DatasetManager()
43 43 | dm.register_dataset_change()
44 44 | dm.create_datasets()
45 |-dm.notify_dataset_created()
45 |+dm.notify_asset_created()
46 46 | dm.notify_dataset_changed()
47 47 | dm.notify_dataset_alias_created()
48 48 |
42 | dm = DatasetManager()
43 | dm.register_dataset_change()
44 | dm.create_datasets()
- dm.notify_dataset_created()
45 + dm.notify_asset_created()
46 | dm.notify_dataset_changed()
47 | dm.notify_dataset_alias_created()
48 |
AIR301 [*] `notify_dataset_changed` is removed in Airflow 3.0
--> AIR301_class_attribute.py:46:4
@@ -276,16 +252,14 @@ AIR301 [*] `notify_dataset_changed` is removed in Airflow 3.0
47 | dm.notify_dataset_alias_created()
|
help: Use `notify_asset_changed` instead
Safe fix
43 43 | dm.register_dataset_change()
44 44 | dm.create_datasets()
45 45 | dm.notify_dataset_created()
46 |-dm.notify_dataset_changed()
46 |+dm.notify_asset_changed()
47 47 | dm.notify_dataset_alias_created()
48 48 |
49 49 | # airflow.lineage.hook
43 | dm.register_dataset_change()
44 | dm.create_datasets()
45 | dm.notify_dataset_created()
- dm.notify_dataset_changed()
46 + dm.notify_asset_changed()
47 | dm.notify_dataset_alias_created()
48 |
49 | # airflow.lineage.hook
AIR301 [*] `notify_dataset_alias_created` is removed in Airflow 3.0
--> AIR301_class_attribute.py:47:4
@@ -298,16 +272,14 @@ AIR301 [*] `notify_dataset_alias_created` is removed in Airflow 3.0
49 | # airflow.lineage.hook
|
help: Use `notify_asset_alias_created` instead
Safe fix
44 44 | dm.create_datasets()
45 45 | dm.notify_dataset_created()
46 46 | dm.notify_dataset_changed()
47 |-dm.notify_dataset_alias_created()
47 |+dm.notify_asset_alias_created()
48 48 |
49 49 | # airflow.lineage.hook
50 50 | dl_info = DatasetLineageInfo()
44 | dm.create_datasets()
45 | dm.notify_dataset_created()
46 | dm.notify_dataset_changed()
- dm.notify_dataset_alias_created()
47 + dm.notify_asset_alias_created()
48 |
49 | # airflow.lineage.hook
50 | dl_info = DatasetLineageInfo()
AIR301 [*] `airflow.lineage.hook.DatasetLineageInfo` is removed in Airflow 3.0
--> AIR301_class_attribute.py:50:11
@@ -318,25 +290,23 @@ AIR301 [*] `airflow.lineage.hook.DatasetLineageInfo` is removed in Airflow 3.0
51 | dl_info.dataset
|
help: Use `AssetLineageInfo` from `airflow.lineage.hook` instead.
Safe fix
9 9 | DatasetAny,
10 10 | )
11 11 | from airflow.datasets.manager import DatasetManager
12 |-from airflow.lineage.hook import DatasetLineageInfo, HookLineageCollector
12 |+from airflow.lineage.hook import DatasetLineageInfo, HookLineageCollector, AssetLineageInfo
13 13 | from airflow.providers.amazon.aws.auth_manager.aws_auth_manager import AwsAuthManager
14 14 | from airflow.providers.apache.beam.hooks import BeamHook, NotAir302HookError
15 15 | from airflow.providers.google.cloud.secrets.secret_manager import (
9 | DatasetAny,
10 | )
11 | from airflow.datasets.manager import DatasetManager
- from airflow.lineage.hook import DatasetLineageInfo, HookLineageCollector
12 + from airflow.lineage.hook import DatasetLineageInfo, HookLineageCollector, AssetLineageInfo
13 | from airflow.providers.amazon.aws.auth_manager.aws_auth_manager import AwsAuthManager
14 | from airflow.providers.apache.beam.hooks import BeamHook, NotAir302HookError
15 | from airflow.providers.google.cloud.secrets.secret_manager import (
--------------------------------------------------------------------------------
47 47 | dm.notify_dataset_alias_created()
48 48 |
49 49 | # airflow.lineage.hook
50 |-dl_info = DatasetLineageInfo()
50 |+dl_info = AssetLineageInfo()
51 51 | dl_info.dataset
52 52 |
53 53 | hlc = HookLineageCollector()
47 | dm.notify_dataset_alias_created()
48 |
49 | # airflow.lineage.hook
- dl_info = DatasetLineageInfo()
50 + dl_info = AssetLineageInfo()
51 | dl_info.dataset
52 |
53 | hlc = HookLineageCollector()
AIR301 [*] `dataset` is removed in Airflow 3.0
--> AIR301_class_attribute.py:51:9
@@ -349,16 +319,14 @@ AIR301 [*] `dataset` is removed in Airflow 3.0
53 | hlc = HookLineageCollector()
|
help: Use `asset` instead
Safe fix
48 48 |
49 49 | # airflow.lineage.hook
50 50 | dl_info = DatasetLineageInfo()
51 |-dl_info.dataset
51 |+dl_info.asset
52 52 |
53 53 | hlc = HookLineageCollector()
54 54 | hlc.create_dataset()
48 |
49 | # airflow.lineage.hook
50 | dl_info = DatasetLineageInfo()
- dl_info.dataset
51 + dl_info.asset
52 |
53 | hlc = HookLineageCollector()
54 | hlc.create_dataset()
AIR301 [*] `create_dataset` is removed in Airflow 3.0
--> AIR301_class_attribute.py:54:5
@@ -370,16 +338,14 @@ AIR301 [*] `create_dataset` is removed in Airflow 3.0
56 | hlc.add_output_dataset()
|
help: Use `create_asset` instead
Safe fix
51 51 | dl_info.dataset
52 52 |
53 53 | hlc = HookLineageCollector()
54 |-hlc.create_dataset()
54 |+hlc.create_asset()
55 55 | hlc.add_input_dataset()
56 56 | hlc.add_output_dataset()
57 57 | hlc.collected_datasets()
51 | dl_info.dataset
52 |
53 | hlc = HookLineageCollector()
- hlc.create_dataset()
54 + hlc.create_asset()
55 | hlc.add_input_dataset()
56 | hlc.add_output_dataset()
57 | hlc.collected_datasets()
AIR301 [*] `add_input_dataset` is removed in Airflow 3.0
--> AIR301_class_attribute.py:55:5
@@ -392,16 +358,14 @@ AIR301 [*] `add_input_dataset` is removed in Airflow 3.0
57 | hlc.collected_datasets()
|
help: Use `add_input_asset` instead
Safe fix
52 52 |
53 53 | hlc = HookLineageCollector()
54 54 | hlc.create_dataset()
55 |-hlc.add_input_dataset()
55 |+hlc.add_input_asset()
56 56 | hlc.add_output_dataset()
57 57 | hlc.collected_datasets()
58 58 |
52 |
53 | hlc = HookLineageCollector()
54 | hlc.create_dataset()
- hlc.add_input_dataset()
55 + hlc.add_input_asset()
56 | hlc.add_output_dataset()
57 | hlc.collected_datasets()
58 |
AIR301 [*] `add_output_dataset` is removed in Airflow 3.0
--> AIR301_class_attribute.py:56:5
@@ -413,16 +377,14 @@ AIR301 [*] `add_output_dataset` is removed in Airflow 3.0
57 | hlc.collected_datasets()
|
help: Use `add_output_asset` instead
Safe fix
53 53 | hlc = HookLineageCollector()
54 54 | hlc.create_dataset()
55 55 | hlc.add_input_dataset()
56 |-hlc.add_output_dataset()
56 |+hlc.add_output_asset()
57 57 | hlc.collected_datasets()
58 58 |
59 59 | # airflow.providers.amazon.auth_manager.aws_auth_manager
53 | hlc = HookLineageCollector()
54 | hlc.create_dataset()
55 | hlc.add_input_dataset()
- hlc.add_output_dataset()
56 + hlc.add_output_asset()
57 | hlc.collected_datasets()
58 |
59 | # airflow.providers.amazon.auth_manager.aws_auth_manager
AIR301 [*] `collected_datasets` is removed in Airflow 3.0
--> AIR301_class_attribute.py:57:5
@@ -435,16 +397,14 @@ AIR301 [*] `collected_datasets` is removed in Airflow 3.0
59 | # airflow.providers.amazon.auth_manager.aws_auth_manager
|
help: Use `collected_assets` instead
Safe fix
54 54 | hlc.create_dataset()
55 55 | hlc.add_input_dataset()
56 56 | hlc.add_output_dataset()
57 |-hlc.collected_datasets()
57 |+hlc.collected_assets()
58 58 |
59 59 | # airflow.providers.amazon.auth_manager.aws_auth_manager
60 60 | aam = AwsAuthManager()
54 | hlc.create_dataset()
55 | hlc.add_input_dataset()
56 | hlc.add_output_dataset()
- hlc.collected_datasets()
57 + hlc.collected_assets()
58 |
59 | # airflow.providers.amazon.auth_manager.aws_auth_manager
60 | aam = AwsAuthManager()
AIR301 [*] `is_authorized_dataset` is removed in Airflow 3.0
--> AIR301_class_attribute.py:61:5
@@ -457,16 +417,14 @@ AIR301 [*] `is_authorized_dataset` is removed in Airflow 3.0
63 | # airflow.providers.apache.beam.hooks
|
help: Use `is_authorized_asset` instead
Safe fix
58 58 |
59 59 | # airflow.providers.amazon.auth_manager.aws_auth_manager
60 60 | aam = AwsAuthManager()
61 |-aam.is_authorized_dataset()
61 |+aam.is_authorized_asset()
62 62 |
63 63 | # airflow.providers.apache.beam.hooks
64 64 | # check get_conn_uri is caught if the class inherits from an airflow hook
58 |
59 | # airflow.providers.amazon.auth_manager.aws_auth_manager
60 | aam = AwsAuthManager()
- aam.is_authorized_dataset()
61 + aam.is_authorized_asset()
62 |
63 | # airflow.providers.apache.beam.hooks
64 | # check get_conn_uri is caught if the class inherits from an airflow hook
AIR301 [*] `get_conn_uri` is removed in Airflow 3.0
--> AIR301_class_attribute.py:73:13
@@ -478,16 +436,14 @@ AIR301 [*] `get_conn_uri` is removed in Airflow 3.0
74 | csm_backend.get_connections()
|
help: Use `get_conn_value` instead
Safe fix
70 70 |
71 71 | # airflow.providers.google.cloud.secrets.secret_manager
72 72 | csm_backend = CloudSecretManagerBackend()
73 |-csm_backend.get_conn_uri()
73 |+csm_backend.get_conn_value()
74 74 | csm_backend.get_connections()
75 75 |
76 76 | # airflow.providers.hashicorp.secrets.vault
70 |
71 | # airflow.providers.google.cloud.secrets.secret_manager
72 | csm_backend = CloudSecretManagerBackend()
- csm_backend.get_conn_uri()
73 + csm_backend.get_conn_value()
74 | csm_backend.get_connections()
75 |
76 | # airflow.providers.hashicorp.secrets.vault
AIR301 [*] `get_connections` is removed in Airflow 3.0
--> AIR301_class_attribute.py:74:13
@@ -500,16 +456,14 @@ AIR301 [*] `get_connections` is removed in Airflow 3.0
76 | # airflow.providers.hashicorp.secrets.vault
|
help: Use `get_connection` instead
Safe fix
71 71 | # airflow.providers.google.cloud.secrets.secret_manager
72 72 | csm_backend = CloudSecretManagerBackend()
73 73 | csm_backend.get_conn_uri()
74 |-csm_backend.get_connections()
74 |+csm_backend.get_connection()
75 75 |
76 76 | # airflow.providers.hashicorp.secrets.vault
77 77 | vault_backend = VaultBackend()
71 | # airflow.providers.google.cloud.secrets.secret_manager
72 | csm_backend = CloudSecretManagerBackend()
73 | csm_backend.get_conn_uri()
- csm_backend.get_connections()
74 + csm_backend.get_connection()
75 |
76 | # airflow.providers.hashicorp.secrets.vault
77 | vault_backend = VaultBackend()
AIR301 [*] `get_conn_uri` is removed in Airflow 3.0
--> AIR301_class_attribute.py:78:15
@@ -521,16 +475,14 @@ AIR301 [*] `get_conn_uri` is removed in Airflow 3.0
79 | vault_backend.get_connections()
|
help: Use `get_conn_value` instead
Safe fix
75 75 |
76 76 | # airflow.providers.hashicorp.secrets.vault
77 77 | vault_backend = VaultBackend()
78 |-vault_backend.get_conn_uri()
78 |+vault_backend.get_conn_value()
79 79 | vault_backend.get_connections()
80 80 |
81 81 | not_an_error = NotAir302SecretError()
75 |
76 | # airflow.providers.hashicorp.secrets.vault
77 | vault_backend = VaultBackend()
- vault_backend.get_conn_uri()
78 + vault_backend.get_conn_value()
79 | vault_backend.get_connections()
80 |
81 | not_an_error = NotAir302SecretError()
AIR301 [*] `get_connections` is removed in Airflow 3.0
--> AIR301_class_attribute.py:79:15
@@ -543,16 +495,14 @@ AIR301 [*] `get_connections` is removed in Airflow 3.0
81 | not_an_error = NotAir302SecretError()
|
help: Use `get_connection` instead
Safe fix
76 76 | # airflow.providers.hashicorp.secrets.vault
77 77 | vault_backend = VaultBackend()
78 78 | vault_backend.get_conn_uri()
79 |-vault_backend.get_connections()
79 |+vault_backend.get_connection()
80 80 |
81 81 | not_an_error = NotAir302SecretError()
82 82 | not_an_error.get_conn_uri()
76 | # airflow.providers.hashicorp.secrets.vault
77 | vault_backend = VaultBackend()
78 | vault_backend.get_conn_uri()
- vault_backend.get_connections()
79 + vault_backend.get_connection()
80 |
81 | not_an_error = NotAir302SecretError()
82 | not_an_error.get_conn_uri()
AIR301 [*] `initialize_providers_dataset_uri_resources` is removed in Airflow 3.0
--> AIR301_class_attribute.py:86:4
@@ -565,16 +515,14 @@ AIR301 [*] `initialize_providers_dataset_uri_resources` is removed in Airflow 3.
88 | pm.dataset_uri_handlers
|
help: Use `initialize_providers_asset_uri_resources` instead
Safe fix
83 83 |
84 84 | # airflow.providers_manager
85 85 | pm = ProvidersManager()
86 |-pm.initialize_providers_dataset_uri_resources()
86 |+pm.initialize_providers_asset_uri_resources()
87 87 | pm.dataset_factories
88 88 | pm.dataset_uri_handlers
89 89 | pm.dataset_to_openlineage_converters
83 |
84 | # airflow.providers_manager
85 | pm = ProvidersManager()
- pm.initialize_providers_dataset_uri_resources()
86 + pm.initialize_providers_asset_uri_resources()
87 | pm.dataset_factories
88 | pm.dataset_uri_handlers
89 | pm.dataset_to_openlineage_converters
AIR301 [*] `dataset_factories` is removed in Airflow 3.0
--> AIR301_class_attribute.py:87:4
@@ -587,16 +535,14 @@ AIR301 [*] `dataset_factories` is removed in Airflow 3.0
89 | pm.dataset_to_openlineage_converters
|
help: Use `asset_factories` instead
Safe fix
84 84 | # airflow.providers_manager
85 85 | pm = ProvidersManager()
86 86 | pm.initialize_providers_dataset_uri_resources()
87 |-pm.dataset_factories
87 |+pm.asset_factories
88 88 | pm.dataset_uri_handlers
89 89 | pm.dataset_to_openlineage_converters
90 90 |
84 | # airflow.providers_manager
85 | pm = ProvidersManager()
86 | pm.initialize_providers_dataset_uri_resources()
- pm.dataset_factories
87 + pm.asset_factories
88 | pm.dataset_uri_handlers
89 | pm.dataset_to_openlineage_converters
90 |
AIR301 [*] `dataset_uri_handlers` is removed in Airflow 3.0
--> AIR301_class_attribute.py:88:4
@@ -608,16 +554,14 @@ AIR301 [*] `dataset_uri_handlers` is removed in Airflow 3.0
89 | pm.dataset_to_openlineage_converters
|
help: Use `asset_uri_handlers` instead
Safe fix
85 85 | pm = ProvidersManager()
86 86 | pm.initialize_providers_dataset_uri_resources()
87 87 | pm.dataset_factories
88 |-pm.dataset_uri_handlers
88 |+pm.asset_uri_handlers
89 89 | pm.dataset_to_openlineage_converters
90 90 |
91 91 | # airflow.secrets.base_secrets
85 | pm = ProvidersManager()
86 | pm.initialize_providers_dataset_uri_resources()
87 | pm.dataset_factories
- pm.dataset_uri_handlers
88 + pm.asset_uri_handlers
89 | pm.dataset_to_openlineage_converters
90 |
91 | # airflow.secrets.base_secrets
AIR301 [*] `dataset_to_openlineage_converters` is removed in Airflow 3.0
--> AIR301_class_attribute.py:89:4
@@ -630,16 +574,14 @@ AIR301 [*] `dataset_to_openlineage_converters` is removed in Airflow 3.0
91 | # airflow.secrets.base_secrets
|
help: Use `asset_to_openlineage_converters` instead
Safe fix
86 86 | pm.initialize_providers_dataset_uri_resources()
87 87 | pm.dataset_factories
88 88 | pm.dataset_uri_handlers
89 |-pm.dataset_to_openlineage_converters
89 |+pm.asset_to_openlineage_converters
90 90 |
91 91 | # airflow.secrets.base_secrets
92 92 | base_secret_backend = BaseSecretsBackend()
86 | pm.initialize_providers_dataset_uri_resources()
87 | pm.dataset_factories
88 | pm.dataset_uri_handlers
- pm.dataset_to_openlineage_converters
89 + pm.asset_to_openlineage_converters
90 |
91 | # airflow.secrets.base_secrets
92 | base_secret_backend = BaseSecretsBackend()
AIR301 [*] `get_conn_uri` is removed in Airflow 3.0
--> AIR301_class_attribute.py:93:21
@@ -651,16 +593,14 @@ AIR301 [*] `get_conn_uri` is removed in Airflow 3.0
94 | base_secret_backend.get_connections()
|
help: Use `get_conn_value` instead
Safe fix
90 90 |
91 91 | # airflow.secrets.base_secrets
92 92 | base_secret_backend = BaseSecretsBackend()
93 |-base_secret_backend.get_conn_uri()
93 |+base_secret_backend.get_conn_value()
94 94 | base_secret_backend.get_connections()
95 95 |
96 96 | # airflow.secrets.local_filesystem
90 |
91 | # airflow.secrets.base_secrets
92 | base_secret_backend = BaseSecretsBackend()
- base_secret_backend.get_conn_uri()
93 + base_secret_backend.get_conn_value()
94 | base_secret_backend.get_connections()
95 |
96 | # airflow.secrets.local_filesystem
AIR301 [*] `get_connections` is removed in Airflow 3.0
--> AIR301_class_attribute.py:94:21
@@ -673,16 +613,14 @@ AIR301 [*] `get_connections` is removed in Airflow 3.0
96 | # airflow.secrets.local_filesystem
|
help: Use `get_connection` instead
Safe fix
91 91 | # airflow.secrets.base_secrets
92 92 | base_secret_backend = BaseSecretsBackend()
93 93 | base_secret_backend.get_conn_uri()
94 |-base_secret_backend.get_connections()
94 |+base_secret_backend.get_connection()
95 95 |
96 96 | # airflow.secrets.local_filesystem
97 97 | lfb = LocalFilesystemBackend()
91 | # airflow.secrets.base_secrets
92 | base_secret_backend = BaseSecretsBackend()
93 | base_secret_backend.get_conn_uri()
- base_secret_backend.get_connections()
94 + base_secret_backend.get_connection()
95 |
96 | # airflow.secrets.local_filesystem
97 | lfb = LocalFilesystemBackend()
AIR301 [*] `get_connections` is removed in Airflow 3.0
--> AIR301_class_attribute.py:98:5
@@ -693,10 +631,8 @@ AIR301 [*] `get_connections` is removed in Airflow 3.0
| ^^^^^^^^^^^^^^^
|
help: Use `get_connection` instead
Safe fix
95 95 |
96 96 | # airflow.secrets.local_filesystem
97 97 | lfb = LocalFilesystemBackend()
98 |-lfb.get_connections()
98 |+lfb.get_connection()
95 |
96 | # airflow.secrets.local_filesystem
97 | lfb = LocalFilesystemBackend()
- lfb.get_connections()
98 + lfb.get_connection()

View File

@@ -337,16 +337,14 @@ AIR301 [*] `schedule_interval` is removed in Airflow 3.0
113 | template_searchpath=["/templates"],
|
help: Use `schedule` instead
Safe fix
108 108 |
109 109 | with DAG(
110 110 | dag_id="example_dag",
111 |- schedule_interval="@daily",
111 |+ schedule="@daily",
112 112 | start_date=datetime(2023, 1, 1),
113 113 | template_searchpath=["/templates"],
114 114 | ) as dag:
108 |
109 | with DAG(
110 | dag_id="example_dag",
- schedule_interval="@daily",
111 + schedule="@daily",
112 | start_date=datetime(2023, 1, 1),
113 | template_searchpath=["/templates"],
114 | ) as dag:
AIR301 `next_ds` is removed in Airflow 3.0
--> AIR301_context.py:135:23

View File

@@ -123,23 +123,22 @@ AIR301 [*] `airflow.secrets.cache.SecretCache` is removed in Airflow 3.0
| ^^^^^^^^^^^
|
help: Use `SecretCache` from `airflow.sdk` instead.
Unsafe fix
13 13 | from airflow.contrib.aws_athena_hook import AWSAthenaHook
14 14 | from airflow.datasets import DatasetAliasEvent
15 15 | from airflow.operators.subdag import SubDagOperator
16 |-from airflow.secrets.cache import SecretCache
17 16 | from airflow.secrets.local_filesystem import LocalFilesystemBackend
18 17 | from airflow.triggers.external_task import TaskStateTrigger
19 18 | from airflow.utils import dates
13 | from airflow.contrib.aws_athena_hook import AWSAthenaHook
14 | from airflow.datasets import DatasetAliasEvent
15 | from airflow.operators.subdag import SubDagOperator
- from airflow.secrets.cache import SecretCache
16 | from airflow.secrets.local_filesystem import LocalFilesystemBackend
17 | from airflow.triggers.external_task import TaskStateTrigger
18 | from airflow.utils import dates
--------------------------------------------------------------------------------
34 33 | from airflow.utils.trigger_rule import TriggerRule
35 34 | from airflow.www.auth import has_access, has_access_dataset
36 35 | from airflow.www.utils import get_sensitive_variables_fields, should_hide_value_for_key
36 |+from airflow.sdk import SecretCache
37 37 |
38 38 | # airflow root
39 39 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
33 | from airflow.utils.trigger_rule import TriggerRule
34 | from airflow.www.auth import has_access, has_access_dataset
35 | from airflow.www.utils import get_sensitive_variables_fields, should_hide_value_for_key
36 + from airflow.sdk import SecretCache
37 |
38 | # airflow root
39 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
note: This is an unsafe fix and may change runtime behavior
AIR301 `airflow.triggers.external_task.TaskStateTrigger` is removed in Airflow 3.0
--> AIR301_names.py:65:1

View File

@@ -12,16 +12,14 @@ AIR301 [*] `airflow.providers.amazon.aws.auth_manager.avp.entities.AvpEntities.D
13 | # airflow.providers.openlineage.utils.utils
|
help: Use `AvpEntities.ASSET` from `airflow.providers.amazon.aws.auth_manager.avp.entities` instead.
Safe fix
8 8 | from airflow.secrets.local_filesystem import load_connections
9 9 | from airflow.security.permissions import RESOURCE_DATASET
10 10 |
11 |-AvpEntities.DATASET
11 |+AvpEntities
12 12 |
13 13 | # airflow.providers.openlineage.utils.utils
14 14 | DatasetInfo()
8 | from airflow.secrets.local_filesystem import load_connections
9 | from airflow.security.permissions import RESOURCE_DATASET
10 |
- AvpEntities.DATASET
11 + AvpEntities
12 |
13 | # airflow.providers.openlineage.utils.utils
14 | DatasetInfo()
AIR301 [*] `airflow.providers.openlineage.utils.utils.DatasetInfo` is removed in Airflow 3.0
--> AIR301_provider_names_fix.py:14:1
@@ -32,24 +30,22 @@ AIR301 [*] `airflow.providers.openlineage.utils.utils.DatasetInfo` is removed in
15 | translate_airflow_dataset()
|
help: Use `AssetInfo` from `airflow.providers.openlineage.utils.utils` instead.
Safe fix
4 4 | from airflow.providers.openlineage.utils.utils import (
5 5 | DatasetInfo,
6 6 | translate_airflow_dataset,
7 |+AssetInfo,
7 8 | )
8 9 | from airflow.secrets.local_filesystem import load_connections
9 10 | from airflow.security.permissions import RESOURCE_DATASET
4 | from airflow.providers.openlineage.utils.utils import (
5 | DatasetInfo,
6 | translate_airflow_dataset,
7 + AssetInfo,
8 | )
9 | from airflow.secrets.local_filesystem import load_connections
10 | from airflow.security.permissions import RESOURCE_DATASET
--------------------------------------------------------------------------------
11 12 | AvpEntities.DATASET
12 13 |
13 14 | # airflow.providers.openlineage.utils.utils
14 |-DatasetInfo()
15 |+AssetInfo()
15 16 | translate_airflow_dataset()
16 17 |
17 18 | # airflow.secrets.local_filesystem
12 | AvpEntities.DATASET
13 |
14 | # airflow.providers.openlineage.utils.utils
- DatasetInfo()
15 + AssetInfo()
16 | translate_airflow_dataset()
17 |
18 | # airflow.secrets.local_filesystem
AIR301 [*] `airflow.providers.openlineage.utils.utils.translate_airflow_dataset` is removed in Airflow 3.0
--> AIR301_provider_names_fix.py:15:1
@@ -62,24 +58,22 @@ AIR301 [*] `airflow.providers.openlineage.utils.utils.translate_airflow_dataset`
17 | # airflow.secrets.local_filesystem
|
help: Use `translate_airflow_asset` from `airflow.providers.openlineage.utils.utils` instead.
Safe fix
4 4 | from airflow.providers.openlineage.utils.utils import (
5 5 | DatasetInfo,
6 6 | translate_airflow_dataset,
7 |+translate_airflow_asset,
7 8 | )
8 9 | from airflow.secrets.local_filesystem import load_connections
9 10 | from airflow.security.permissions import RESOURCE_DATASET
4 | from airflow.providers.openlineage.utils.utils import (
5 | DatasetInfo,
6 | translate_airflow_dataset,
7 + translate_airflow_asset,
8 | )
9 | from airflow.secrets.local_filesystem import load_connections
10 | from airflow.security.permissions import RESOURCE_DATASET
--------------------------------------------------------------------------------
12 13 |
13 14 | # airflow.providers.openlineage.utils.utils
14 15 | DatasetInfo()
15 |-translate_airflow_dataset()
16 |+translate_airflow_asset()
16 17 |
17 18 | # airflow.secrets.local_filesystem
18 19 | load_connections()
13 |
14 | # airflow.providers.openlineage.utils.utils
15 | DatasetInfo()
- translate_airflow_dataset()
16 + translate_airflow_asset()
17 |
18 | # airflow.secrets.local_filesystem
19 | load_connections()
AIR301 [*] `airflow.secrets.local_filesystem.load_connections` is removed in Airflow 3.0
--> AIR301_provider_names_fix.py:18:1
@@ -91,25 +85,23 @@ AIR301 [*] `airflow.secrets.local_filesystem.load_connections` is removed in Air
20 | # airflow.security.permissions
|
help: Use `load_connections_dict` from `airflow.secrets.local_filesystem` instead.
Safe fix
5 5 | DatasetInfo,
6 6 | translate_airflow_dataset,
7 7 | )
8 |-from airflow.secrets.local_filesystem import load_connections
8 |+from airflow.secrets.local_filesystem import load_connections, load_connections_dict
9 9 | from airflow.security.permissions import RESOURCE_DATASET
10 10 |
11 11 | AvpEntities.DATASET
5 | DatasetInfo,
6 | translate_airflow_dataset,
7 | )
- from airflow.secrets.local_filesystem import load_connections
8 + from airflow.secrets.local_filesystem import load_connections, load_connections_dict
9 | from airflow.security.permissions import RESOURCE_DATASET
10 |
11 | AvpEntities.DATASET
--------------------------------------------------------------------------------
15 15 | translate_airflow_dataset()
16 16 |
17 17 | # airflow.secrets.local_filesystem
18 |-load_connections()
18 |+load_connections_dict()
19 19 |
20 20 | # airflow.security.permissions
21 21 | RESOURCE_DATASET
15 | translate_airflow_dataset()
16 |
17 | # airflow.secrets.local_filesystem
- load_connections()
18 + load_connections_dict()
19 |
20 | # airflow.security.permissions
21 | RESOURCE_DATASET
AIR301 [*] `airflow.security.permissions.RESOURCE_DATASET` is removed in Airflow 3.0
--> AIR301_provider_names_fix.py:21:1
@@ -121,25 +113,23 @@ AIR301 [*] `airflow.security.permissions.RESOURCE_DATASET` is removed in Airflow
23 | from airflow.providers.amazon.aws.datasets.s3 import (
|
help: Use `RESOURCE_ASSET` from `airflow.security.permissions` instead.
Safe fix
6 6 | translate_airflow_dataset,
7 7 | )
8 8 | from airflow.secrets.local_filesystem import load_connections
9 |-from airflow.security.permissions import RESOURCE_DATASET
9 |+from airflow.security.permissions import RESOURCE_DATASET, RESOURCE_ASSET
10 10 |
11 11 | AvpEntities.DATASET
12 12 |
6 | translate_airflow_dataset,
7 | )
8 | from airflow.secrets.local_filesystem import load_connections
- from airflow.security.permissions import RESOURCE_DATASET
9 + from airflow.security.permissions import RESOURCE_DATASET, RESOURCE_ASSET
10 |
11 | AvpEntities.DATASET
12 |
--------------------------------------------------------------------------------
18 18 | load_connections()
19 19 |
20 20 | # airflow.security.permissions
21 |-RESOURCE_DATASET
21 |+RESOURCE_ASSET
22 22 |
23 23 | from airflow.providers.amazon.aws.datasets.s3 import (
24 24 | convert_dataset_to_openlineage as s3_convert_dataset_to_openlineage,
18 | load_connections()
19 |
20 | # airflow.security.permissions
- RESOURCE_DATASET
21 + RESOURCE_ASSET
22 |
23 | from airflow.providers.amazon.aws.datasets.s3 import (
24 | convert_dataset_to_openlineage as s3_convert_dataset_to_openlineage,
AIR301 [*] `airflow.providers.amazon.aws.datasets.s3.create_dataset` is removed in Airflow 3.0
--> AIR301_provider_names_fix.py:28:1
@@ -151,18 +141,16 @@ AIR301 [*] `airflow.providers.amazon.aws.datasets.s3.create_dataset` is removed
29 | s3_convert_dataset_to_openlineage()
|
help: Use `create_asset` from `airflow.providers.amazon.aws.assets.s3` instead.
Safe fix
24 24 | convert_dataset_to_openlineage as s3_convert_dataset_to_openlineage,
25 25 | )
26 26 | from airflow.providers.amazon.aws.datasets.s3 import create_dataset as s3_create_dataset
27 |+from airflow.providers.amazon.aws.assets.s3 import create_asset
27 28 |
28 |-s3_create_dataset()
29 |+create_asset()
29 30 | s3_convert_dataset_to_openlineage()
30 31 |
31 32 | from airflow.providers.common.io.dataset.file import (
24 | convert_dataset_to_openlineage as s3_convert_dataset_to_openlineage,
25 | )
26 | from airflow.providers.amazon.aws.datasets.s3 import create_dataset as s3_create_dataset
27 + from airflow.providers.amazon.aws.assets.s3 import create_asset
28 |
- s3_create_dataset()
29 + create_asset()
30 | s3_convert_dataset_to_openlineage()
31 |
32 | from airflow.providers.common.io.dataset.file import (
AIR301 [*] `airflow.providers.amazon.aws.datasets.s3.convert_dataset_to_openlineage` is removed in Airflow 3.0
--> AIR301_provider_names_fix.py:29:1
@@ -174,19 +162,17 @@ AIR301 [*] `airflow.providers.amazon.aws.datasets.s3.convert_dataset_to_openline
31 | from airflow.providers.common.io.dataset.file import (
|
help: Use `convert_asset_to_openlineage` from `airflow.providers.amazon.aws.assets.s3` instead.
Safe fix
24 24 | convert_dataset_to_openlineage as s3_convert_dataset_to_openlineage,
25 25 | )
26 26 | from airflow.providers.amazon.aws.datasets.s3 import create_dataset as s3_create_dataset
27 |+from airflow.providers.amazon.aws.assets.s3 import convert_asset_to_openlineage
27 28 |
28 29 | s3_create_dataset()
29 |-s3_convert_dataset_to_openlineage()
30 |+convert_asset_to_openlineage()
30 31 |
31 32 | from airflow.providers.common.io.dataset.file import (
32 33 | convert_dataset_to_openlineage as io_convert_dataset_to_openlineage,
24 | convert_dataset_to_openlineage as s3_convert_dataset_to_openlineage,
25 | )
26 | from airflow.providers.amazon.aws.datasets.s3 import create_dataset as s3_create_dataset
27 + from airflow.providers.amazon.aws.assets.s3 import convert_asset_to_openlineage
28 |
29 | s3_create_dataset()
- s3_convert_dataset_to_openlineage()
30 + convert_asset_to_openlineage()
31 |
32 | from airflow.providers.common.io.dataset.file import (
33 | convert_dataset_to_openlineage as io_convert_dataset_to_openlineage,
AIR301 [*] `airflow.providers.google.datasets.bigquery.create_dataset` is removed in Airflow 3.0
--> AIR301_provider_names_fix.py:45:1
@@ -199,18 +185,16 @@ AIR301 [*] `airflow.providers.google.datasets.bigquery.create_dataset` is remove
47 | # airflow.providers.google.datasets.gcs
|
help: Use `create_asset` from `airflow.providers.google.assets.bigquery` instead.
Safe fix
41 41 | from airflow.providers.google.datasets.bigquery import (
42 42 | create_dataset as bigquery_create_dataset,
43 43 | )
44 |+from airflow.providers.google.assets.bigquery import create_asset
44 45 |
45 |-bigquery_create_dataset()
46 |+create_asset()
46 47 |
47 48 | # airflow.providers.google.datasets.gcs
48 49 | from airflow.providers.google.datasets.gcs import (
41 | from airflow.providers.google.datasets.bigquery import (
42 | create_dataset as bigquery_create_dataset,
43 | )
44 + from airflow.providers.google.assets.bigquery import create_asset
45 |
- bigquery_create_dataset()
46 + create_asset()
47 |
48 | # airflow.providers.google.datasets.gcs
49 | from airflow.providers.google.datasets.gcs import (
AIR301 [*] `airflow.providers.google.datasets.gcs.create_dataset` is removed in Airflow 3.0
--> AIR301_provider_names_fix.py:53:1
@@ -222,16 +206,14 @@ AIR301 [*] `airflow.providers.google.datasets.gcs.create_dataset` is removed in
54 | gcs_convert_dataset_to_openlineage()
|
help: Use `create_asset` from `airflow.providers.google.assets.gcs` instead.
Safe fix
49 49 | convert_dataset_to_openlineage as gcs_convert_dataset_to_openlineage,
50 50 | )
51 51 | from airflow.providers.google.datasets.gcs import create_dataset as gcs_create_dataset
52 |+from airflow.providers.google.assets.gcs import create_asset
52 53 |
53 |-gcs_create_dataset()
54 |+create_asset()
54 55 | gcs_convert_dataset_to_openlineage()
49 | convert_dataset_to_openlineage as gcs_convert_dataset_to_openlineage,
50 | )
51 | from airflow.providers.google.datasets.gcs import create_dataset as gcs_create_dataset
52 + from airflow.providers.google.assets.gcs import create_asset
53 |
- gcs_create_dataset()
54 + create_asset()
55 | gcs_convert_dataset_to_openlineage()
AIR301 [*] `airflow.providers.google.datasets.gcs.convert_dataset_to_openlineage` is removed in Airflow 3.0
--> AIR301_provider_names_fix.py:54:1
@@ -241,13 +223,11 @@ AIR301 [*] `airflow.providers.google.datasets.gcs.convert_dataset_to_openlineage
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: Use `convert_asset_to_openlineage` from `airflow.providers.google.assets.gcs` instead.
Safe fix
49 49 | convert_dataset_to_openlineage as gcs_convert_dataset_to_openlineage,
50 50 | )
51 51 | from airflow.providers.google.datasets.gcs import create_dataset as gcs_create_dataset
52 |+from airflow.providers.google.assets.gcs import convert_asset_to_openlineage
52 53 |
53 54 | gcs_create_dataset()
54 |-gcs_convert_dataset_to_openlineage()
55 |+convert_asset_to_openlineage()
49 | convert_dataset_to_openlineage as gcs_convert_dataset_to_openlineage,
50 | )
51 | from airflow.providers.google.datasets.gcs import create_dataset as gcs_create_dataset
52 + from airflow.providers.google.assets.gcs import convert_asset_to_openlineage
53 |
54 | gcs_create_dataset()
- gcs_convert_dataset_to_openlineage()
55 + convert_asset_to_openlineage()

View File

@@ -11,23 +11,22 @@ AIR302 [*] `airflow.hooks.S3_hook.S3Hook` is moved into `amazon` provider in Air
15 | provide_bucket_name()
|
help: Install `apache-airflow-providers-amazon>=1.0.0` and use `S3Hook` from `airflow.providers.amazon.aws.hooks.s3` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 3 | from airflow.hooks.S3_hook import (
4 |- S3Hook,
5 4 | provide_bucket_name,
6 5 | )
7 6 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
1 | from __future__ import annotations
2 |
3 | from airflow.hooks.S3_hook import (
- S3Hook,
4 | provide_bucket_name,
5 | )
6 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
--------------------------------------------------------------------------------
10 9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 |+from airflow.providers.amazon.aws.hooks.s3 import S3Hook
13 13 |
14 14 | S3Hook()
15 15 | provide_bucket_name()
9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 + from airflow.providers.amazon.aws.hooks.s3 import S3Hook
13 |
14 | S3Hook()
15 | provide_bucket_name()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.hooks.S3_hook.provide_bucket_name` is moved into `amazon` provider in Airflow 3.0;
--> AIR302_amazon.py:15:1
@@ -39,23 +38,22 @@ AIR302 [*] `airflow.hooks.S3_hook.provide_bucket_name` is moved into `amazon` pr
17 | GCSToS3Operator()
|
help: Install `apache-airflow-providers-amazon>=1.0.0` and use `provide_bucket_name` from `airflow.providers.amazon.aws.hooks.s3` instead.
Unsafe fix
2 2 |
3 3 | from airflow.hooks.S3_hook import (
4 4 | S3Hook,
5 |- provide_bucket_name,
6 5 | )
7 6 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
8 7 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
2 |
3 | from airflow.hooks.S3_hook import (
4 | S3Hook,
- provide_bucket_name,
5 | )
6 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
7 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
--------------------------------------------------------------------------------
10 9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 |+from airflow.providers.amazon.aws.hooks.s3 import provide_bucket_name
13 13 |
14 14 | S3Hook()
15 15 | provide_bucket_name()
9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 + from airflow.providers.amazon.aws.hooks.s3 import provide_bucket_name
13 |
14 | S3Hook()
15 | provide_bucket_name()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.gcs_to_s3.GCSToS3Operator` is moved into `amazon` provider in Airflow 3.0;
--> AIR302_amazon.py:17:1
@@ -68,21 +66,20 @@ AIR302 [*] `airflow.operators.gcs_to_s3.GCSToS3Operator` is moved into `amazon`
19 | RedshiftToS3Operator()
|
help: Install `apache-airflow-providers-amazon>=1.0.0` and use `GCSToS3Operator` from `airflow.providers.amazon.aws.transfers.gcs_to_s3` instead.
Unsafe fix
4 4 | S3Hook,
5 5 | provide_bucket_name,
6 6 | )
7 |-from airflow.operators.gcs_to_s3 import GCSToS3Operator
8 7 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
9 8 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
10 9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 |+from airflow.providers.amazon.aws.transfers.gcs_to_s3 import GCSToS3Operator
13 13 |
14 14 | S3Hook()
15 15 | provide_bucket_name()
4 | S3Hook,
5 | provide_bucket_name,
6 | )
- from airflow.operators.gcs_to_s3 import GCSToS3Operator
7 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
8 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 + from airflow.providers.amazon.aws.transfers.gcs_to_s3 import GCSToS3Operator
13 |
14 | S3Hook()
15 | provide_bucket_name()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.google_api_to_s3_transfer.GoogleApiToS3Operator` is moved into `amazon` provider in Airflow 3.0;
--> AIR302_amazon.py:18:1
@@ -94,20 +91,19 @@ AIR302 [*] `airflow.operators.google_api_to_s3_transfer.GoogleApiToS3Operator` i
20 | S3FileTransformOperator()
|
help: Install `apache-airflow-providers-amazon>=1.0.0` and use `GoogleApiToS3Operator` from `airflow.providers.amazon.aws.transfers.google_api_to_s3` instead.
Unsafe fix
5 5 | provide_bucket_name,
6 6 | )
7 7 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
8 |-from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
9 8 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
10 9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 |+from airflow.providers.amazon.aws.transfers.google_api_to_s3 import GoogleApiToS3Operator
13 13 |
14 14 | S3Hook()
15 15 | provide_bucket_name()
5 | provide_bucket_name,
6 | )
7 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
- from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
8 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 + from airflow.providers.amazon.aws.transfers.google_api_to_s3 import GoogleApiToS3Operator
13 |
14 | S3Hook()
15 | provide_bucket_name()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.redshift_to_s3_operator.RedshiftToS3Operator` is moved into `amazon` provider in Airflow 3.0;
--> AIR302_amazon.py:19:1
@@ -120,19 +116,18 @@ AIR302 [*] `airflow.operators.redshift_to_s3_operator.RedshiftToS3Operator` is m
21 | S3ToRedshiftOperator()
|
help: Install `apache-airflow-providers-amazon>=1.0.0` and use `RedshiftToS3Operator` from `airflow.providers.amazon.aws.transfers.redshift_to_s3` instead.
Unsafe fix
6 6 | )
7 7 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
8 8 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
9 |-from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
10 9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 |+from airflow.providers.amazon.aws.transfers.redshift_to_s3 import RedshiftToS3Operator
13 13 |
14 14 | S3Hook()
15 15 | provide_bucket_name()
6 | )
7 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
8 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
- from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 + from airflow.providers.amazon.aws.transfers.redshift_to_s3 import RedshiftToS3Operator
13 |
14 | S3Hook()
15 | provide_bucket_name()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.s3_file_transform_operator.S3FileTransformOperator` is moved into `amazon` provider in Airflow 3.0;
--> AIR302_amazon.py:20:1
@@ -145,18 +140,17 @@ AIR302 [*] `airflow.operators.s3_file_transform_operator.S3FileTransformOperator
22 | S3KeySensor()
|
help: Install `apache-airflow-providers-amazon>=3.0.0` and use `S3FileTransformOperator` from `airflow.providers.amazon.aws.operators.s3` instead.
Unsafe fix
7 7 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
8 8 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
9 9 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
10 |-from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 |+from airflow.providers.amazon.aws.operators.s3 import S3FileTransformOperator
13 13 |
14 14 | S3Hook()
15 15 | provide_bucket_name()
7 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
8 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
9 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
- from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 + from airflow.providers.amazon.aws.operators.s3 import S3FileTransformOperator
13 |
14 | S3Hook()
15 | provide_bucket_name()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.s3_to_redshift_operator.S3ToRedshiftOperator` is moved into `amazon` provider in Airflow 3.0;
--> AIR302_amazon.py:21:1
@@ -168,17 +162,16 @@ AIR302 [*] `airflow.operators.s3_to_redshift_operator.S3ToRedshiftOperator` is m
22 | S3KeySensor()
|
help: Install `apache-airflow-providers-amazon>=1.0.0` and use `S3ToRedshiftOperator` from `airflow.providers.amazon.aws.transfers.s3_to_redshift` instead.
Unsafe fix
8 8 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
9 9 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
10 10 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
11 |-from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 |+from airflow.providers.amazon.aws.transfers.s3_to_redshift import S3ToRedshiftOperator
13 13 |
14 14 | S3Hook()
15 15 | provide_bucket_name()
8 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
9 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
10 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
- from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
11 | from airflow.sensors.s3_key_sensor import S3KeySensor
12 + from airflow.providers.amazon.aws.transfers.s3_to_redshift import S3ToRedshiftOperator
13 |
14 | S3Hook()
15 | provide_bucket_name()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.sensors.s3_key_sensor.S3KeySensor` is moved into `amazon` provider in Airflow 3.0;
--> AIR302_amazon.py:22:1
@@ -191,16 +184,15 @@ AIR302 [*] `airflow.sensors.s3_key_sensor.S3KeySensor` is moved into `amazon` pr
24 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Transfer
|
help: Install `apache-airflow-providers-amazon>=1.0.0` and use `S3KeySensor` from `airflow.providers.amazon.aws.sensors.s3` instead.
Unsafe fix
9 9 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
10 10 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
11 11 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
12 |-from airflow.sensors.s3_key_sensor import S3KeySensor
12 |+from airflow.providers.amazon.aws.sensors.s3 import S3KeySensor
13 13 |
14 14 | S3Hook()
15 15 | provide_bucket_name()
9 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
10 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
11 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
- from airflow.sensors.s3_key_sensor import S3KeySensor
12 + from airflow.providers.amazon.aws.sensors.s3 import S3KeySensor
13 |
14 | S3Hook()
15 | provide_bucket_name()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.google_api_to_s3_transfer.GoogleApiToS3Transfer` is moved into `amazon` provider in Airflow 3.0;
--> AIR302_amazon.py:26:1
@@ -213,15 +205,14 @@ AIR302 [*] `airflow.operators.google_api_to_s3_transfer.GoogleApiToS3Transfer` i
28 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Transfer
|
help: Install `apache-airflow-providers-amazon>=1.0.0` and use `GoogleApiToS3Operator` from `airflow.providers.amazon.aws.transfers.google_api_to_s3` instead.
Unsafe fix
22 22 | S3KeySensor()
23 23 |
24 24 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Transfer
25 |+from airflow.providers.amazon.aws.transfers.google_api_to_s3 import GoogleApiToS3Operator
25 26 |
26 27 | GoogleApiToS3Transfer()
27 28 |
22 | S3KeySensor()
23 |
24 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Transfer
25 + from airflow.providers.amazon.aws.transfers.google_api_to_s3 import GoogleApiToS3Operator
26 |
27 | GoogleApiToS3Transfer()
28 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.redshift_to_s3_operator.RedshiftToS3Transfer` is moved into `amazon` provider in Airflow 3.0;
--> AIR302_amazon.py:30:1
@@ -234,15 +225,14 @@ AIR302 [*] `airflow.operators.redshift_to_s3_operator.RedshiftToS3Transfer` is m
32 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftTransfer
|
help: Install `apache-airflow-providers-amazon>=1.0.0` and use `RedshiftToS3Operator` from `airflow.providers.amazon.aws.transfers.redshift_to_s3` instead.
Unsafe fix
26 26 | GoogleApiToS3Transfer()
27 27 |
28 28 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Transfer
29 |+from airflow.providers.amazon.aws.transfers.redshift_to_s3 import RedshiftToS3Operator
29 30 |
30 31 | RedshiftToS3Transfer()
31 32 |
26 | GoogleApiToS3Transfer()
27 |
28 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Transfer
29 + from airflow.providers.amazon.aws.transfers.redshift_to_s3 import RedshiftToS3Operator
30 |
31 | RedshiftToS3Transfer()
32 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.s3_to_redshift_operator.S3ToRedshiftTransfer` is moved into `amazon` provider in Airflow 3.0;
--> AIR302_amazon.py:34:1
@@ -253,11 +243,10 @@ AIR302 [*] `airflow.operators.s3_to_redshift_operator.S3ToRedshiftTransfer` is m
| ^^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-amazon>=1.0.0` and use `S3ToRedshiftOperator` from `airflow.providers.amazon.aws.transfers.s3_to_redshift` instead.
Unsafe fix
30 30 | RedshiftToS3Transfer()
31 31 |
32 32 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftTransfer
33 |+from airflow.providers.amazon.aws.transfers.s3_to_redshift import S3ToRedshiftOperator
33 34 |
34 35 | S3ToRedshiftTransfer()
30 | RedshiftToS3Transfer()
31 |
32 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftTransfer
33 + from airflow.providers.amazon.aws.transfers.s3_to_redshift import S3ToRedshiftOperator
34 |
35 | S3ToRedshiftTransfer()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -12,19 +12,18 @@ AIR302 [*] `airflow.config_templates.default_celery.DEFAULT_CELERY_CONFIG` is mo
11 | app
|
help: Install `apache-airflow-providers-celery>=3.3.0` and use `DEFAULT_CELERY_CONFIG` from `airflow.providers.celery.executors.default_celery` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 |-from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG
4 3 | from airflow.executors.celery_executor import (
5 4 | CeleryExecutor,
6 5 | app,
7 6 | )
7 |+from airflow.providers.celery.executors.default_celery import DEFAULT_CELERY_CONFIG
8 8 |
9 9 | DEFAULT_CELERY_CONFIG
10 10 |
1 | from __future__ import annotations
2 |
- from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG
3 | from airflow.executors.celery_executor import (
4 | CeleryExecutor,
5 | app,
6 | )
7 + from airflow.providers.celery.executors.default_celery import DEFAULT_CELERY_CONFIG
8 |
9 | DEFAULT_CELERY_CONFIG
10 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.executors.celery_executor.app` is moved into `celery` provider in Airflow 3.0;
--> AIR302_celery.py:11:1
@@ -36,17 +35,16 @@ AIR302 [*] `airflow.executors.celery_executor.app` is moved into `celery` provid
12 | CeleryExecutor()
|
help: Install `apache-airflow-providers-celery>=3.3.0` and use `app` from `airflow.providers.celery.executors.celery_executor_utils` instead.
Unsafe fix
3 3 | from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG
4 4 | from airflow.executors.celery_executor import (
5 5 | CeleryExecutor,
6 |- app,
7 6 | )
7 |+from airflow.providers.celery.executors.celery_executor_utils import app
8 8 |
9 9 | DEFAULT_CELERY_CONFIG
10 10 |
3 | from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG
4 | from airflow.executors.celery_executor import (
5 | CeleryExecutor,
- app,
6 | )
7 + from airflow.providers.celery.executors.celery_executor_utils import app
8 |
9 | DEFAULT_CELERY_CONFIG
10 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.executors.celery_executor.CeleryExecutor` is moved into `celery` provider in Airflow 3.0;
--> AIR302_celery.py:12:1
@@ -56,15 +54,14 @@ AIR302 [*] `airflow.executors.celery_executor.CeleryExecutor` is moved into `cel
| ^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-celery>=3.3.0` and use `CeleryExecutor` from `airflow.providers.celery.executors.celery_executor` instead.
Unsafe fix
2 2 |
3 3 | from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG
4 4 | from airflow.executors.celery_executor import (
5 |- CeleryExecutor,
6 5 | app,
7 6 | )
7 |+from airflow.providers.celery.executors.celery_executor import CeleryExecutor
8 8 |
9 9 | DEFAULT_CELERY_CONFIG
10 10 |
2 |
3 | from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG
4 | from airflow.executors.celery_executor import (
- CeleryExecutor,
5 | app,
6 | )
7 + from airflow.providers.celery.executors.celery_executor import CeleryExecutor
8 |
9 | DEFAULT_CELERY_CONFIG
10 |
note: This is an unsafe fix and may change runtime behavior

View File

@@ -11,18 +11,17 @@ AIR302 [*] `airflow.hooks.dbapi.ConnectorProtocol` is moved into `common-sql` pr
9 | DbApiHook()
|
help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `ConnectorProtocol` from `airflow.providers.common.sql.hooks.sql` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 3 | from airflow.hooks.dbapi import (
4 |- ConnectorProtocol,
5 4 | DbApiHook,
6 5 | )
6 |+from airflow.providers.common.sql.hooks.sql import ConnectorProtocol
7 7 |
8 8 | ConnectorProtocol()
9 9 | DbApiHook()
1 | from __future__ import annotations
2 |
3 | from airflow.hooks.dbapi import (
- ConnectorProtocol,
4 | DbApiHook,
5 | )
6 + from airflow.providers.common.sql.hooks.sql import ConnectorProtocol
7 |
8 | ConnectorProtocol()
9 | DbApiHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.hooks.dbapi.DbApiHook` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:9:1
@@ -34,17 +33,16 @@ AIR302 [*] `airflow.hooks.dbapi.DbApiHook` is moved into `common-sql` provider i
11 | from airflow.hooks.dbapi_hook import DbApiHook
|
help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `DbApiHook` from `airflow.providers.common.sql.hooks.sql` instead.
Unsafe fix
2 2 |
3 3 | from airflow.hooks.dbapi import (
4 4 | ConnectorProtocol,
5 |- DbApiHook,
6 5 | )
6 |+from airflow.providers.common.sql.hooks.sql import DbApiHook
7 7 |
8 8 | ConnectorProtocol()
9 9 | DbApiHook()
2 |
3 | from airflow.hooks.dbapi import (
4 | ConnectorProtocol,
- DbApiHook,
5 | )
6 + from airflow.providers.common.sql.hooks.sql import DbApiHook
7 |
8 | ConnectorProtocol()
9 | DbApiHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.hooks.dbapi_hook.DbApiHook` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:14:1
@@ -56,17 +54,16 @@ AIR302 [*] `airflow.hooks.dbapi_hook.DbApiHook` is moved into `common-sql` provi
15 | SQLCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `DbApiHook` from `airflow.providers.common.sql.hooks.sql` instead.
Unsafe fix
8 8 | ConnectorProtocol()
9 9 | DbApiHook()
10 10 |
11 |-from airflow.hooks.dbapi_hook import DbApiHook
12 11 | from airflow.operators.check_operator import SQLCheckOperator
12 |+from airflow.providers.common.sql.hooks.sql import DbApiHook
13 13 |
14 14 | DbApiHook()
15 15 | SQLCheckOperator()
8 | ConnectorProtocol()
9 | DbApiHook()
10 |
- from airflow.hooks.dbapi_hook import DbApiHook
11 | from airflow.operators.check_operator import SQLCheckOperator
12 + from airflow.providers.common.sql.hooks.sql import DbApiHook
13 |
14 | DbApiHook()
15 | SQLCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.check_operator.SQLCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:15:1
@@ -76,16 +73,15 @@ AIR302 [*] `airflow.operators.check_operator.SQLCheckOperator` is moved into `co
| ^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
9 9 | DbApiHook()
10 10 |
11 11 | from airflow.hooks.dbapi_hook import DbApiHook
12 |-from airflow.operators.check_operator import SQLCheckOperator
12 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
13 13 |
14 14 | DbApiHook()
15 15 | SQLCheckOperator()
9 | DbApiHook()
10 |
11 | from airflow.hooks.dbapi_hook import DbApiHook
- from airflow.operators.check_operator import SQLCheckOperator
12 + from airflow.providers.common.sql.operators.sql import SQLCheckOperator
13 |
14 | DbApiHook()
15 | SQLCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.sql.SQLCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:21:1
@@ -97,16 +93,15 @@ AIR302 [*] `airflow.operators.sql.SQLCheckOperator` is moved into `common-sql` p
22 | CheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
16 16 |
17 17 |
18 18 | from airflow.operators.check_operator import CheckOperator
19 |-from airflow.operators.sql import SQLCheckOperator
19 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
20 20 |
21 21 | SQLCheckOperator()
22 22 | CheckOperator()
16 |
17 |
18 | from airflow.operators.check_operator import CheckOperator
- from airflow.operators.sql import SQLCheckOperator
19 + from airflow.providers.common.sql.operators.sql import SQLCheckOperator
20 |
21 | SQLCheckOperator()
22 | CheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.check_operator.CheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:22:1
@@ -116,15 +111,14 @@ AIR302 [*] `airflow.operators.check_operator.CheckOperator` is moved into `commo
| ^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
17 17 |
18 18 | from airflow.operators.check_operator import CheckOperator
19 19 | from airflow.operators.sql import SQLCheckOperator
20 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
20 21 |
21 22 | SQLCheckOperator()
22 23 | CheckOperator()
17 |
18 | from airflow.operators.check_operator import CheckOperator
19 | from airflow.operators.sql import SQLCheckOperator
20 + from airflow.providers.common.sql.operators.sql import SQLCheckOperator
21 |
22 | SQLCheckOperator()
23 | CheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.druid_check_operator.CheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:27:1
@@ -135,15 +129,14 @@ AIR302 [*] `airflow.operators.druid_check_operator.CheckOperator` is moved into
| ^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
23 23 |
24 24 |
25 25 | from airflow.operators.druid_check_operator import CheckOperator
26 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
26 27 |
27 28 | CheckOperator()
28 29 |
23 |
24 |
25 | from airflow.operators.druid_check_operator import CheckOperator
26 + from airflow.providers.common.sql.operators.sql import SQLCheckOperator
27 |
28 | CheckOperator()
29 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.presto_check_operator.CheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:32:1
@@ -154,15 +147,14 @@ AIR302 [*] `airflow.operators.presto_check_operator.CheckOperator` is moved into
| ^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
28 28 |
29 29 |
30 30 | from airflow.operators.presto_check_operator import CheckOperator
31 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
31 32 |
32 33 | CheckOperator()
33 34 |
28 |
29 |
30 | from airflow.operators.presto_check_operator import CheckOperator
31 + from airflow.providers.common.sql.operators.sql import SQLCheckOperator
32 |
33 | CheckOperator()
34 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.druid_check_operator.DruidCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:42:1
@@ -175,15 +167,14 @@ AIR302 [*] `airflow.operators.druid_check_operator.DruidCheckOperator` is moved
44 | IntervalCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
38 38 | )
39 39 | from airflow.operators.druid_check_operator import DruidCheckOperator
40 40 | from airflow.operators.presto_check_operator import PrestoCheckOperator
41 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
41 42 |
42 43 | DruidCheckOperator()
43 44 | PrestoCheckOperator()
38 | )
39 | from airflow.operators.druid_check_operator import DruidCheckOperator
40 | from airflow.operators.presto_check_operator import PrestoCheckOperator
41 + from airflow.providers.common.sql.operators.sql import SQLCheckOperator
42 |
43 | DruidCheckOperator()
44 | PrestoCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.presto_check_operator.PrestoCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:43:1
@@ -195,15 +186,14 @@ AIR302 [*] `airflow.operators.presto_check_operator.PrestoCheckOperator` is move
45 | SQLIntervalCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
38 38 | )
39 39 | from airflow.operators.druid_check_operator import DruidCheckOperator
40 40 | from airflow.operators.presto_check_operator import PrestoCheckOperator
41 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
41 42 |
42 43 | DruidCheckOperator()
43 44 | PrestoCheckOperator()
38 | )
39 | from airflow.operators.druid_check_operator import DruidCheckOperator
40 | from airflow.operators.presto_check_operator import PrestoCheckOperator
41 + from airflow.providers.common.sql.operators.sql import SQLCheckOperator
42 |
43 | DruidCheckOperator()
44 | PrestoCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.check_operator.IntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:44:1
@@ -215,19 +205,18 @@ AIR302 [*] `airflow.operators.check_operator.IntervalCheckOperator` is moved int
45 | SQLIntervalCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLIntervalCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
34 34 |
35 35 | from airflow.operators.check_operator import (
36 36 | IntervalCheckOperator,
37 |- SQLIntervalCheckOperator,
38 37 | )
39 38 | from airflow.operators.druid_check_operator import DruidCheckOperator
40 39 | from airflow.operators.presto_check_operator import PrestoCheckOperator
40 |+from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
41 41 |
42 42 | DruidCheckOperator()
43 43 | PrestoCheckOperator()
34 |
35 | from airflow.operators.check_operator import (
36 | IntervalCheckOperator,
- SQLIntervalCheckOperator,
37 | )
38 | from airflow.operators.druid_check_operator import DruidCheckOperator
39 | from airflow.operators.presto_check_operator import PrestoCheckOperator
40 + from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
41 |
42 | DruidCheckOperator()
43 | PrestoCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.check_operator.SQLIntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:45:1
@@ -238,19 +227,18 @@ AIR302 [*] `airflow.operators.check_operator.SQLIntervalCheckOperator` is moved
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLIntervalCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
34 34 |
35 35 | from airflow.operators.check_operator import (
36 36 | IntervalCheckOperator,
37 |- SQLIntervalCheckOperator,
38 37 | )
39 38 | from airflow.operators.druid_check_operator import DruidCheckOperator
40 39 | from airflow.operators.presto_check_operator import PrestoCheckOperator
40 |+from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
41 41 |
42 42 | DruidCheckOperator()
43 43 | PrestoCheckOperator()
34 |
35 | from airflow.operators.check_operator import (
36 | IntervalCheckOperator,
- SQLIntervalCheckOperator,
37 | )
38 | from airflow.operators.druid_check_operator import DruidCheckOperator
39 | from airflow.operators.presto_check_operator import PrestoCheckOperator
40 + from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
41 |
42 | DruidCheckOperator()
43 | PrestoCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.presto_check_operator.IntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:54:1
@@ -263,15 +251,14 @@ AIR302 [*] `airflow.operators.presto_check_operator.IntervalCheckOperator` is mo
56 | PrestoIntervalCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLIntervalCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
50 50 | PrestoIntervalCheckOperator,
51 51 | )
52 52 | from airflow.operators.sql import SQLIntervalCheckOperator
53 |+from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
53 54 |
54 55 | IntervalCheckOperator()
55 56 | SQLIntervalCheckOperator()
50 | PrestoIntervalCheckOperator,
51 | )
52 | from airflow.operators.sql import SQLIntervalCheckOperator
53 + from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
54 |
55 | IntervalCheckOperator()
56 | SQLIntervalCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.sql.SQLIntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:55:1
@@ -282,16 +269,15 @@ AIR302 [*] `airflow.operators.sql.SQLIntervalCheckOperator` is moved into `commo
56 | PrestoIntervalCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLIntervalCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
49 49 | IntervalCheckOperator,
50 50 | PrestoIntervalCheckOperator,
51 51 | )
52 |-from airflow.operators.sql import SQLIntervalCheckOperator
52 |+from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
53 53 |
54 54 | IntervalCheckOperator()
55 55 | SQLIntervalCheckOperator()
49 | IntervalCheckOperator,
50 | PrestoIntervalCheckOperator,
51 | )
- from airflow.operators.sql import SQLIntervalCheckOperator
52 + from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
53 |
54 | IntervalCheckOperator()
55 | SQLIntervalCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.presto_check_operator.PrestoIntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:56:1
@@ -302,15 +288,14 @@ AIR302 [*] `airflow.operators.presto_check_operator.PrestoIntervalCheckOperator`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLIntervalCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
50 50 | PrestoIntervalCheckOperator,
51 51 | )
52 52 | from airflow.operators.sql import SQLIntervalCheckOperator
53 |+from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
53 54 |
54 55 | IntervalCheckOperator()
55 56 | SQLIntervalCheckOperator()
50 | PrestoIntervalCheckOperator,
51 | )
52 | from airflow.operators.sql import SQLIntervalCheckOperator
53 + from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
54 |
55 | IntervalCheckOperator()
56 | SQLIntervalCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.check_operator.SQLThresholdCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:64:1
@@ -322,18 +307,17 @@ AIR302 [*] `airflow.operators.check_operator.SQLThresholdCheckOperator` is moved
65 | ThresholdCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLThresholdCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
57 57 |
58 58 |
59 59 | from airflow.operators.check_operator import (
60 |- SQLThresholdCheckOperator,
61 60 | ThresholdCheckOperator,
62 61 | )
62 |+from airflow.providers.common.sql.operators.sql import SQLThresholdCheckOperator
63 63 |
64 64 | SQLThresholdCheckOperator()
65 65 | ThresholdCheckOperator()
57 |
58 |
59 | from airflow.operators.check_operator import (
- SQLThresholdCheckOperator,
60 | ThresholdCheckOperator,
61 | )
62 + from airflow.providers.common.sql.operators.sql import SQLThresholdCheckOperator
63 |
64 | SQLThresholdCheckOperator()
65 | ThresholdCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.check_operator.ThresholdCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:65:1
@@ -343,18 +327,17 @@ AIR302 [*] `airflow.operators.check_operator.ThresholdCheckOperator` is moved in
| ^^^^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLThresholdCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
57 57 |
58 58 |
59 59 | from airflow.operators.check_operator import (
60 |- SQLThresholdCheckOperator,
61 60 | ThresholdCheckOperator,
62 61 | )
62 |+from airflow.providers.common.sql.operators.sql import SQLThresholdCheckOperator
63 63 |
64 64 | SQLThresholdCheckOperator()
65 65 | ThresholdCheckOperator()
57 |
58 |
59 | from airflow.operators.check_operator import (
- SQLThresholdCheckOperator,
60 | ThresholdCheckOperator,
61 | )
62 + from airflow.providers.common.sql.operators.sql import SQLThresholdCheckOperator
63 |
64 | SQLThresholdCheckOperator()
65 | ThresholdCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.sql.SQLThresholdCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:70:1
@@ -365,16 +348,15 @@ AIR302 [*] `airflow.operators.sql.SQLThresholdCheckOperator` is moved into `comm
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLThresholdCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
65 65 | ThresholdCheckOperator()
66 66 |
67 67 |
68 |-from airflow.operators.sql import SQLThresholdCheckOperator
68 |+from airflow.providers.common.sql.operators.sql import SQLThresholdCheckOperator
69 69 |
70 70 | SQLThresholdCheckOperator()
71 71 |
65 | ThresholdCheckOperator()
66 |
67 |
- from airflow.operators.sql import SQLThresholdCheckOperator
68 + from airflow.providers.common.sql.operators.sql import SQLThresholdCheckOperator
69 |
70 | SQLThresholdCheckOperator()
71 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.check_operator.SQLValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:78:1
@@ -386,18 +368,17 @@ AIR302 [*] `airflow.operators.check_operator.SQLValueCheckOperator` is moved int
79 | ValueCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLValueCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
71 71 |
72 72 |
73 73 | from airflow.operators.check_operator import (
74 |- SQLValueCheckOperator,
75 74 | ValueCheckOperator,
76 75 | )
76 |+from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
77 77 |
78 78 | SQLValueCheckOperator()
79 79 | ValueCheckOperator()
71 |
72 |
73 | from airflow.operators.check_operator import (
- SQLValueCheckOperator,
74 | ValueCheckOperator,
75 | )
76 + from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
77 |
78 | SQLValueCheckOperator()
79 | ValueCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.check_operator.ValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:79:1
@@ -407,18 +388,17 @@ AIR302 [*] `airflow.operators.check_operator.ValueCheckOperator` is moved into `
| ^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLValueCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
71 71 |
72 72 |
73 73 | from airflow.operators.check_operator import (
74 |- SQLValueCheckOperator,
75 74 | ValueCheckOperator,
76 75 | )
76 |+from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
77 77 |
78 78 | SQLValueCheckOperator()
79 79 | ValueCheckOperator()
71 |
72 |
73 | from airflow.operators.check_operator import (
- SQLValueCheckOperator,
74 | ValueCheckOperator,
75 | )
76 + from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
77 |
78 | SQLValueCheckOperator()
79 | ValueCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.sql.SQLValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:88:1
@@ -431,16 +411,15 @@ AIR302 [*] `airflow.operators.sql.SQLValueCheckOperator` is moved into `common-s
90 | PrestoValueCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLValueCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
83 83 | PrestoValueCheckOperator,
84 84 | ValueCheckOperator,
85 85 | )
86 |-from airflow.operators.sql import SQLValueCheckOperator
86 |+from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
87 87 |
88 88 | SQLValueCheckOperator()
89 89 | ValueCheckOperator()
83 | PrestoValueCheckOperator,
84 | ValueCheckOperator,
85 | )
- from airflow.operators.sql import SQLValueCheckOperator
86 + from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
87 |
88 | SQLValueCheckOperator()
89 | ValueCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.presto_check_operator.ValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:89:1
@@ -451,15 +430,14 @@ AIR302 [*] `airflow.operators.presto_check_operator.ValueCheckOperator` is moved
90 | PrestoValueCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLValueCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
84 84 | ValueCheckOperator,
85 85 | )
86 86 | from airflow.operators.sql import SQLValueCheckOperator
87 |+from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
87 88 |
88 89 | SQLValueCheckOperator()
89 90 | ValueCheckOperator()
84 | ValueCheckOperator,
85 | )
86 | from airflow.operators.sql import SQLValueCheckOperator
87 + from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
88 |
89 | SQLValueCheckOperator()
90 | ValueCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.presto_check_operator.PrestoValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:90:1
@@ -470,15 +448,14 @@ AIR302 [*] `airflow.operators.presto_check_operator.PrestoValueCheckOperator` is
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLValueCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
84 84 | ValueCheckOperator,
85 85 | )
86 86 | from airflow.operators.sql import SQLValueCheckOperator
87 |+from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
87 88 |
88 89 | SQLValueCheckOperator()
89 90 | ValueCheckOperator()
84 | ValueCheckOperator,
85 | )
86 | from airflow.operators.sql import SQLValueCheckOperator
87 + from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
88 |
89 | SQLValueCheckOperator()
90 | ValueCheckOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.sql.BaseSQLOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:102:1
@@ -491,22 +468,21 @@ AIR302 [*] `airflow.operators.sql.BaseSQLOperator` is moved into `common-sql` pr
104 | SQLTableCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `BaseSQLOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
91 91 |
92 92 |
93 93 | from airflow.operators.sql import (
94 |- BaseSQLOperator,
95 94 | BranchSQLOperator,
96 95 | SQLColumnCheckOperator,
97 96 | SQLTableCheckOperator,
98 97 | _convert_to_float_if_possible,
99 98 | parse_boolean,
100 99 | )
100 |+from airflow.providers.common.sql.operators.sql import BaseSQLOperator
101 101 |
102 102 | BaseSQLOperator()
103 103 | BranchSQLOperator()
91 |
92 |
93 | from airflow.operators.sql import (
- BaseSQLOperator,
94 | BranchSQLOperator,
95 | SQLColumnCheckOperator,
96 | SQLTableCheckOperator,
97 | _convert_to_float_if_possible,
98 | parse_boolean,
99 | )
100 + from airflow.providers.common.sql.operators.sql import BaseSQLOperator
101 |
102 | BaseSQLOperator()
103 | BranchSQLOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.sql.BranchSQLOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:103:1
@@ -518,21 +494,20 @@ AIR302 [*] `airflow.operators.sql.BranchSQLOperator` is moved into `common-sql`
105 | SQLColumnCheckOperator()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `BranchSQLOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
92 92 |
93 93 | from airflow.operators.sql import (
94 94 | BaseSQLOperator,
95 |- BranchSQLOperator,
96 95 | SQLColumnCheckOperator,
97 96 | SQLTableCheckOperator,
98 97 | _convert_to_float_if_possible,
99 98 | parse_boolean,
100 99 | )
100 |+from airflow.providers.common.sql.operators.sql import BranchSQLOperator
101 101 |
102 102 | BaseSQLOperator()
103 103 | BranchSQLOperator()
92 |
93 | from airflow.operators.sql import (
94 | BaseSQLOperator,
- BranchSQLOperator,
95 | SQLColumnCheckOperator,
96 | SQLTableCheckOperator,
97 | _convert_to_float_if_possible,
98 | parse_boolean,
99 | )
100 + from airflow.providers.common.sql.operators.sql import BranchSQLOperator
101 |
102 | BaseSQLOperator()
103 | BranchSQLOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.sql.SQLTableCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:104:1
@@ -545,19 +520,18 @@ AIR302 [*] `airflow.operators.sql.SQLTableCheckOperator` is moved into `common-s
106 | _convert_to_float_if_possible()
|
help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLTableCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
94 94 | BaseSQLOperator,
95 95 | BranchSQLOperator,
96 96 | SQLColumnCheckOperator,
97 |- SQLTableCheckOperator,
98 97 | _convert_to_float_if_possible,
99 98 | parse_boolean,
100 99 | )
100 |+from airflow.providers.common.sql.operators.sql import SQLTableCheckOperator
101 101 |
102 102 | BaseSQLOperator()
103 103 | BranchSQLOperator()
94 | BaseSQLOperator,
95 | BranchSQLOperator,
96 | SQLColumnCheckOperator,
- SQLTableCheckOperator,
97 | _convert_to_float_if_possible,
98 | parse_boolean,
99 | )
100 + from airflow.providers.common.sql.operators.sql import SQLTableCheckOperator
101 |
102 | BaseSQLOperator()
103 | BranchSQLOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.sql.SQLColumnCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:105:1
@@ -570,20 +544,19 @@ AIR302 [*] `airflow.operators.sql.SQLColumnCheckOperator` is moved into `common-
107 | parse_boolean()
|
help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `SQLColumnCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
93 93 | from airflow.operators.sql import (
94 94 | BaseSQLOperator,
95 95 | BranchSQLOperator,
96 |- SQLColumnCheckOperator,
97 96 | SQLTableCheckOperator,
98 97 | _convert_to_float_if_possible,
99 98 | parse_boolean,
100 99 | )
100 |+from airflow.providers.common.sql.operators.sql import SQLColumnCheckOperator
101 101 |
102 102 | BaseSQLOperator()
103 103 | BranchSQLOperator()
93 | from airflow.operators.sql import (
94 | BaseSQLOperator,
95 | BranchSQLOperator,
- SQLColumnCheckOperator,
96 | SQLTableCheckOperator,
97 | _convert_to_float_if_possible,
98 | parse_boolean,
99 | )
100 + from airflow.providers.common.sql.operators.sql import SQLColumnCheckOperator
101 |
102 | BaseSQLOperator()
103 | BranchSQLOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.sql._convert_to_float_if_possible` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:106:1
@@ -595,18 +568,17 @@ AIR302 [*] `airflow.operators.sql._convert_to_float_if_possible` is moved into `
107 | parse_boolean()
|
help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `_convert_to_float_if_possible` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
95 95 | BranchSQLOperator,
96 96 | SQLColumnCheckOperator,
97 97 | SQLTableCheckOperator,
98 |- _convert_to_float_if_possible,
99 98 | parse_boolean,
100 99 | )
100 |+from airflow.providers.common.sql.operators.sql import _convert_to_float_if_possible
101 101 |
102 102 | BaseSQLOperator()
103 103 | BranchSQLOperator()
95 | BranchSQLOperator,
96 | SQLColumnCheckOperator,
97 | SQLTableCheckOperator,
- _convert_to_float_if_possible,
98 | parse_boolean,
99 | )
100 + from airflow.providers.common.sql.operators.sql import _convert_to_float_if_possible
101 |
102 | BaseSQLOperator()
103 | BranchSQLOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.sql.parse_boolean` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:107:1
@@ -617,17 +589,16 @@ AIR302 [*] `airflow.operators.sql.parse_boolean` is moved into `common-sql` prov
| ^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `parse_boolean` from `airflow.providers.common.sql.operators.sql` instead.
Unsafe fix
96 96 | SQLColumnCheckOperator,
97 97 | SQLTableCheckOperator,
98 98 | _convert_to_float_if_possible,
99 |- parse_boolean,
100 99 | )
100 |+from airflow.providers.common.sql.operators.sql import parse_boolean
101 101 |
102 102 | BaseSQLOperator()
103 103 | BranchSQLOperator()
96 | SQLColumnCheckOperator,
97 | SQLTableCheckOperator,
98 | _convert_to_float_if_possible,
- parse_boolean,
99 | )
100 + from airflow.providers.common.sql.operators.sql import parse_boolean
101 |
102 | BaseSQLOperator()
103 | BranchSQLOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.sensors.sql.SqlSensor` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:112:1
@@ -638,16 +609,15 @@ AIR302 [*] `airflow.sensors.sql.SqlSensor` is moved into `common-sql` provider i
| ^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `SqlSensor` from `airflow.providers.common.sql.sensors.sql` instead.
Unsafe fix
107 107 | parse_boolean()
108 108 |
109 109 |
110 |-from airflow.sensors.sql import SqlSensor
110 |+from airflow.providers.common.sql.sensors.sql import SqlSensor
111 111 |
112 112 | SqlSensor()
113 113 |
107 | parse_boolean()
108 |
109 |
- from airflow.sensors.sql import SqlSensor
110 + from airflow.providers.common.sql.sensors.sql import SqlSensor
111 |
112 | SqlSensor()
113 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.sensors.sql_sensor.SqlSensor` is moved into `common-sql` provider in Airflow 3.0;
--> AIR302_common_sql.py:117:1
@@ -658,13 +628,12 @@ AIR302 [*] `airflow.sensors.sql_sensor.SqlSensor` is moved into `common-sql` pro
| ^^^^^^^^^
|
help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `SqlSensor` from `airflow.providers.common.sql.sensors.sql` instead.
Unsafe fix
112 112 | SqlSensor()
113 113 |
114 114 |
115 |-from airflow.sensors.sql_sensor import SqlSensor
115 |+from airflow.providers.common.sql.sensors.sql import SqlSensor
116 116 |
117 117 | SqlSensor()
118 118 |
112 | SqlSensor()
113 |
114 |
- from airflow.sensors.sql_sensor import SqlSensor
115 + from airflow.providers.common.sql.sensors.sql import SqlSensor
116 |
117 | SqlSensor()
118 |
note: This is an unsafe fix and may change runtime behavior

View File

@@ -10,11 +10,10 @@ AIR302 [*] `airflow.executors.dask_executor.DaskExecutor` is moved into `daskexe
| ^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-daskexecutor>=1.0.0` and use `DaskExecutor` from `airflow.providers.daskexecutor.executors.dask_executor` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 |-from airflow.executors.dask_executor import DaskExecutor
3 |+from airflow.providers.daskexecutor.executors.dask_executor import DaskExecutor
4 4 |
5 5 | DaskExecutor()
1 | from __future__ import annotations
2 |
- from airflow.executors.dask_executor import DaskExecutor
3 + from airflow.providers.daskexecutor.executors.dask_executor import DaskExecutor
4 |
5 | DaskExecutor()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -11,22 +11,21 @@ AIR302 [*] `airflow.hooks.druid_hook.DruidDbApiHook` is moved into `apache-druid
13 | DruidHook()
|
help: Install `apache-airflow-providers-apache-druid>=1.0.0` and use `DruidDbApiHook` from `airflow.providers.apache.druid.hooks.druid` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 3 | from airflow.hooks.druid_hook import (
4 |- DruidDbApiHook,
5 4 | DruidHook,
6 5 | )
7 6 | from airflow.operators.hive_to_druid import (
8 7 | HiveToDruidOperator,
9 8 | HiveToDruidTransfer,
10 9 | )
10 |+from airflow.providers.apache.druid.hooks.druid import DruidDbApiHook
11 11 |
12 12 | DruidDbApiHook()
13 13 | DruidHook()
1 | from __future__ import annotations
2 |
3 | from airflow.hooks.druid_hook import (
- DruidDbApiHook,
4 | DruidHook,
5 | )
6 | from airflow.operators.hive_to_druid import (
7 | HiveToDruidOperator,
8 | HiveToDruidTransfer,
9 | )
10 + from airflow.providers.apache.druid.hooks.druid import DruidDbApiHook
11 |
12 | DruidDbApiHook()
13 | DruidHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.hooks.druid_hook.DruidHook` is moved into `apache-druid` provider in Airflow 3.0;
--> AIR302_druid.py:13:1
@@ -38,21 +37,20 @@ AIR302 [*] `airflow.hooks.druid_hook.DruidHook` is moved into `apache-druid` pro
15 | HiveToDruidOperator()
|
help: Install `apache-airflow-providers-apache-druid>=1.0.0` and use `DruidHook` from `airflow.providers.apache.druid.hooks.druid` instead.
Unsafe fix
2 2 |
3 3 | from airflow.hooks.druid_hook import (
4 4 | DruidDbApiHook,
5 |- DruidHook,
6 5 | )
7 6 | from airflow.operators.hive_to_druid import (
8 7 | HiveToDruidOperator,
9 8 | HiveToDruidTransfer,
10 9 | )
10 |+from airflow.providers.apache.druid.hooks.druid import DruidHook
11 11 |
12 12 | DruidDbApiHook()
13 13 | DruidHook()
2 |
3 | from airflow.hooks.druid_hook import (
4 | DruidDbApiHook,
- DruidHook,
5 | )
6 | from airflow.operators.hive_to_druid import (
7 | HiveToDruidOperator,
8 | HiveToDruidTransfer,
9 | )
10 + from airflow.providers.apache.druid.hooks.druid import DruidHook
11 |
12 | DruidDbApiHook()
13 | DruidHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.hive_to_druid.HiveToDruidOperator` is moved into `apache-druid` provider in Airflow 3.0;
--> AIR302_druid.py:15:1
@@ -64,18 +62,17 @@ AIR302 [*] `airflow.operators.hive_to_druid.HiveToDruidOperator` is moved into `
16 | HiveToDruidTransfer()
|
help: Install `apache-airflow-providers-apache-druid>=1.0.0` and use `HiveToDruidOperator` from `airflow.providers.apache.druid.transfers.hive_to_druid` instead.
Unsafe fix
5 5 | DruidHook,
6 6 | )
7 7 | from airflow.operators.hive_to_druid import (
8 |- HiveToDruidOperator,
9 8 | HiveToDruidTransfer,
10 9 | )
10 |+from airflow.providers.apache.druid.transfers.hive_to_druid import HiveToDruidOperator
11 11 |
12 12 | DruidDbApiHook()
13 13 | DruidHook()
5 | DruidHook,
6 | )
7 | from airflow.operators.hive_to_druid import (
- HiveToDruidOperator,
8 | HiveToDruidTransfer,
9 | )
10 + from airflow.providers.apache.druid.transfers.hive_to_druid import HiveToDruidOperator
11 |
12 | DruidDbApiHook()
13 | DruidHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.hive_to_druid.HiveToDruidTransfer` is moved into `apache-druid` provider in Airflow 3.0;
--> AIR302_druid.py:16:1
@@ -85,15 +82,14 @@ AIR302 [*] `airflow.operators.hive_to_druid.HiveToDruidTransfer` is moved into `
| ^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-apache-druid>=1.0.0` and use `HiveToDruidOperator` from `airflow.providers.apache.druid.transfers.hive_to_druid` instead.
Unsafe fix
5 5 | DruidHook,
6 6 | )
7 7 | from airflow.operators.hive_to_druid import (
8 |- HiveToDruidOperator,
9 8 | HiveToDruidTransfer,
10 9 | )
10 |+from airflow.providers.apache.druid.transfers.hive_to_druid import HiveToDruidOperator
11 11 |
12 12 | DruidDbApiHook()
13 13 | DruidHook()
5 | DruidHook,
6 | )
7 | from airflow.operators.hive_to_druid import (
- HiveToDruidOperator,
8 | HiveToDruidTransfer,
9 | )
10 + from airflow.providers.apache.druid.transfers.hive_to_druid import HiveToDruidOperator
11 |
12 | DruidDbApiHook()
13 | DruidHook()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -12,20 +12,19 @@ AIR302 [*] `airflow.api.auth.backend.basic_auth.CLIENT_AUTH` is moved into `fab`
12 | auth_current_user()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `CLIENT_AUTH` from `airflow.providers.fab.auth_manager.api.auth.backend.basic_auth` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 3 | from airflow.api.auth.backend.basic_auth import (
4 |- CLIENT_AUTH,
5 4 | auth_current_user,
6 5 | init_app,
7 6 | requires_authentication,
8 7 | )
8 |+from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import CLIENT_AUTH
9 9 |
10 10 | CLIENT_AUTH
11 11 | init_app()
1 | from __future__ import annotations
2 |
3 | from airflow.api.auth.backend.basic_auth import (
- CLIENT_AUTH,
4 | auth_current_user,
5 | init_app,
6 | requires_authentication,
7 | )
8 + from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import CLIENT_AUTH
9 |
10 | CLIENT_AUTH
11 | init_app()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.api.auth.backend.basic_auth.init_app` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:11:1
@@ -37,18 +36,17 @@ AIR302 [*] `airflow.api.auth.backend.basic_auth.init_app` is moved into `fab` pr
13 | requires_authentication()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `init_app` from `airflow.providers.fab.auth_manager.api.auth.backend.basic_auth` instead.
Unsafe fix
3 3 | from airflow.api.auth.backend.basic_auth import (
4 4 | CLIENT_AUTH,
5 5 | auth_current_user,
6 |- init_app,
7 6 | requires_authentication,
8 7 | )
8 |+from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import init_app
9 9 |
10 10 | CLIENT_AUTH
11 11 | init_app()
3 | from airflow.api.auth.backend.basic_auth import (
4 | CLIENT_AUTH,
5 | auth_current_user,
- init_app,
6 | requires_authentication,
7 | )
8 + from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import init_app
9 |
10 | CLIENT_AUTH
11 | init_app()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.api.auth.backend.basic_auth.auth_current_user` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:12:1
@@ -60,19 +58,18 @@ AIR302 [*] `airflow.api.auth.backend.basic_auth.auth_current_user` is moved into
13 | requires_authentication()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `auth_current_user` from `airflow.providers.fab.auth_manager.api.auth.backend.basic_auth` instead.
Unsafe fix
2 2 |
3 3 | from airflow.api.auth.backend.basic_auth import (
4 4 | CLIENT_AUTH,
5 |- auth_current_user,
6 5 | init_app,
7 6 | requires_authentication,
8 7 | )
8 |+from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import auth_current_user
9 9 |
10 10 | CLIENT_AUTH
11 11 | init_app()
2 |
3 | from airflow.api.auth.backend.basic_auth import (
4 | CLIENT_AUTH,
- auth_current_user,
5 | init_app,
6 | requires_authentication,
7 | )
8 + from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import auth_current_user
9 |
10 | CLIENT_AUTH
11 | init_app()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.api.auth.backend.basic_auth.requires_authentication` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:13:1
@@ -85,17 +82,16 @@ AIR302 [*] `airflow.api.auth.backend.basic_auth.requires_authentication` is move
15 | from airflow.api.auth.backend.kerberos_auth import (
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `requires_authentication` from `airflow.providers.fab.auth_manager.api.auth.backend.basic_auth` instead.
Unsafe fix
4 4 | CLIENT_AUTH,
5 5 | auth_current_user,
6 6 | init_app,
7 |- requires_authentication,
8 7 | )
8 |+from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import requires_authentication
9 9 |
10 10 | CLIENT_AUTH
11 11 | init_app()
4 | CLIENT_AUTH,
5 | auth_current_user,
6 | init_app,
- requires_authentication,
7 | )
8 + from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import requires_authentication
9 |
10 | CLIENT_AUTH
11 | init_app()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.api.auth.backend.kerberos_auth.log` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:23:1
@@ -108,18 +104,17 @@ AIR302 [*] `airflow.api.auth.backend.kerberos_auth.log` is moved into `fab` prov
25 | find_user()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `log` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
Unsafe fix
16 16 | CLIENT_AUTH,
17 17 | find_user,
18 18 | init_app,
19 |- log,
20 19 | requires_authentication,
21 20 | )
21 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import log
22 22 |
23 23 | log()
24 24 | CLIENT_AUTH
16 | CLIENT_AUTH,
17 | find_user,
18 | init_app,
- log,
19 | requires_authentication,
20 | )
21 + from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import log
22 |
23 | log()
24 | CLIENT_AUTH
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.api.auth.backend.kerberos_auth.CLIENT_AUTH` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:24:1
@@ -131,21 +126,20 @@ AIR302 [*] `airflow.api.auth.backend.kerberos_auth.CLIENT_AUTH` is moved into `f
26 | init_app()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `CLIENT_AUTH` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
Unsafe fix
13 13 | requires_authentication()
14 14 |
15 15 | from airflow.api.auth.backend.kerberos_auth import (
16 |- CLIENT_AUTH,
17 16 | find_user,
18 17 | init_app,
19 18 | log,
20 19 | requires_authentication,
21 20 | )
21 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import CLIENT_AUTH
22 22 |
23 23 | log()
24 24 | CLIENT_AUTH
13 | requires_authentication()
14 |
15 | from airflow.api.auth.backend.kerberos_auth import (
- CLIENT_AUTH,
16 | find_user,
17 | init_app,
18 | log,
19 | requires_authentication,
20 | )
21 + from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import CLIENT_AUTH
22 |
23 | log()
24 | CLIENT_AUTH
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.api.auth.backend.kerberos_auth.find_user` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:25:1
@@ -158,20 +152,19 @@ AIR302 [*] `airflow.api.auth.backend.kerberos_auth.find_user` is moved into `fab
27 | requires_authentication()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `find_user` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
Unsafe fix
14 14 |
15 15 | from airflow.api.auth.backend.kerberos_auth import (
16 16 | CLIENT_AUTH,
17 |- find_user,
18 17 | init_app,
19 18 | log,
20 19 | requires_authentication,
21 20 | )
21 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import find_user
22 22 |
23 23 | log()
24 24 | CLIENT_AUTH
14 |
15 | from airflow.api.auth.backend.kerberos_auth import (
16 | CLIENT_AUTH,
- find_user,
17 | init_app,
18 | log,
19 | requires_authentication,
20 | )
21 + from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import find_user
22 |
23 | log()
24 | CLIENT_AUTH
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.api.auth.backend.kerberos_auth.init_app` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:26:1
@@ -183,19 +176,18 @@ AIR302 [*] `airflow.api.auth.backend.kerberos_auth.init_app` is moved into `fab`
27 | requires_authentication()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `init_app` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
Unsafe fix
15 15 | from airflow.api.auth.backend.kerberos_auth import (
16 16 | CLIENT_AUTH,
17 17 | find_user,
18 |- init_app,
19 18 | log,
20 19 | requires_authentication,
21 20 | )
21 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import init_app
22 22 |
23 23 | log()
24 24 | CLIENT_AUTH
15 | from airflow.api.auth.backend.kerberos_auth import (
16 | CLIENT_AUTH,
17 | find_user,
- init_app,
18 | log,
19 | requires_authentication,
20 | )
21 + from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import init_app
22 |
23 | log()
24 | CLIENT_AUTH
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.api.auth.backend.kerberos_auth.requires_authentication` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:27:1
@@ -208,17 +200,16 @@ AIR302 [*] `airflow.api.auth.backend.kerberos_auth.requires_authentication` is m
29 | from airflow.auth.managers.fab.api.auth.backend.kerberos_auth import (
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `requires_authentication` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
Unsafe fix
17 17 | find_user,
18 18 | init_app,
19 19 | log,
20 |- requires_authentication,
21 20 | )
21 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import requires_authentication
22 22 |
23 23 | log()
24 24 | CLIENT_AUTH
17 | find_user,
18 | init_app,
19 | log,
- requires_authentication,
20 | )
21 + from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import requires_authentication
22 |
23 | log()
24 | CLIENT_AUTH
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.log` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:37:1
@@ -231,18 +222,17 @@ AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.log` is mov
39 | find_user()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `log` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
Unsafe fix
30 30 | CLIENT_AUTH,
31 31 | find_user,
32 32 | init_app,
33 |- log,
34 33 | requires_authentication,
35 34 | )
35 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import log
36 36 |
37 37 | log()
38 38 | CLIENT_AUTH
30 | CLIENT_AUTH,
31 | find_user,
32 | init_app,
- log,
33 | requires_authentication,
34 | )
35 + from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import log
36 |
37 | log()
38 | CLIENT_AUTH
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.CLIENT_AUTH` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:38:1
@@ -254,21 +244,20 @@ AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.CLIENT_AUTH
40 | init_app()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `CLIENT_AUTH` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
Unsafe fix
27 27 | requires_authentication()
28 28 |
29 29 | from airflow.auth.managers.fab.api.auth.backend.kerberos_auth import (
30 |- CLIENT_AUTH,
31 30 | find_user,
32 31 | init_app,
33 32 | log,
34 33 | requires_authentication,
35 34 | )
35 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import CLIENT_AUTH
36 36 |
37 37 | log()
38 38 | CLIENT_AUTH
27 | requires_authentication()
28 |
29 | from airflow.auth.managers.fab.api.auth.backend.kerberos_auth import (
- CLIENT_AUTH,
30 | find_user,
31 | init_app,
32 | log,
33 | requires_authentication,
34 | )
35 + from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import CLIENT_AUTH
36 |
37 | log()
38 | CLIENT_AUTH
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.find_user` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:39:1
@@ -281,20 +270,19 @@ AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.find_user`
41 | requires_authentication()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `find_user` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
Unsafe fix
28 28 |
29 29 | from airflow.auth.managers.fab.api.auth.backend.kerberos_auth import (
30 30 | CLIENT_AUTH,
31 |- find_user,
32 31 | init_app,
33 32 | log,
34 33 | requires_authentication,
35 34 | )
35 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import find_user
36 36 |
37 37 | log()
38 38 | CLIENT_AUTH
28 |
29 | from airflow.auth.managers.fab.api.auth.backend.kerberos_auth import (
30 | CLIENT_AUTH,
- find_user,
31 | init_app,
32 | log,
33 | requires_authentication,
34 | )
35 + from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import find_user
36 |
37 | log()
38 | CLIENT_AUTH
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.init_app` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:40:1
@@ -306,19 +294,18 @@ AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.init_app` i
41 | requires_authentication()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `init_app` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
Unsafe fix
29 29 | from airflow.auth.managers.fab.api.auth.backend.kerberos_auth import (
30 30 | CLIENT_AUTH,
31 31 | find_user,
32 |- init_app,
33 32 | log,
34 33 | requires_authentication,
35 34 | )
35 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import init_app
36 36 |
37 37 | log()
38 38 | CLIENT_AUTH
29 | from airflow.auth.managers.fab.api.auth.backend.kerberos_auth import (
30 | CLIENT_AUTH,
31 | find_user,
- init_app,
32 | log,
33 | requires_authentication,
34 | )
35 + from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import init_app
36 |
37 | log()
38 | CLIENT_AUTH
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.requires_authentication` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:41:1
@@ -331,17 +318,16 @@ AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.requires_au
43 | from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `requires_authentication` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
Unsafe fix
31 31 | find_user,
32 32 | init_app,
33 33 | log,
34 |- requires_authentication,
35 34 | )
35 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import requires_authentication
36 36 |
37 37 | log()
38 38 | CLIENT_AUTH
31 | find_user,
32 | init_app,
33 | log,
- requires_authentication,
34 | )
35 + from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import requires_authentication
36 |
37 | log()
38 | CLIENT_AUTH
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.auth.managers.fab.fab_auth_manager.FabAuthManager` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:49:1
@@ -354,20 +340,19 @@ AIR302 [*] `airflow.auth.managers.fab.fab_auth_manager.FabAuthManager` is moved
51 | FabAirflowSecurityManagerOverride()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `FabAuthManager` from `airflow.providers.fab.auth_manager.fab_auth_manager` instead.
Unsafe fix
40 40 | init_app()
41 41 | requires_authentication()
42 42 |
43 |-from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
44 43 | from airflow.auth.managers.fab.security_manager.override import (
45 44 | MAX_NUM_DATABASE_USER_SESSIONS,
46 45 | FabAirflowSecurityManagerOverride,
47 46 | )
47 |+from airflow.providers.fab.auth_manager.fab_auth_manager import FabAuthManager
48 48 |
49 49 | FabAuthManager()
50 50 | MAX_NUM_DATABASE_USER_SESSIONS
40 | init_app()
41 | requires_authentication()
42 |
- from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
43 | from airflow.auth.managers.fab.security_manager.override import (
44 | MAX_NUM_DATABASE_USER_SESSIONS,
45 | FabAirflowSecurityManagerOverride,
46 | )
47 + from airflow.providers.fab.auth_manager.fab_auth_manager import FabAuthManager
48 |
49 | FabAuthManager()
50 | MAX_NUM_DATABASE_USER_SESSIONS
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.auth.managers.fab.security_manager.override.MAX_NUM_DATABASE_USER_SESSIONS` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:50:1
@@ -378,18 +363,17 @@ AIR302 [*] `airflow.auth.managers.fab.security_manager.override.MAX_NUM_DATABASE
51 | FabAirflowSecurityManagerOverride()
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `MAX_NUM_DATABASE_USER_SESSIONS` from `airflow.providers.fab.auth_manager.security_manager.override` instead.
Unsafe fix
42 42 |
43 43 | from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
44 44 | from airflow.auth.managers.fab.security_manager.override import (
45 |- MAX_NUM_DATABASE_USER_SESSIONS,
46 45 | FabAirflowSecurityManagerOverride,
47 46 | )
47 |+from airflow.providers.fab.auth_manager.security_manager.override import MAX_NUM_DATABASE_USER_SESSIONS
48 48 |
49 49 | FabAuthManager()
50 50 | MAX_NUM_DATABASE_USER_SESSIONS
42 |
43 | from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
44 | from airflow.auth.managers.fab.security_manager.override import (
- MAX_NUM_DATABASE_USER_SESSIONS,
45 | FabAirflowSecurityManagerOverride,
46 | )
47 + from airflow.providers.fab.auth_manager.security_manager.override import MAX_NUM_DATABASE_USER_SESSIONS
48 |
49 | FabAuthManager()
50 | MAX_NUM_DATABASE_USER_SESSIONS
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.auth.managers.fab.security_manager.override.FabAirflowSecurityManagerOverride` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:51:1
@@ -402,17 +386,16 @@ AIR302 [*] `airflow.auth.managers.fab.security_manager.override.FabAirflowSecuri
53 | from airflow.www.security import FabAirflowSecurityManagerOverride
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `FabAirflowSecurityManagerOverride` from `airflow.providers.fab.auth_manager.security_manager.override` instead.
Unsafe fix
43 43 | from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
44 44 | from airflow.auth.managers.fab.security_manager.override import (
45 45 | MAX_NUM_DATABASE_USER_SESSIONS,
46 |- FabAirflowSecurityManagerOverride,
47 46 | )
47 |+from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
48 48 |
49 49 | FabAuthManager()
50 50 | MAX_NUM_DATABASE_USER_SESSIONS
43 | from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
44 | from airflow.auth.managers.fab.security_manager.override import (
45 | MAX_NUM_DATABASE_USER_SESSIONS,
- FabAirflowSecurityManagerOverride,
46 | )
47 + from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
48 |
49 | FabAuthManager()
50 | MAX_NUM_DATABASE_USER_SESSIONS
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.www.security.FabAirflowSecurityManagerOverride` is moved into `fab` provider in Airflow 3.0;
--> AIR302_fab.py:55:1
@@ -423,12 +406,11 @@ AIR302 [*] `airflow.www.security.FabAirflowSecurityManagerOverride` is moved int
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-fab>=1.0.0` and use `FabAirflowSecurityManagerOverride` from `airflow.providers.fab.auth_manager.security_manager.override` instead.
Unsafe fix
50 50 | MAX_NUM_DATABASE_USER_SESSIONS
51 51 | FabAirflowSecurityManagerOverride()
52 52 |
53 |-from airflow.www.security import FabAirflowSecurityManagerOverride
53 |+from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
54 54 |
55 55 | FabAirflowSecurityManagerOverride()
50 | MAX_NUM_DATABASE_USER_SESSIONS
51 | FabAirflowSecurityManagerOverride()
52 |
- from airflow.www.security import FabAirflowSecurityManagerOverride
53 + from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
54 |
55 | FabAirflowSecurityManagerOverride()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -11,16 +11,15 @@ AIR302 [*] `airflow.hooks.webhdfs_hook.WebHDFSHook` is moved into `apache-hdfs`
7 | WebHdfsSensor()
|
help: Install `apache-airflow-providers-apache-hdfs>=1.0.0` and use `WebHDFSHook` from `airflow.providers.apache.hdfs.hooks.webhdfs` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 |-from airflow.hooks.webhdfs_hook import WebHDFSHook
4 3 | from airflow.sensors.web_hdfs_sensor import WebHdfsSensor
4 |+from airflow.providers.apache.hdfs.hooks.webhdfs import WebHDFSHook
5 5 |
6 6 | WebHDFSHook()
7 7 | WebHdfsSensor()
1 | from __future__ import annotations
2 |
- from airflow.hooks.webhdfs_hook import WebHDFSHook
3 | from airflow.sensors.web_hdfs_sensor import WebHdfsSensor
4 + from airflow.providers.apache.hdfs.hooks.webhdfs import WebHDFSHook
5 |
6 | WebHDFSHook()
7 | WebHdfsSensor()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.sensors.web_hdfs_sensor.WebHdfsSensor` is moved into `apache-hdfs` provider in Airflow 3.0;
--> AIR302_hdfs.py:7:1
@@ -30,13 +29,12 @@ AIR302 [*] `airflow.sensors.web_hdfs_sensor.WebHdfsSensor` is moved into `apache
| ^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-apache-hdfs>=1.0.0` and use `WebHdfsSensor` from `airflow.providers.apache.hdfs.sensors.web_hdfs` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 3 | from airflow.hooks.webhdfs_hook import WebHDFSHook
4 |-from airflow.sensors.web_hdfs_sensor import WebHdfsSensor
4 |+from airflow.providers.apache.hdfs.sensors.web_hdfs import WebHdfsSensor
5 5 |
6 6 | WebHDFSHook()
7 7 | WebHdfsSensor()
1 | from __future__ import annotations
2 |
3 | from airflow.hooks.webhdfs_hook import WebHDFSHook
- from airflow.sensors.web_hdfs_sensor import WebHdfsSensor
4 + from airflow.providers.apache.hdfs.sensors.web_hdfs import WebHdfsSensor
5 |
6 | WebHDFSHook()
7 | WebHdfsSensor()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -12,23 +12,22 @@ AIR302 [*] `airflow.hooks.hive_hooks.HIVE_QUEUE_PRIORITIES` is moved into `apach
20 | HiveMetastoreHook()
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HIVE_QUEUE_PRIORITIES` from `airflow.providers.apache.hive.hooks.hive` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 3 | from airflow.hooks.hive_hooks import (
4 |- HIVE_QUEUE_PRIORITIES,
5 4 | HiveCliHook,
6 5 | HiveMetastoreHook,
7 6 | HiveServer2Hook,
1 | from __future__ import annotations
2 |
3 | from airflow.hooks.hive_hooks import (
- HIVE_QUEUE_PRIORITIES,
4 | HiveCliHook,
5 | HiveMetastoreHook,
6 | HiveServer2Hook,
--------------------------------------------------------------------------------
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 |+from airflow.providers.apache.hive.hooks.hive import HIVE_QUEUE_PRIORITIES
17 17 |
18 18 | HIVE_QUEUE_PRIORITIES
19 19 | HiveCliHook()
13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 + from airflow.providers.apache.hive.hooks.hive import HIVE_QUEUE_PRIORITIES
17 |
18 | HIVE_QUEUE_PRIORITIES
19 | HiveCliHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.hooks.hive_hooks.HiveCliHook` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:19:1
@@ -40,23 +39,22 @@ AIR302 [*] `airflow.hooks.hive_hooks.HiveCliHook` is moved into `apache-hive` pr
21 | HiveServer2Hook()
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveCliHook` from `airflow.providers.apache.hive.hooks.hive` instead.
Unsafe fix
2 2 |
3 3 | from airflow.hooks.hive_hooks import (
4 4 | HIVE_QUEUE_PRIORITIES,
5 |- HiveCliHook,
6 5 | HiveMetastoreHook,
7 6 | HiveServer2Hook,
8 7 | )
2 |
3 | from airflow.hooks.hive_hooks import (
4 | HIVE_QUEUE_PRIORITIES,
- HiveCliHook,
5 | HiveMetastoreHook,
6 | HiveServer2Hook,
7 | )
--------------------------------------------------------------------------------
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 |+from airflow.providers.apache.hive.hooks.hive import HiveCliHook
17 17 |
18 18 | HIVE_QUEUE_PRIORITIES
19 19 | HiveCliHook()
13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 + from airflow.providers.apache.hive.hooks.hive import HiveCliHook
17 |
18 | HIVE_QUEUE_PRIORITIES
19 | HiveCliHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.hooks.hive_hooks.HiveMetastoreHook` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:20:1
@@ -68,23 +66,22 @@ AIR302 [*] `airflow.hooks.hive_hooks.HiveMetastoreHook` is moved into `apache-hi
21 | HiveServer2Hook()
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveMetastoreHook` from `airflow.providers.apache.hive.hooks.hive` instead.
Unsafe fix
3 3 | from airflow.hooks.hive_hooks import (
4 4 | HIVE_QUEUE_PRIORITIES,
5 5 | HiveCliHook,
6 |- HiveMetastoreHook,
7 6 | HiveServer2Hook,
8 7 | )
9 8 | from airflow.macros.hive import (
3 | from airflow.hooks.hive_hooks import (
4 | HIVE_QUEUE_PRIORITIES,
5 | HiveCliHook,
- HiveMetastoreHook,
6 | HiveServer2Hook,
7 | )
8 | from airflow.macros.hive import (
--------------------------------------------------------------------------------
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 |+from airflow.providers.apache.hive.hooks.hive import HiveMetastoreHook
17 17 |
18 18 | HIVE_QUEUE_PRIORITIES
19 19 | HiveCliHook()
13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 + from airflow.providers.apache.hive.hooks.hive import HiveMetastoreHook
17 |
18 | HIVE_QUEUE_PRIORITIES
19 | HiveCliHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.hooks.hive_hooks.HiveServer2Hook` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:21:1
@@ -97,23 +94,22 @@ AIR302 [*] `airflow.hooks.hive_hooks.HiveServer2Hook` is moved into `apache-hive
23 | closest_ds_partition()
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveServer2Hook` from `airflow.providers.apache.hive.hooks.hive` instead.
Unsafe fix
4 4 | HIVE_QUEUE_PRIORITIES,
5 5 | HiveCliHook,
6 6 | HiveMetastoreHook,
7 |- HiveServer2Hook,
8 7 | )
9 8 | from airflow.macros.hive import (
10 9 | closest_ds_partition,
4 | HIVE_QUEUE_PRIORITIES,
5 | HiveCliHook,
6 | HiveMetastoreHook,
- HiveServer2Hook,
7 | )
8 | from airflow.macros.hive import (
9 | closest_ds_partition,
--------------------------------------------------------------------------------
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 |+from airflow.providers.apache.hive.hooks.hive import HiveServer2Hook
17 17 |
18 18 | HIVE_QUEUE_PRIORITIES
19 19 | HiveCliHook()
13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 + from airflow.providers.apache.hive.hooks.hive import HiveServer2Hook
17 |
18 | HIVE_QUEUE_PRIORITIES
19 | HiveCliHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.macros.hive.closest_ds_partition` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:23:1
@@ -125,22 +121,21 @@ AIR302 [*] `airflow.macros.hive.closest_ds_partition` is moved into `apache-hive
24 | max_partition()
|
help: Install `apache-airflow-providers-apache-hive>=5.1.0` and use `closest_ds_partition` from `airflow.providers.apache.hive.macros.hive` instead.
Unsafe fix
7 7 | HiveServer2Hook,
8 8 | )
9 9 | from airflow.macros.hive import (
10 |- closest_ds_partition,
11 10 | max_partition,
12 11 | )
13 12 | from airflow.operators.hive_operator import HiveOperator
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 |+from airflow.providers.apache.hive.macros.hive import closest_ds_partition
17 17 |
18 18 | HIVE_QUEUE_PRIORITIES
19 19 | HiveCliHook()
7 | HiveServer2Hook,
8 | )
9 | from airflow.macros.hive import (
- closest_ds_partition,
10 | max_partition,
11 | )
12 | from airflow.operators.hive_operator import HiveOperator
13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 + from airflow.providers.apache.hive.macros.hive import closest_ds_partition
17 |
18 | HIVE_QUEUE_PRIORITIES
19 | HiveCliHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.macros.hive.max_partition` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:24:1
@@ -152,21 +147,20 @@ AIR302 [*] `airflow.macros.hive.max_partition` is moved into `apache-hive` provi
26 | HiveOperator()
|
help: Install `apache-airflow-providers-apache-hive>=5.1.0` and use `max_partition` from `airflow.providers.apache.hive.macros.hive` instead.
Unsafe fix
8 8 | )
9 9 | from airflow.macros.hive import (
10 10 | closest_ds_partition,
11 |- max_partition,
12 11 | )
13 12 | from airflow.operators.hive_operator import HiveOperator
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 |+from airflow.providers.apache.hive.macros.hive import max_partition
17 17 |
18 18 | HIVE_QUEUE_PRIORITIES
19 19 | HiveCliHook()
8 | )
9 | from airflow.macros.hive import (
10 | closest_ds_partition,
- max_partition,
11 | )
12 | from airflow.operators.hive_operator import HiveOperator
13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 + from airflow.providers.apache.hive.macros.hive import max_partition
17 |
18 | HIVE_QUEUE_PRIORITIES
19 | HiveCliHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.hive_operator.HiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:26:1
@@ -179,19 +173,18 @@ AIR302 [*] `airflow.operators.hive_operator.HiveOperator` is moved into `apache-
28 | HiveToMySqlOperator()
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveOperator` from `airflow.providers.apache.hive.operators.hive` instead.
Unsafe fix
10 10 | closest_ds_partition,
11 11 | max_partition,
12 12 | )
13 |-from airflow.operators.hive_operator import HiveOperator
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 |+from airflow.providers.apache.hive.operators.hive import HiveOperator
17 17 |
18 18 | HIVE_QUEUE_PRIORITIES
19 19 | HiveCliHook()
10 | closest_ds_partition,
11 | max_partition,
12 | )
- from airflow.operators.hive_operator import HiveOperator
13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 + from airflow.providers.apache.hive.operators.hive import HiveOperator
17 |
18 | HIVE_QUEUE_PRIORITIES
19 | HiveCliHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.hive_stats_operator.HiveStatsCollectionOperator` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:27:1
@@ -203,18 +196,17 @@ AIR302 [*] `airflow.operators.hive_stats_operator.HiveStatsCollectionOperator` i
29 | HiveToSambaOperator()
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveStatsCollectionOperator` from `airflow.providers.apache.hive.operators.hive_stats` instead.
Unsafe fix
11 11 | max_partition,
12 12 | )
13 13 | from airflow.operators.hive_operator import HiveOperator
14 |-from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 |+from airflow.providers.apache.hive.operators.hive_stats import HiveStatsCollectionOperator
17 17 |
18 18 | HIVE_QUEUE_PRIORITIES
19 19 | HiveCliHook()
11 | max_partition,
12 | )
13 | from airflow.operators.hive_operator import HiveOperator
- from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 + from airflow.providers.apache.hive.operators.hive_stats import HiveStatsCollectionOperator
17 |
18 | HIVE_QUEUE_PRIORITIES
19 | HiveCliHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.hive_to_mysql.HiveToMySqlOperator` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:28:1
@@ -226,17 +218,16 @@ AIR302 [*] `airflow.operators.hive_to_mysql.HiveToMySqlOperator` is moved into `
29 | HiveToSambaOperator()
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveToMySqlOperator` from `airflow.providers.apache.hive.transfers.hive_to_mysql` instead.
Unsafe fix
12 12 | )
13 13 | from airflow.operators.hive_operator import HiveOperator
14 14 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 |-from airflow.operators.hive_to_mysql import HiveToMySqlOperator
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 |+from airflow.providers.apache.hive.transfers.hive_to_mysql import HiveToMySqlOperator
17 17 |
18 18 | HIVE_QUEUE_PRIORITIES
19 19 | HiveCliHook()
12 | )
13 | from airflow.operators.hive_operator import HiveOperator
14 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
- from airflow.operators.hive_to_mysql import HiveToMySqlOperator
15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 + from airflow.providers.apache.hive.transfers.hive_to_mysql import HiveToMySqlOperator
17 |
18 | HIVE_QUEUE_PRIORITIES
19 | HiveCliHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.hive_to_samba_operator.HiveToSambaOperator` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:29:1
@@ -247,16 +238,15 @@ AIR302 [*] `airflow.operators.hive_to_samba_operator.HiveToSambaOperator` is mov
| ^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveToSambaOperator` from `airflow.providers.apache.hive.transfers.hive_to_samba` instead.
Unsafe fix
13 13 | from airflow.operators.hive_operator import HiveOperator
14 14 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 15 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
16 |-from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 |+from airflow.providers.apache.hive.transfers.hive_to_samba import HiveToSambaOperator
17 17 |
18 18 | HIVE_QUEUE_PRIORITIES
19 19 | HiveCliHook()
13 | from airflow.operators.hive_operator import HiveOperator
14 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
15 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
- from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
16 + from airflow.providers.apache.hive.transfers.hive_to_samba import HiveToSambaOperator
17 |
18 | HIVE_QUEUE_PRIORITIES
19 | HiveCliHook()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.hive_to_mysql.HiveToMySqlTransfer` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:34:1
@@ -269,15 +259,14 @@ AIR302 [*] `airflow.operators.hive_to_mysql.HiveToMySqlTransfer` is moved into `
36 | from airflow.operators.mysql_to_hive import MySqlToHiveOperator
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveToMySqlOperator` from `airflow.providers.apache.hive.transfers.hive_to_mysql` instead.
Unsafe fix
30 30 |
31 31 |
32 32 | from airflow.operators.hive_to_mysql import HiveToMySqlTransfer
33 |+from airflow.providers.apache.hive.transfers.hive_to_mysql import HiveToMySqlOperator
33 34 |
34 35 | HiveToMySqlTransfer()
35 36 |
30 |
31 |
32 | from airflow.operators.hive_to_mysql import HiveToMySqlTransfer
33 + from airflow.providers.apache.hive.transfers.hive_to_mysql import HiveToMySqlOperator
34 |
35 | HiveToMySqlTransfer()
36 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.mysql_to_hive.MySqlToHiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:38:1
@@ -290,16 +279,15 @@ AIR302 [*] `airflow.operators.mysql_to_hive.MySqlToHiveOperator` is moved into `
40 | from airflow.operators.mysql_to_hive import MySqlToHiveTransfer
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MySqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mysql_to_hive` instead.
Unsafe fix
33 33 |
34 34 | HiveToMySqlTransfer()
35 35 |
36 |-from airflow.operators.mysql_to_hive import MySqlToHiveOperator
36 |+from airflow.providers.apache.hive.transfers.mysql_to_hive import MySqlToHiveOperator
37 37 |
38 38 | MySqlToHiveOperator()
39 39 |
33 |
34 | HiveToMySqlTransfer()
35 |
- from airflow.operators.mysql_to_hive import MySqlToHiveOperator
36 + from airflow.providers.apache.hive.transfers.mysql_to_hive import MySqlToHiveOperator
37 |
38 | MySqlToHiveOperator()
39 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.mysql_to_hive.MySqlToHiveTransfer` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:42:1
@@ -312,15 +300,14 @@ AIR302 [*] `airflow.operators.mysql_to_hive.MySqlToHiveTransfer` is moved into `
44 | from airflow.operators.mssql_to_hive import MsSqlToHiveOperator
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MySqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mysql_to_hive` instead.
Unsafe fix
38 38 | MySqlToHiveOperator()
39 39 |
40 40 | from airflow.operators.mysql_to_hive import MySqlToHiveTransfer
41 |+from airflow.providers.apache.hive.transfers.mysql_to_hive import MySqlToHiveOperator
41 42 |
42 43 | MySqlToHiveTransfer()
43 44 |
38 | MySqlToHiveOperator()
39 |
40 | from airflow.operators.mysql_to_hive import MySqlToHiveTransfer
41 + from airflow.providers.apache.hive.transfers.mysql_to_hive import MySqlToHiveOperator
42 |
43 | MySqlToHiveTransfer()
44 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.mssql_to_hive.MsSqlToHiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:46:1
@@ -333,16 +320,15 @@ AIR302 [*] `airflow.operators.mssql_to_hive.MsSqlToHiveOperator` is moved into `
48 | from airflow.operators.mssql_to_hive import MsSqlToHiveTransfer
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MsSqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mssql_to_hive` instead.
Unsafe fix
41 41 |
42 42 | MySqlToHiveTransfer()
43 43 |
44 |-from airflow.operators.mssql_to_hive import MsSqlToHiveOperator
44 |+from airflow.providers.apache.hive.transfers.mssql_to_hive import MsSqlToHiveOperator
45 45 |
46 46 | MsSqlToHiveOperator()
47 47 |
41 |
42 | MySqlToHiveTransfer()
43 |
- from airflow.operators.mssql_to_hive import MsSqlToHiveOperator
44 + from airflow.providers.apache.hive.transfers.mssql_to_hive import MsSqlToHiveOperator
45 |
46 | MsSqlToHiveOperator()
47 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.mssql_to_hive.MsSqlToHiveTransfer` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:50:1
@@ -355,15 +341,14 @@ AIR302 [*] `airflow.operators.mssql_to_hive.MsSqlToHiveTransfer` is moved into `
52 | from airflow.operators.s3_to_hive_operator import S3ToHiveOperator
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MsSqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mssql_to_hive` instead.
Unsafe fix
46 46 | MsSqlToHiveOperator()
47 47 |
48 48 | from airflow.operators.mssql_to_hive import MsSqlToHiveTransfer
49 |+from airflow.providers.apache.hive.transfers.mssql_to_hive import MsSqlToHiveOperator
49 50 |
50 51 | MsSqlToHiveTransfer()
51 52 |
46 | MsSqlToHiveOperator()
47 |
48 | from airflow.operators.mssql_to_hive import MsSqlToHiveTransfer
49 + from airflow.providers.apache.hive.transfers.mssql_to_hive import MsSqlToHiveOperator
50 |
51 | MsSqlToHiveTransfer()
52 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.s3_to_hive_operator.S3ToHiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:54:1
@@ -376,16 +361,15 @@ AIR302 [*] `airflow.operators.s3_to_hive_operator.S3ToHiveOperator` is moved int
56 | from airflow.operators.s3_to_hive_operator import S3ToHiveTransfer
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `S3ToHiveOperator` from `airflow.providers.apache.hive.transfers.s3_to_hive` instead.
Unsafe fix
49 49 |
50 50 | MsSqlToHiveTransfer()
51 51 |
52 |-from airflow.operators.s3_to_hive_operator import S3ToHiveOperator
52 |+from airflow.providers.apache.hive.transfers.s3_to_hive import S3ToHiveOperator
53 53 |
54 54 | S3ToHiveOperator()
55 55 |
49 |
50 | MsSqlToHiveTransfer()
51 |
- from airflow.operators.s3_to_hive_operator import S3ToHiveOperator
52 + from airflow.providers.apache.hive.transfers.s3_to_hive import S3ToHiveOperator
53 |
54 | S3ToHiveOperator()
55 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.s3_to_hive_operator.S3ToHiveTransfer` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:58:1
@@ -398,15 +382,14 @@ AIR302 [*] `airflow.operators.s3_to_hive_operator.S3ToHiveTransfer` is moved int
60 | from airflow.sensors.hive_partition_sensor import HivePartitionSensor
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `S3ToHiveOperator` from `airflow.providers.apache.hive.transfers.s3_to_hive` instead.
Unsafe fix
54 54 | S3ToHiveOperator()
55 55 |
56 56 | from airflow.operators.s3_to_hive_operator import S3ToHiveTransfer
57 |+from airflow.providers.apache.hive.transfers.s3_to_hive import S3ToHiveOperator
57 58 |
58 59 | S3ToHiveTransfer()
59 60 |
54 | S3ToHiveOperator()
55 |
56 | from airflow.operators.s3_to_hive_operator import S3ToHiveTransfer
57 + from airflow.providers.apache.hive.transfers.s3_to_hive import S3ToHiveOperator
58 |
59 | S3ToHiveTransfer()
60 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.sensors.hive_partition_sensor.HivePartitionSensor` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:62:1
@@ -419,16 +402,15 @@ AIR302 [*] `airflow.sensors.hive_partition_sensor.HivePartitionSensor` is moved
64 | from airflow.sensors.metastore_partition_sensor import MetastorePartitionSensor
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HivePartitionSensor` from `airflow.providers.apache.hive.sensors.hive_partition` instead.
Unsafe fix
57 57 |
58 58 | S3ToHiveTransfer()
59 59 |
60 |-from airflow.sensors.hive_partition_sensor import HivePartitionSensor
60 |+from airflow.providers.apache.hive.sensors.hive_partition import HivePartitionSensor
61 61 |
62 62 | HivePartitionSensor()
63 63 |
57 |
58 | S3ToHiveTransfer()
59 |
- from airflow.sensors.hive_partition_sensor import HivePartitionSensor
60 + from airflow.providers.apache.hive.sensors.hive_partition import HivePartitionSensor
61 |
62 | HivePartitionSensor()
63 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.sensors.metastore_partition_sensor.MetastorePartitionSensor` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:66:1
@@ -441,16 +423,15 @@ AIR302 [*] `airflow.sensors.metastore_partition_sensor.MetastorePartitionSensor`
68 | from airflow.sensors.named_hive_partition_sensor import NamedHivePartitionSensor
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MetastorePartitionSensor` from `airflow.providers.apache.hive.sensors.metastore_partition` instead.
Unsafe fix
61 61 |
62 62 | HivePartitionSensor()
63 63 |
64 |-from airflow.sensors.metastore_partition_sensor import MetastorePartitionSensor
64 |+from airflow.providers.apache.hive.sensors.metastore_partition import MetastorePartitionSensor
65 65 |
66 66 | MetastorePartitionSensor()
67 67 |
61 |
62 | HivePartitionSensor()
63 |
- from airflow.sensors.metastore_partition_sensor import MetastorePartitionSensor
64 + from airflow.providers.apache.hive.sensors.metastore_partition import MetastorePartitionSensor
65 |
66 | MetastorePartitionSensor()
67 |
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.sensors.named_hive_partition_sensor.NamedHivePartitionSensor` is moved into `apache-hive` provider in Airflow 3.0;
--> AIR302_hive.py:70:1
@@ -461,12 +442,11 @@ AIR302 [*] `airflow.sensors.named_hive_partition_sensor.NamedHivePartitionSensor
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `NamedHivePartitionSensor` from `airflow.providers.apache.hive.sensors.named_hive_partition` instead.
Unsafe fix
65 65 |
66 66 | MetastorePartitionSensor()
67 67 |
68 |-from airflow.sensors.named_hive_partition_sensor import NamedHivePartitionSensor
68 |+from airflow.providers.apache.hive.sensors.named_hive_partition import NamedHivePartitionSensor
69 69 |
70 70 | NamedHivePartitionSensor()
65 |
66 | MetastorePartitionSensor()
67 |
- from airflow.sensors.named_hive_partition_sensor import NamedHivePartitionSensor
68 + from airflow.providers.apache.hive.sensors.named_hive_partition import NamedHivePartitionSensor
69 |
70 | NamedHivePartitionSensor()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -12,17 +12,16 @@ AIR302 [*] `airflow.hooks.http_hook.HttpHook` is moved into `http` provider in A
9 | HttpSensor()
|
help: Install `apache-airflow-providers-http>=1.0.0` and use `HttpHook` from `airflow.providers.http.hooks.http` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 |-from airflow.hooks.http_hook import HttpHook
4 3 | from airflow.operators.http_operator import SimpleHttpOperator
5 4 | from airflow.sensors.http_sensor import HttpSensor
5 |+from airflow.providers.http.hooks.http import HttpHook
6 6 |
7 7 | HttpHook()
8 8 | SimpleHttpOperator()
1 | from __future__ import annotations
2 |
- from airflow.hooks.http_hook import HttpHook
3 | from airflow.operators.http_operator import SimpleHttpOperator
4 | from airflow.sensors.http_sensor import HttpSensor
5 + from airflow.providers.http.hooks.http import HttpHook
6 |
7 | HttpHook()
8 | SimpleHttpOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.http_operator.SimpleHttpOperator` is moved into `http` provider in Airflow 3.0;
--> AIR302_http.py:8:1
@@ -33,17 +32,15 @@ AIR302 [*] `airflow.operators.http_operator.SimpleHttpOperator` is moved into `h
9 | HttpSensor()
|
help: Install `apache-airflow-providers-http>=5.0.0` and use `HttpOperator` from `airflow.providers.http.operators.http` instead.
Safe fix
3 3 | from airflow.hooks.http_hook import HttpHook
4 4 | from airflow.operators.http_operator import SimpleHttpOperator
5 5 | from airflow.sensors.http_sensor import HttpSensor
6 |+from airflow.providers.http.operators.http import HttpOperator
6 7 |
7 8 | HttpHook()
8 |-SimpleHttpOperator()
9 |+HttpOperator()
9 10 | HttpSensor()
3 | from airflow.hooks.http_hook import HttpHook
4 | from airflow.operators.http_operator import SimpleHttpOperator
5 | from airflow.sensors.http_sensor import HttpSensor
6 + from airflow.providers.http.operators.http import HttpOperator
7 |
8 | HttpHook()
- SimpleHttpOperator()
9 + HttpOperator()
10 | HttpSensor()
AIR302 [*] `airflow.sensors.http_sensor.HttpSensor` is moved into `http` provider in Airflow 3.0;
--> AIR302_http.py:9:1
@@ -54,13 +51,12 @@ AIR302 [*] `airflow.sensors.http_sensor.HttpSensor` is moved into `http` provide
| ^^^^^^^^^^
|
help: Install `apache-airflow-providers-http>=1.0.0` and use `HttpSensor` from `airflow.providers.http.sensors.http` instead.
Unsafe fix
2 2 |
3 3 | from airflow.hooks.http_hook import HttpHook
4 4 | from airflow.operators.http_operator import SimpleHttpOperator
5 |-from airflow.sensors.http_sensor import HttpSensor
5 |+from airflow.providers.http.sensors.http import HttpSensor
6 6 |
7 7 | HttpHook()
8 8 | SimpleHttpOperator()
2 |
3 | from airflow.hooks.http_hook import HttpHook
4 | from airflow.operators.http_operator import SimpleHttpOperator
- from airflow.sensors.http_sensor import HttpSensor
5 + from airflow.providers.http.sensors.http import HttpSensor
6 |
7 | HttpHook()
8 | SimpleHttpOperator()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -11,18 +11,17 @@ AIR302 [*] `airflow.hooks.jdbc_hook.JdbcHook` is moved into `jdbc` provider in A
9 | jaydebeapi()
|
help: Install `apache-airflow-providers-jdbc>=1.0.0` and use `JdbcHook` from `airflow.providers.jdbc.hooks.jdbc` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 3 | from airflow.hooks.jdbc_hook import (
4 |- JdbcHook,
5 4 | jaydebeapi,
6 5 | )
6 |+from airflow.providers.jdbc.hooks.jdbc import JdbcHook
7 7 |
8 8 | JdbcHook()
9 9 | jaydebeapi()
1 | from __future__ import annotations
2 |
3 | from airflow.hooks.jdbc_hook import (
- JdbcHook,
4 | jaydebeapi,
5 | )
6 + from airflow.providers.jdbc.hooks.jdbc import JdbcHook
7 |
8 | JdbcHook()
9 | jaydebeapi()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.hooks.jdbc_hook.jaydebeapi` is moved into `jdbc` provider in Airflow 3.0;
--> AIR302_jdbc.py:9:1
@@ -32,14 +31,13 @@ AIR302 [*] `airflow.hooks.jdbc_hook.jaydebeapi` is moved into `jdbc` provider in
| ^^^^^^^^^^
|
help: Install `apache-airflow-providers-jdbc>=1.0.0` and use `jaydebeapi` from `airflow.providers.jdbc.hooks.jdbc` instead.
Unsafe fix
2 2 |
3 3 | from airflow.hooks.jdbc_hook import (
4 4 | JdbcHook,
5 |- jaydebeapi,
6 5 | )
6 |+from airflow.providers.jdbc.hooks.jdbc import jaydebeapi
7 7 |
8 8 | JdbcHook()
9 9 | jaydebeapi()
2 |
3 | from airflow.hooks.jdbc_hook import (
4 | JdbcHook,
- jaydebeapi,
5 | )
6 + from airflow.providers.jdbc.hooks.jdbc import jaydebeapi
7 |
8 | JdbcHook()
9 | jaydebeapi()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -12,19 +12,18 @@ AIR302 [*] `airflow.hooks.mysql_hook.MySqlHook` is moved into `mysql` provider i
11 | PrestoToMySqlTransfer()
|
help: Install `apache-airflow-providers-mysql>=1.0.0` and use `MySqlHook` from `airflow.providers.mysql.hooks.mysql` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 |-from airflow.hooks.mysql_hook import MySqlHook
4 3 | from airflow.operators.presto_to_mysql import (
5 4 | PrestoToMySqlOperator,
6 5 | PrestoToMySqlTransfer,
7 6 | )
7 |+from airflow.providers.mysql.hooks.mysql import MySqlHook
8 8 |
9 9 | MySqlHook()
10 10 | PrestoToMySqlOperator()
1 | from __future__ import annotations
2 |
- from airflow.hooks.mysql_hook import MySqlHook
3 | from airflow.operators.presto_to_mysql import (
4 | PrestoToMySqlOperator,
5 | PrestoToMySqlTransfer,
6 | )
7 + from airflow.providers.mysql.hooks.mysql import MySqlHook
8 |
9 | MySqlHook()
10 | PrestoToMySqlOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.presto_to_mysql.PrestoToMySqlOperator` is moved into `mysql` provider in Airflow 3.0;
--> AIR302_mysql.py:10:1
@@ -35,18 +34,17 @@ AIR302 [*] `airflow.operators.presto_to_mysql.PrestoToMySqlOperator` is moved in
11 | PrestoToMySqlTransfer()
|
help: Install `apache-airflow-providers-mysql>=1.0.0` and use `PrestoToMySqlOperator` from `airflow.providers.mysql.transfers.presto_to_mysql` instead.
Unsafe fix
2 2 |
3 3 | from airflow.hooks.mysql_hook import MySqlHook
4 4 | from airflow.operators.presto_to_mysql import (
5 |- PrestoToMySqlOperator,
6 5 | PrestoToMySqlTransfer,
7 6 | )
7 |+from airflow.providers.mysql.transfers.presto_to_mysql import PrestoToMySqlOperator
8 8 |
9 9 | MySqlHook()
10 10 | PrestoToMySqlOperator()
2 |
3 | from airflow.hooks.mysql_hook import MySqlHook
4 | from airflow.operators.presto_to_mysql import (
- PrestoToMySqlOperator,
5 | PrestoToMySqlTransfer,
6 | )
7 + from airflow.providers.mysql.transfers.presto_to_mysql import PrestoToMySqlOperator
8 |
9 | MySqlHook()
10 | PrestoToMySqlOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.presto_to_mysql.PrestoToMySqlTransfer` is moved into `mysql` provider in Airflow 3.0;
--> AIR302_mysql.py:11:1
@@ -57,15 +55,14 @@ AIR302 [*] `airflow.operators.presto_to_mysql.PrestoToMySqlTransfer` is moved in
| ^^^^^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-mysql>=1.0.0` and use `PrestoToMySqlOperator` from `airflow.providers.mysql.transfers.presto_to_mysql` instead.
Unsafe fix
2 2 |
3 3 | from airflow.hooks.mysql_hook import MySqlHook
4 4 | from airflow.operators.presto_to_mysql import (
5 |- PrestoToMySqlOperator,
6 5 | PrestoToMySqlTransfer,
7 6 | )
7 |+from airflow.providers.mysql.transfers.presto_to_mysql import PrestoToMySqlOperator
8 8 |
9 9 | MySqlHook()
10 10 | PrestoToMySqlOperator()
2 |
3 | from airflow.hooks.mysql_hook import MySqlHook
4 | from airflow.operators.presto_to_mysql import (
- PrestoToMySqlOperator,
5 | PrestoToMySqlTransfer,
6 | )
7 + from airflow.providers.mysql.transfers.presto_to_mysql import PrestoToMySqlOperator
8 |
9 | MySqlHook()
10 | PrestoToMySqlOperator()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -10,11 +10,10 @@ AIR302 [*] `airflow.hooks.oracle_hook.OracleHook` is moved into `oracle` provide
| ^^^^^^^^^^
|
help: Install `apache-airflow-providers-oracle>=1.0.0` and use `OracleHook` from `airflow.providers.oracle.hooks.oracle` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 |-from airflow.hooks.oracle_hook import OracleHook
3 |+from airflow.providers.oracle.hooks.oracle import OracleHook
4 4 |
5 5 | OracleHook()
1 | from __future__ import annotations
2 |
- from airflow.hooks.oracle_hook import OracleHook
3 + from airflow.providers.oracle.hooks.oracle import OracleHook
4 |
5 | OracleHook()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -10,11 +10,10 @@ AIR302 [*] `airflow.operators.papermill_operator.PapermillOperator` is moved int
| ^^^^^^^^^^^^^^^^^
|
help: Install `apache-airflow-providers-papermill>=1.0.0` and use `PapermillOperator` from `airflow.providers.papermill.operators.papermill` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 |-from airflow.operators.papermill_operator import PapermillOperator
3 |+from airflow.providers.papermill.operators.papermill import PapermillOperator
4 4 |
5 5 | PapermillOperator()
1 | from __future__ import annotations
2 |
- from airflow.operators.papermill_operator import PapermillOperator
3 + from airflow.providers.papermill.operators.papermill import PapermillOperator
4 |
5 | PapermillOperator()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -11,16 +11,15 @@ AIR302 [*] `airflow.hooks.pig_hook.PigCliHook` is moved into `apache-pig` provid
7 | PigOperator()
|
help: Install `apache-airflow-providers-apache-pig>=1.0.0` and use `PigCliHook` from `airflow.providers.apache.pig.hooks.pig` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 |-from airflow.hooks.pig_hook import PigCliHook
4 3 | from airflow.operators.pig_operator import PigOperator
4 |+from airflow.providers.apache.pig.hooks.pig import PigCliHook
5 5 |
6 6 | PigCliHook()
7 7 | PigOperator()
1 | from __future__ import annotations
2 |
- from airflow.hooks.pig_hook import PigCliHook
3 | from airflow.operators.pig_operator import PigOperator
4 + from airflow.providers.apache.pig.hooks.pig import PigCliHook
5 |
6 | PigCliHook()
7 | PigOperator()
note: This is an unsafe fix and may change runtime behavior
AIR302 [*] `airflow.operators.pig_operator.PigOperator` is moved into `apache-pig` provider in Airflow 3.0;
--> AIR302_pig.py:7:1
@@ -30,13 +29,12 @@ AIR302 [*] `airflow.operators.pig_operator.PigOperator` is moved into `apache-pi
| ^^^^^^^^^^^
|
help: Install `apache-airflow-providers-apache-pig>=1.0.0` and use `PigOperator` from `airflow.providers.apache.pig.operators.pig` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 3 | from airflow.hooks.pig_hook import PigCliHook
4 |-from airflow.operators.pig_operator import PigOperator
4 |+from airflow.providers.apache.pig.operators.pig import PigOperator
5 5 |
6 6 | PigCliHook()
7 7 | PigOperator()
1 | from __future__ import annotations
2 |
3 | from airflow.hooks.pig_hook import PigCliHook
- from airflow.operators.pig_operator import PigOperator
4 + from airflow.providers.apache.pig.operators.pig import PigOperator
5 |
6 | PigCliHook()
7 | PigOperator()
note: This is an unsafe fix and may change runtime behavior

View File

@@ -11,16 +11,15 @@ AIR302 [*] `airflow.hooks.postgres_hook.PostgresHook` is moved into `postgres` p
7 | Mapping()
|
help: Install `apache-airflow-providers-postgres>=1.0.0` and use `PostgresHook` from `airflow.providers.postgres.hooks.postgres` instead.
Unsafe fix
1 1 | from __future__ import annotations
2 2 |
3 |-from airflow.hooks.postgres_hook import PostgresHook
4 3 | from airflow.operators.postgres_operator import Mapping
4 |+from airflow.providers.postgres.hooks.postgres import PostgresHook
5 5 |
6 6 | PostgresHook()
7 7 | Mapping()
1 | from __future__ import annotations
2 |
- from airflow.hooks.postgres_hook import PostgresHook
3 | from airflow.operators.postgres_operator import Mapping
4 + from airflow.providers.postgres.hooks.postgres import PostgresHook
5 |
6 | PostgresHook()
7 | Mapping()
note: This is an unsafe fix and may change runtime behavior
AIR302 `airflow.operators.postgres_operator.Mapping` is removed in Airflow 3.0
--> AIR302_postgres.py:7:1

Some files were not shown because too many files have changed in this diff Show More