mirror of https://github.com/astral-sh/ruff
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
This commit is contained in:
parent
1842cfe333
commit
f703536977
|
|
@ -1,12 +1,11 @@
|
|||
use std::borrow::Cow;
|
||||
use std::num::NonZeroUsize;
|
||||
|
||||
use anstyle::Style;
|
||||
use ruff_notebook::NotebookIndex;
|
||||
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};
|
||||
|
||||
|
|
@ -58,13 +57,14 @@ impl<'a> FullRenderer<'a> {
|
|||
for diag in renderable.diagnostics.iter() {
|
||||
writeln!(f, "{}", renderer.render(diag.to_annotate()))?;
|
||||
}
|
||||
writeln!(f)?;
|
||||
|
||||
if self.config.show_fix_diff {
|
||||
if let Some(diff) = Diff::from_diagnostic(diag, &stylesheet, self.resolver) {
|
||||
writeln!(f, "{diff}")?;
|
||||
write!(f, "{diff}")?;
|
||||
}
|
||||
}
|
||||
|
||||
writeln!(f)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
@ -126,19 +126,6 @@ impl std::fmt::Display for Diff<'_> {
|
|||
vec![(None, source_text.text_len())]
|
||||
};
|
||||
|
||||
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",
|
||||
};
|
||||
|
||||
// TODO(brent) `stylesheet.separator` is cyan rather than blue, as we had before. I think
|
||||
// we're getting rid of this soon anyway, so I didn't think it was worth adding another
|
||||
// style to the stylesheet temporarily. The color doesn't appear at all in the snapshot
|
||||
// tests, which is the only place these are currently used.
|
||||
writeln!(f, "ℹ {}", fmt_styled(message, self.stylesheet.separator))?;
|
||||
|
||||
let mut last_end = TextSize::ZERO;
|
||||
for (cell, offset) in cells {
|
||||
let range = TextRange::new(last_end, offset);
|
||||
|
|
@ -167,64 +154,67 @@ impl std::fmt::Display for Diff<'_> {
|
|||
|
||||
let diff = TextDiff::from_lines(input, &output);
|
||||
|
||||
let (largest_old, largest_new) = diff
|
||||
.ops()
|
||||
.last()
|
||||
.map(|op| (op.old_range().start, op.new_range().start))
|
||||
.unwrap_or_default();
|
||||
let grouped_ops = diff.grouped_ops(3);
|
||||
|
||||
let digit_with = OneIndexed::from_zero_indexed(largest_new.max(largest_old)).digits();
|
||||
// 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 2 digits, 2 x 1 space before each digit, 1 space, and 1 `|`. This
|
||||
// centers the three colons on the pipe.
|
||||
writeln!(f, "{:>1$} cell {cell}", ":::", 2 * digit_with.get() + 4)?;
|
||||
// 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 diff.grouped_ops(3).iter().enumerate() {
|
||||
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 = match change.tag() {
|
||||
ChangeTag::Delete => "-",
|
||||
ChangeTag::Insert => "+",
|
||||
ChangeTag::Equal => " ",
|
||||
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_style = LineStyle::from(change.tag(), self.stylesheet);
|
||||
|
||||
let old_index = change.old_index().map(OneIndexed::from_zero_indexed);
|
||||
let new_index = change.new_index().map(OneIndexed::from_zero_indexed);
|
||||
let line = Line {
|
||||
index: index.map(OneIndexed::from_zero_indexed),
|
||||
width: digit_with,
|
||||
};
|
||||
|
||||
write!(
|
||||
f,
|
||||
"{} {} |{}",
|
||||
Line {
|
||||
index: old_index,
|
||||
width: digit_with,
|
||||
},
|
||||
Line {
|
||||
index: new_index,
|
||||
width: digit_with,
|
||||
},
|
||||
fmt_styled(line_style.apply_to(sign), self.stylesheet.emphasis),
|
||||
"{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(
|
||||
line_style.apply_to(&value),
|
||||
self.stylesheet.underline
|
||||
)
|
||||
)?;
|
||||
write!(f, "{}", fmt_styled(styled, self.stylesheet.emphasis))?;
|
||||
} else {
|
||||
write!(f, "{}", line_style.apply_to(&value))?;
|
||||
write!(f, "{styled}")?;
|
||||
}
|
||||
}
|
||||
if change.missing_newline() {
|
||||
|
|
@ -235,31 +225,35 @@ impl std::fmt::Display for Diff<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
struct LineStyle {
|
||||
style: Style,
|
||||
}
|
||||
|
||||
impl LineStyle {
|
||||
fn apply_to(&self, input: &str) -> impl std::fmt::Display {
|
||||
fmt_styled(input, self.style)
|
||||
}
|
||||
|
||||
fn from(value: ChangeTag, stylesheet: &DiagnosticStylesheet) -> LineStyle {
|
||||
match value {
|
||||
ChangeTag::Equal => LineStyle {
|
||||
style: stylesheet.none,
|
||||
},
|
||||
ChangeTag::Delete => LineStyle {
|
||||
style: stylesheet.deletion,
|
||||
},
|
||||
ChangeTag::Insert => LineStyle {
|
||||
style: stylesheet.insertion,
|
||||
},
|
||||
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(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +291,7 @@ fn show_nonprinting(s: &str) -> Cow<'_, str> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ruff_diagnostics::{Applicability, Fix};
|
||||
use ruff_diagnostics::{Applicability, Edit, Fix};
|
||||
use ruff_text_size::{TextLen, TextRange, TextSize};
|
||||
|
||||
use crate::diagnostic::{
|
||||
|
|
@ -712,11 +706,9 @@ print()
|
|||
| ^^
|
||||
|
|
||||
help: Remove unused import: `os`
|
||||
|
||||
ℹ Safe fix
|
||||
::: cell 1
|
||||
1 1 | # cell 1
|
||||
2 |-import os
|
||||
::: cell 1
|
||||
1 | # cell 1
|
||||
- import os
|
||||
|
||||
error[unused-import][*]: `math` imported but unused
|
||||
--> notebook.ipynb:cell 2:2:8
|
||||
|
|
@ -728,13 +720,11 @@ print()
|
|||
4 | print('hello world')
|
||||
|
|
||||
help: Remove unused import: `math`
|
||||
|
||||
ℹ Safe fix
|
||||
::: cell 2
|
||||
1 1 | # cell 2
|
||||
2 |-import math
|
||||
3 2 |
|
||||
4 3 | print('hello world')
|
||||
::: 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
|
||||
|
|
@ -745,14 +735,13 @@ print()
|
|||
| ^
|
||||
|
|
||||
help: Remove assignment to unused variable `x`
|
||||
|
||||
ℹ Unsafe fix
|
||||
::: cell 3
|
||||
1 1 | # cell 3
|
||||
2 2 | def foo():
|
||||
3 3 | print()
|
||||
4 |- x = 1
|
||||
5 4 |
|
||||
::: cell 3
|
||||
1 | # cell 3
|
||||
2 | def foo():
|
||||
3 | print()
|
||||
- x = 1
|
||||
4 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
");
|
||||
}
|
||||
|
||||
|
|
@ -780,22 +769,21 @@ print()
|
|||
| ^^
|
||||
|
|
||||
help: Remove unused import: `os`
|
||||
|
||||
ℹ Unsafe fix
|
||||
::: cell 1
|
||||
1 1 | # cell 1
|
||||
2 |-import os
|
||||
::: cell 2
|
||||
1 1 | # cell 2
|
||||
2 |-import math
|
||||
3 2 |
|
||||
4 3 | print('hello world')
|
||||
::: cell 3
|
||||
1 1 | # cell 3
|
||||
2 2 | def foo():
|
||||
3 3 | print()
|
||||
4 |- x = 1
|
||||
5 4 |
|
||||
::: 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
|
||||
");
|
||||
}
|
||||
|
||||
|
|
@ -901,4 +889,73 @@ 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);
|
||||
|
||||
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
|
||||
");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,12 +40,13 @@ pub struct DiagnosticStylesheet {
|
|||
pub(crate) help: Style,
|
||||
pub(crate) line_no: Style,
|
||||
pub(crate) emphasis: Style,
|
||||
pub(crate) underline: Style,
|
||||
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,12 +67,13 @@ impl DiagnosticStylesheet {
|
|||
help: AnsiColor::BrightCyan.on_default().effects(Effects::BOLD),
|
||||
line_no: bright_blue.effects(Effects::BOLD),
|
||||
emphasis: Style::new().effects(Effects::BOLD),
|
||||
underline: Style::new().effects(Effects::UNDERLINE),
|
||||
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),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,12 +86,13 @@ impl DiagnosticStylesheet {
|
|||
help: Style::new(),
|
||||
line_no: Style::new(),
|
||||
emphasis: Style::new(),
|
||||
underline: Style::new(),
|
||||
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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -10,11 +10,10 @@ AIR302 [*] `airflow.hooks.presto_hook.PrestoHook` is moved into `presto` provide
|
|||
| ^^^^^^^^^^
|
||||
|
|
||||
help: Install `apache-airflow-providers-presto>=1.0.0` and use `PrestoHook` from `airflow.providers.presto.hooks.presto` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.hooks.presto_hook import PrestoHook
|
||||
3 |+from airflow.providers.presto.hooks.presto import PrestoHook
|
||||
4 4 |
|
||||
5 5 | PrestoHook()
|
||||
1 | from __future__ import annotations
|
||||
2 |
|
||||
- from airflow.hooks.presto_hook import PrestoHook
|
||||
3 + from airflow.providers.presto.hooks.presto import PrestoHook
|
||||
4 |
|
||||
5 | PrestoHook()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,11 +10,10 @@ AIR302 [*] `airflow.hooks.samba_hook.SambaHook` is moved into `samba` provider i
|
|||
| ^^^^^^^^^
|
||||
|
|
||||
help: Install `apache-airflow-providers-samba>=1.0.0` and use `SambaHook` from `airflow.providers.samba.hooks.samba` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.hooks.samba_hook import SambaHook
|
||||
3 |+from airflow.providers.samba.hooks.samba import SambaHook
|
||||
4 4 |
|
||||
5 5 | SambaHook()
|
||||
1 | from __future__ import annotations
|
||||
2 |
|
||||
- from airflow.hooks.samba_hook import SambaHook
|
||||
3 + from airflow.providers.samba.hooks.samba import SambaHook
|
||||
4 |
|
||||
5 | SambaHook()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,16 +12,15 @@ AIR302 [*] `airflow.hooks.slack_hook.SlackHook` is moved into `slack` provider i
|
|||
8 | SlackAPIPostOperator()
|
||||
|
|
||||
help: Install `apache-airflow-providers-slack>=1.0.0` and use `SlackHook` from `airflow.providers.slack.hooks.slack` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.hooks.slack_hook import SlackHook
|
||||
4 3 | from airflow.operators.slack_operator import SlackAPIOperator, SlackAPIPostOperator
|
||||
4 |+from airflow.providers.slack.hooks.slack import SlackHook
|
||||
5 5 |
|
||||
6 6 | SlackHook()
|
||||
7 7 | SlackAPIOperator()
|
||||
1 | from __future__ import annotations
|
||||
2 |
|
||||
- from airflow.hooks.slack_hook import SlackHook
|
||||
3 | from airflow.operators.slack_operator import SlackAPIOperator, SlackAPIPostOperator
|
||||
4 + from airflow.providers.slack.hooks.slack import SlackHook
|
||||
5 |
|
||||
6 | SlackHook()
|
||||
7 | SlackAPIOperator()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.slack_operator.SlackAPIOperator` is moved into `slack` provider in Airflow 3.0;
|
||||
--> AIR302_slack.py:7:1
|
||||
|
|
@ -32,17 +31,16 @@ AIR302 [*] `airflow.operators.slack_operator.SlackAPIOperator` is moved into `sl
|
|||
8 | SlackAPIPostOperator()
|
||||
|
|
||||
help: Install `apache-airflow-providers-slack>=1.0.0` and use `SlackAPIOperator` from `airflow.providers.slack.operators.slack` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.slack_hook import SlackHook
|
||||
4 |-from airflow.operators.slack_operator import SlackAPIOperator, SlackAPIPostOperator
|
||||
4 |+from airflow.operators.slack_operator import SlackAPIPostOperator
|
||||
5 |+from airflow.providers.slack.operators.slack import SlackAPIOperator
|
||||
5 6 |
|
||||
6 7 | SlackHook()
|
||||
7 8 | SlackAPIOperator()
|
||||
1 | from __future__ import annotations
|
||||
2 |
|
||||
3 | from airflow.hooks.slack_hook import SlackHook
|
||||
- from airflow.operators.slack_operator import SlackAPIOperator, SlackAPIPostOperator
|
||||
4 + from airflow.operators.slack_operator import SlackAPIPostOperator
|
||||
5 + from airflow.providers.slack.operators.slack import SlackAPIOperator
|
||||
6 |
|
||||
7 | SlackHook()
|
||||
8 | SlackAPIOperator()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.slack_operator.SlackAPIPostOperator` is moved into `slack` provider in Airflow 3.0;
|
||||
--> AIR302_slack.py:8:1
|
||||
|
|
@ -53,14 +51,13 @@ AIR302 [*] `airflow.operators.slack_operator.SlackAPIPostOperator` is moved into
|
|||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Install `apache-airflow-providers-slack>=1.0.0` and use `SlackAPIPostOperator` from `airflow.providers.slack.operators.slack` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.slack_hook import SlackHook
|
||||
4 |-from airflow.operators.slack_operator import SlackAPIOperator, SlackAPIPostOperator
|
||||
4 |+from airflow.operators.slack_operator import SlackAPIOperator
|
||||
5 |+from airflow.providers.slack.operators.slack import SlackAPIPostOperator
|
||||
5 6 |
|
||||
6 7 | SlackHook()
|
||||
7 8 | SlackAPIOperator()
|
||||
1 | from __future__ import annotations
|
||||
2 |
|
||||
3 | from airflow.hooks.slack_hook import SlackHook
|
||||
- from airflow.operators.slack_operator import SlackAPIOperator, SlackAPIPostOperator
|
||||
4 + from airflow.operators.slack_operator import SlackAPIOperator
|
||||
5 + from airflow.providers.slack.operators.slack import SlackAPIPostOperator
|
||||
6 |
|
||||
7 | SlackHook()
|
||||
8 | SlackAPIOperator()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,15 +12,14 @@ AIR302 [*] `airflow.operators.email_operator.EmailOperator` is moved into `smtp`
|
|||
7 | from airflow.operators.email import EmailOperator
|
||||
|
|
||||
help: Install `apache-airflow-providers-smtp>=1.0.0` and use `EmailOperator` from `airflow.providers.smtp.operators.smtp` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.operators.email_operator import EmailOperator
|
||||
3 |+from airflow.providers.smtp.operators.smtp import EmailOperator
|
||||
4 4 |
|
||||
5 5 | EmailOperator()
|
||||
6 6 |
|
||||
1 | from __future__ import annotations
|
||||
2 |
|
||||
- from airflow.operators.email_operator import EmailOperator
|
||||
3 + from airflow.providers.smtp.operators.smtp import EmailOperator
|
||||
4 |
|
||||
5 | EmailOperator()
|
||||
6 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.email.EmailOperator` is moved into `smtp` provider in Airflow 3.0;
|
||||
--> AIR302_smtp.py:9:1
|
||||
|
|
@ -31,12 +30,11 @@ AIR302 [*] `airflow.operators.email.EmailOperator` is moved into `smtp` provider
|
|||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
help: Install `apache-airflow-providers-smtp>=1.0.0` and use `EmailOperator` from `airflow.providers.smtp.operators.smtp` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 |
|
||||
5 5 | EmailOperator()
|
||||
6 6 |
|
||||
7 |-from airflow.operators.email import EmailOperator
|
||||
7 |+from airflow.providers.smtp.operators.smtp import EmailOperator
|
||||
8 8 |
|
||||
9 9 | EmailOperator()
|
||||
4 |
|
||||
5 | EmailOperator()
|
||||
6 |
|
||||
- from airflow.operators.email import EmailOperator
|
||||
7 + from airflow.providers.smtp.operators.smtp import EmailOperator
|
||||
8 |
|
||||
9 | EmailOperator()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,11 +10,10 @@ AIR302 [*] `airflow.hooks.sqlite_hook.SqliteHook` is moved into `sqlite` provide
|
|||
| ^^^^^^^^^^
|
||||
|
|
||||
help: Install `apache-airflow-providers-sqlite>=1.0.0` and use `SqliteHook` from `airflow.providers.sqlite.hooks.sqlite` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.hooks.sqlite_hook import SqliteHook
|
||||
3 |+from airflow.providers.sqlite.hooks.sqlite import SqliteHook
|
||||
4 4 |
|
||||
5 5 | SqliteHook()
|
||||
1 | from __future__ import annotations
|
||||
2 |
|
||||
- from airflow.hooks.sqlite_hook import SqliteHook
|
||||
3 + from airflow.providers.sqlite.hooks.sqlite import SqliteHook
|
||||
4 |
|
||||
5 | SqliteHook()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,22 +12,21 @@ AIR302 [*] `airflow.operators.bash_operator.BashOperator` is moved into `standar
|
|||
22 | TriggerDagRunLink()
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.1` and use `BashOperator` from `airflow.providers.standard.operators.bash` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.operators.bash_operator import BashOperator
|
||||
4 3 | from airflow.operators.dagrun_operator import (
|
||||
5 4 | TriggerDagRunLink,
|
||||
6 5 | TriggerDagRunOperator,
|
||||
1 | from __future__ import annotations
|
||||
2 |
|
||||
- from airflow.operators.bash_operator import BashOperator
|
||||
3 | from airflow.operators.dagrun_operator import (
|
||||
4 | TriggerDagRunLink,
|
||||
5 | TriggerDagRunOperator,
|
||||
--------------------------------------------------------------------------------
|
||||
16 15 | ExternalTaskMarker,
|
||||
17 16 | ExternalTaskSensor,
|
||||
18 17 | )
|
||||
18 |+from airflow.providers.standard.operators.bash import BashOperator
|
||||
19 19 |
|
||||
20 20 | BashOperator()
|
||||
21 21 |
|
||||
15 | ExternalTaskMarker,
|
||||
16 | ExternalTaskSensor,
|
||||
17 | )
|
||||
18 + from airflow.providers.standard.operators.bash import BashOperator
|
||||
19 |
|
||||
20 | BashOperator()
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.dagrun_operator.TriggerDagRunLink` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:22:1
|
||||
|
|
@ -39,23 +38,22 @@ AIR302 [*] `airflow.operators.dagrun_operator.TriggerDagRunLink` is moved into `
|
|||
23 | TriggerDagRunOperator()
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.2` and use `TriggerDagRunLink` from `airflow.providers.standard.operators.trigger_dagrun` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 | from airflow.operators.bash_operator import BashOperator
|
||||
4 4 | from airflow.operators.dagrun_operator import (
|
||||
5 |- TriggerDagRunLink,
|
||||
6 5 | TriggerDagRunOperator,
|
||||
7 6 | )
|
||||
8 7 | from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
2 |
|
||||
3 | from airflow.operators.bash_operator import BashOperator
|
||||
4 | from airflow.operators.dagrun_operator import (
|
||||
- TriggerDagRunLink,
|
||||
5 | TriggerDagRunOperator,
|
||||
6 | )
|
||||
7 | from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
--------------------------------------------------------------------------------
|
||||
16 15 | ExternalTaskMarker,
|
||||
17 16 | ExternalTaskSensor,
|
||||
18 17 | )
|
||||
18 |+from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunLink
|
||||
19 19 |
|
||||
20 20 | BashOperator()
|
||||
21 21 |
|
||||
15 | ExternalTaskMarker,
|
||||
16 | ExternalTaskSensor,
|
||||
17 | )
|
||||
18 + from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunLink
|
||||
19 |
|
||||
20 | BashOperator()
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.dagrun_operator.TriggerDagRunOperator` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:23:1
|
||||
|
|
@ -67,23 +65,22 @@ AIR302 [*] `airflow.operators.dagrun_operator.TriggerDagRunOperator` is moved in
|
|||
25 | LatestOnlyOperator()
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.2` and use `TriggerDagRunOperator` from `airflow.providers.standard.operators.trigger_dagrun` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | from airflow.operators.bash_operator import BashOperator
|
||||
4 4 | from airflow.operators.dagrun_operator import (
|
||||
5 5 | TriggerDagRunLink,
|
||||
6 |- TriggerDagRunOperator,
|
||||
7 6 | )
|
||||
8 7 | from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
9 8 | from airflow.operators.python_operator import (
|
||||
3 | from airflow.operators.bash_operator import BashOperator
|
||||
4 | from airflow.operators.dagrun_operator import (
|
||||
5 | TriggerDagRunLink,
|
||||
- TriggerDagRunOperator,
|
||||
6 | )
|
||||
7 | from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
8 | from airflow.operators.python_operator import (
|
||||
--------------------------------------------------------------------------------
|
||||
16 15 | ExternalTaskMarker,
|
||||
17 16 | ExternalTaskSensor,
|
||||
18 17 | )
|
||||
18 |+from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunOperator
|
||||
19 19 |
|
||||
20 20 | BashOperator()
|
||||
21 21 |
|
||||
15 | ExternalTaskMarker,
|
||||
16 | ExternalTaskSensor,
|
||||
17 | )
|
||||
18 + from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunOperator
|
||||
19 |
|
||||
20 | BashOperator()
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.latest_only_operator.LatestOnlyOperator` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:25:1
|
||||
|
|
@ -96,23 +93,22 @@ AIR302 [*] `airflow.operators.latest_only_operator.LatestOnlyOperator` is moved
|
|||
27 | BranchPythonOperator()
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.3` and use `LatestOnlyOperator` from `airflow.providers.standard.operators.latest_only` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | TriggerDagRunLink,
|
||||
6 6 | TriggerDagRunOperator,
|
||||
7 7 | )
|
||||
8 |-from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
9 8 | from airflow.operators.python_operator import (
|
||||
10 9 | BranchPythonOperator,
|
||||
11 10 | PythonOperator,
|
||||
5 | TriggerDagRunLink,
|
||||
6 | TriggerDagRunOperator,
|
||||
7 | )
|
||||
- from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
8 | from airflow.operators.python_operator import (
|
||||
9 | BranchPythonOperator,
|
||||
10 | PythonOperator,
|
||||
--------------------------------------------------------------------------------
|
||||
16 15 | ExternalTaskMarker,
|
||||
17 16 | ExternalTaskSensor,
|
||||
18 17 | )
|
||||
18 |+from airflow.providers.standard.operators.latest_only import LatestOnlyOperator
|
||||
19 19 |
|
||||
20 20 | BashOperator()
|
||||
21 21 |
|
||||
15 | ExternalTaskMarker,
|
||||
16 | ExternalTaskSensor,
|
||||
17 | )
|
||||
18 + from airflow.providers.standard.operators.latest_only import LatestOnlyOperator
|
||||
19 |
|
||||
20 | BashOperator()
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.python_operator.BranchPythonOperator` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:27:1
|
||||
|
|
@ -125,23 +121,22 @@ AIR302 [*] `airflow.operators.python_operator.BranchPythonOperator` is moved int
|
|||
29 | PythonVirtualenvOperator()
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.1` and use `BranchPythonOperator` from `airflow.providers.standard.operators.python` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | )
|
||||
8 8 | from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
9 9 | from airflow.operators.python_operator import (
|
||||
10 |- BranchPythonOperator,
|
||||
11 10 | PythonOperator,
|
||||
12 11 | PythonVirtualenvOperator,
|
||||
13 12 | ShortCircuitOperator,
|
||||
7 | )
|
||||
8 | from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
9 | from airflow.operators.python_operator import (
|
||||
- BranchPythonOperator,
|
||||
10 | PythonOperator,
|
||||
11 | PythonVirtualenvOperator,
|
||||
12 | ShortCircuitOperator,
|
||||
--------------------------------------------------------------------------------
|
||||
16 15 | ExternalTaskMarker,
|
||||
17 16 | ExternalTaskSensor,
|
||||
18 17 | )
|
||||
18 |+from airflow.providers.standard.operators.python import BranchPythonOperator
|
||||
19 19 |
|
||||
20 20 | BashOperator()
|
||||
21 21 |
|
||||
15 | ExternalTaskMarker,
|
||||
16 | ExternalTaskSensor,
|
||||
17 | )
|
||||
18 + from airflow.providers.standard.operators.python import BranchPythonOperator
|
||||
19 |
|
||||
20 | BashOperator()
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.python_operator.PythonOperator` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:28:1
|
||||
|
|
@ -153,23 +148,22 @@ AIR302 [*] `airflow.operators.python_operator.PythonOperator` is moved into `sta
|
|||
30 | ShortCircuitOperator()
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.1` and use `PythonOperator` from `airflow.providers.standard.operators.python` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
9 9 | from airflow.operators.python_operator import (
|
||||
10 10 | BranchPythonOperator,
|
||||
11 |- PythonOperator,
|
||||
12 11 | PythonVirtualenvOperator,
|
||||
13 12 | ShortCircuitOperator,
|
||||
14 13 | )
|
||||
8 | from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
9 | from airflow.operators.python_operator import (
|
||||
10 | BranchPythonOperator,
|
||||
- PythonOperator,
|
||||
11 | PythonVirtualenvOperator,
|
||||
12 | ShortCircuitOperator,
|
||||
13 | )
|
||||
--------------------------------------------------------------------------------
|
||||
16 15 | ExternalTaskMarker,
|
||||
17 16 | ExternalTaskSensor,
|
||||
18 17 | )
|
||||
18 |+from airflow.providers.standard.operators.python import PythonOperator
|
||||
19 19 |
|
||||
20 20 | BashOperator()
|
||||
21 21 |
|
||||
15 | ExternalTaskMarker,
|
||||
16 | ExternalTaskSensor,
|
||||
17 | )
|
||||
18 + from airflow.providers.standard.operators.python import PythonOperator
|
||||
19 |
|
||||
20 | BashOperator()
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.python_operator.PythonVirtualenvOperator` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:29:1
|
||||
|
|
@ -181,22 +175,21 @@ AIR302 [*] `airflow.operators.python_operator.PythonVirtualenvOperator` is moved
|
|||
30 | ShortCircuitOperator()
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.1` and use `PythonVirtualenvOperator` from `airflow.providers.standard.operators.python` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | from airflow.operators.python_operator import (
|
||||
10 10 | BranchPythonOperator,
|
||||
11 11 | PythonOperator,
|
||||
12 |- PythonVirtualenvOperator,
|
||||
13 12 | ShortCircuitOperator,
|
||||
14 13 | )
|
||||
15 14 | from airflow.sensors.external_task_sensor import (
|
||||
16 15 | ExternalTaskMarker,
|
||||
17 16 | ExternalTaskSensor,
|
||||
18 17 | )
|
||||
18 |+from airflow.providers.standard.operators.python import PythonVirtualenvOperator
|
||||
19 19 |
|
||||
20 20 | BashOperator()
|
||||
21 21 |
|
||||
9 | from airflow.operators.python_operator import (
|
||||
10 | BranchPythonOperator,
|
||||
11 | PythonOperator,
|
||||
- PythonVirtualenvOperator,
|
||||
12 | ShortCircuitOperator,
|
||||
13 | )
|
||||
14 | from airflow.sensors.external_task_sensor import (
|
||||
15 | ExternalTaskMarker,
|
||||
16 | ExternalTaskSensor,
|
||||
17 | )
|
||||
18 + from airflow.providers.standard.operators.python import PythonVirtualenvOperator
|
||||
19 |
|
||||
20 | BashOperator()
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.python_operator.ShortCircuitOperator` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:30:1
|
||||
|
|
@ -209,21 +202,20 @@ AIR302 [*] `airflow.operators.python_operator.ShortCircuitOperator` is moved int
|
|||
32 | ExternalTaskMarker()
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.1` and use `ShortCircuitOperator` from `airflow.providers.standard.operators.python` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
10 10 | BranchPythonOperator,
|
||||
11 11 | PythonOperator,
|
||||
12 12 | PythonVirtualenvOperator,
|
||||
13 |- ShortCircuitOperator,
|
||||
14 13 | )
|
||||
15 14 | from airflow.sensors.external_task_sensor import (
|
||||
16 15 | ExternalTaskMarker,
|
||||
17 16 | ExternalTaskSensor,
|
||||
18 17 | )
|
||||
18 |+from airflow.providers.standard.operators.python import ShortCircuitOperator
|
||||
19 19 |
|
||||
20 20 | BashOperator()
|
||||
21 21 |
|
||||
10 | BranchPythonOperator,
|
||||
11 | PythonOperator,
|
||||
12 | PythonVirtualenvOperator,
|
||||
- ShortCircuitOperator,
|
||||
13 | )
|
||||
14 | from airflow.sensors.external_task_sensor import (
|
||||
15 | ExternalTaskMarker,
|
||||
16 | ExternalTaskSensor,
|
||||
17 | )
|
||||
18 + from airflow.providers.standard.operators.python import ShortCircuitOperator
|
||||
19 |
|
||||
20 | BashOperator()
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.sensors.external_task_sensor.ExternalTaskMarker` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:32:1
|
||||
|
|
@ -235,18 +227,17 @@ AIR302 [*] `airflow.sensors.external_task_sensor.ExternalTaskMarker` is moved in
|
|||
33 | ExternalTaskSensor()
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.3` and use `ExternalTaskMarker` from `airflow.providers.standard.sensors.external_task` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 | ShortCircuitOperator,
|
||||
14 14 | )
|
||||
15 15 | from airflow.sensors.external_task_sensor import (
|
||||
16 |- ExternalTaskMarker,
|
||||
17 16 | ExternalTaskSensor,
|
||||
18 17 | )
|
||||
18 |+from airflow.providers.standard.sensors.external_task import ExternalTaskMarker
|
||||
19 19 |
|
||||
20 20 | BashOperator()
|
||||
21 21 |
|
||||
13 | ShortCircuitOperator,
|
||||
14 | )
|
||||
15 | from airflow.sensors.external_task_sensor import (
|
||||
- ExternalTaskMarker,
|
||||
16 | ExternalTaskSensor,
|
||||
17 | )
|
||||
18 + from airflow.providers.standard.sensors.external_task import ExternalTaskMarker
|
||||
19 |
|
||||
20 | BashOperator()
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.sensors.external_task_sensor.ExternalTaskSensor` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:33:1
|
||||
|
|
@ -256,17 +247,16 @@ AIR302 [*] `airflow.sensors.external_task_sensor.ExternalTaskSensor` is moved in
|
|||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.3` and use `ExternalTaskSensor` from `airflow.providers.standard.sensors.external_task` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 | )
|
||||
15 15 | from airflow.sensors.external_task_sensor import (
|
||||
16 16 | ExternalTaskMarker,
|
||||
17 |- ExternalTaskSensor,
|
||||
18 17 | )
|
||||
18 |+from airflow.providers.standard.sensors.external_task import ExternalTaskSensor
|
||||
19 19 |
|
||||
20 20 | BashOperator()
|
||||
21 21 |
|
||||
14 | )
|
||||
15 | from airflow.sensors.external_task_sensor import (
|
||||
16 | ExternalTaskMarker,
|
||||
- ExternalTaskSensor,
|
||||
17 | )
|
||||
18 + from airflow.providers.standard.sensors.external_task import ExternalTaskSensor
|
||||
19 |
|
||||
20 | BashOperator()
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.hooks.subprocess.SubprocessResult` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:38:1
|
||||
|
|
@ -279,16 +269,15 @@ AIR302 [*] `airflow.hooks.subprocess.SubprocessResult` is moved into `standard`
|
|||
40 | from airflow.hooks.subprocess import working_directory
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.3` and use `SubprocessResult` from `airflow.providers.standard.hooks.subprocess` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
33 33 | ExternalTaskSensor()
|
||||
34 34 |
|
||||
35 35 |
|
||||
36 |-from airflow.hooks.subprocess import SubprocessResult
|
||||
36 |+from airflow.providers.standard.hooks.subprocess import SubprocessResult
|
||||
37 37 |
|
||||
38 38 | SubprocessResult()
|
||||
39 39 |
|
||||
33 | ExternalTaskSensor()
|
||||
34 |
|
||||
35 |
|
||||
- from airflow.hooks.subprocess import SubprocessResult
|
||||
36 + from airflow.providers.standard.hooks.subprocess import SubprocessResult
|
||||
37 |
|
||||
38 | SubprocessResult()
|
||||
39 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.hooks.subprocess.working_directory` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:42:1
|
||||
|
|
@ -301,16 +290,15 @@ AIR302 [*] `airflow.hooks.subprocess.working_directory` is moved into `standard`
|
|||
44 | from airflow.operators.datetime import target_times_as_dates
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.3` and use `working_directory` from `airflow.providers.standard.hooks.subprocess` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
37 37 |
|
||||
38 38 | SubprocessResult()
|
||||
39 39 |
|
||||
40 |-from airflow.hooks.subprocess import working_directory
|
||||
40 |+from airflow.providers.standard.hooks.subprocess import working_directory
|
||||
41 41 |
|
||||
42 42 | working_directory()
|
||||
43 43 |
|
||||
37 |
|
||||
38 | SubprocessResult()
|
||||
39 |
|
||||
- from airflow.hooks.subprocess import working_directory
|
||||
40 + from airflow.providers.standard.hooks.subprocess import working_directory
|
||||
41 |
|
||||
42 | working_directory()
|
||||
43 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.datetime.target_times_as_dates` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:46:1
|
||||
|
|
@ -323,16 +311,15 @@ AIR302 [*] `airflow.operators.datetime.target_times_as_dates` is moved into `sta
|
|||
48 | from airflow.operators.trigger_dagrun import TriggerDagRunLink
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.1` and use `target_times_as_dates` from `airflow.providers.standard.operators.datetime` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
41 41 |
|
||||
42 42 | working_directory()
|
||||
43 43 |
|
||||
44 |-from airflow.operators.datetime import target_times_as_dates
|
||||
44 |+from airflow.providers.standard.operators.datetime import target_times_as_dates
|
||||
45 45 |
|
||||
46 46 | target_times_as_dates()
|
||||
47 47 |
|
||||
41 |
|
||||
42 | working_directory()
|
||||
43 |
|
||||
- from airflow.operators.datetime import target_times_as_dates
|
||||
44 + from airflow.providers.standard.operators.datetime import target_times_as_dates
|
||||
45 |
|
||||
46 | target_times_as_dates()
|
||||
47 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.trigger_dagrun.TriggerDagRunLink` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:50:1
|
||||
|
|
@ -345,16 +332,15 @@ AIR302 [*] `airflow.operators.trigger_dagrun.TriggerDagRunLink` is moved into `s
|
|||
52 | from airflow.sensors.external_task import ExternalTaskSensorLink
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.2` and use `TriggerDagRunLink` from `airflow.providers.standard.operators.trigger_dagrun` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
45 45 |
|
||||
46 46 | target_times_as_dates()
|
||||
47 47 |
|
||||
48 |-from airflow.operators.trigger_dagrun import TriggerDagRunLink
|
||||
48 |+from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunLink
|
||||
49 49 |
|
||||
50 50 | TriggerDagRunLink()
|
||||
51 51 |
|
||||
45 |
|
||||
46 | target_times_as_dates()
|
||||
47 |
|
||||
- from airflow.operators.trigger_dagrun import TriggerDagRunLink
|
||||
48 + from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunLink
|
||||
49 |
|
||||
50 | TriggerDagRunLink()
|
||||
51 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.sensors.external_task.ExternalTaskSensorLink` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:54:1
|
||||
|
|
@ -367,18 +353,16 @@ AIR302 [*] `airflow.sensors.external_task.ExternalTaskSensorLink` is moved into
|
|||
56 | from airflow.sensors.time_delta import WaitSensor
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.3` and use `ExternalDagLink` from `airflow.providers.standard.sensors.external_task` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
50 50 | TriggerDagRunLink()
|
||||
51 51 |
|
||||
52 52 | from airflow.sensors.external_task import ExternalTaskSensorLink
|
||||
53 |+from airflow.providers.standard.sensors.external_task import ExternalDagLink
|
||||
53 54 |
|
||||
54 |-ExternalTaskSensorLink()
|
||||
55 |+ExternalDagLink()
|
||||
55 56 |
|
||||
56 57 | from airflow.sensors.time_delta import WaitSensor
|
||||
57 58 |
|
||||
50 | TriggerDagRunLink()
|
||||
51 |
|
||||
52 | from airflow.sensors.external_task import ExternalTaskSensorLink
|
||||
53 + from airflow.providers.standard.sensors.external_task import ExternalDagLink
|
||||
54 |
|
||||
- ExternalTaskSensorLink()
|
||||
55 + ExternalDagLink()
|
||||
56 |
|
||||
57 | from airflow.sensors.time_delta import WaitSensor
|
||||
58 |
|
||||
|
||||
AIR302 [*] `airflow.sensors.time_delta.WaitSensor` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:58:1
|
||||
|
|
@ -391,16 +375,15 @@ AIR302 [*] `airflow.sensors.time_delta.WaitSensor` is moved into `standard` prov
|
|||
60 | from airflow.operators.dummy import DummyOperator
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.1` and use `WaitSensor` from `airflow.providers.standard.sensors.time_delta` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
53 53 |
|
||||
54 54 | ExternalTaskSensorLink()
|
||||
55 55 |
|
||||
56 |-from airflow.sensors.time_delta import WaitSensor
|
||||
56 |+from airflow.providers.standard.sensors.time_delta import WaitSensor
|
||||
57 57 |
|
||||
58 58 | WaitSensor()
|
||||
59 59 |
|
||||
53 |
|
||||
54 | ExternalTaskSensorLink()
|
||||
55 |
|
||||
- from airflow.sensors.time_delta import WaitSensor
|
||||
56 + from airflow.providers.standard.sensors.time_delta import WaitSensor
|
||||
57 |
|
||||
58 | WaitSensor()
|
||||
59 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.dummy.DummyOperator` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:62:1
|
||||
|
|
@ -413,18 +396,16 @@ AIR302 [*] `airflow.operators.dummy.DummyOperator` is moved into `standard` prov
|
|||
64 | from airflow.operators.dummy import EmptyOperator
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.2` and use `EmptyOperator` from `airflow.providers.standard.operators.empty` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
58 58 | WaitSensor()
|
||||
59 59 |
|
||||
60 60 | from airflow.operators.dummy import DummyOperator
|
||||
61 |+from airflow.providers.standard.operators.empty import EmptyOperator
|
||||
61 62 |
|
||||
62 |-DummyOperator()
|
||||
63 |+EmptyOperator()
|
||||
63 64 |
|
||||
64 65 | from airflow.operators.dummy import EmptyOperator
|
||||
65 66 |
|
||||
58 | WaitSensor()
|
||||
59 |
|
||||
60 | from airflow.operators.dummy import DummyOperator
|
||||
61 + from airflow.providers.standard.operators.empty import EmptyOperator
|
||||
62 |
|
||||
- DummyOperator()
|
||||
63 + EmptyOperator()
|
||||
64 |
|
||||
65 | from airflow.operators.dummy import EmptyOperator
|
||||
66 |
|
||||
|
||||
AIR302 [*] `airflow.operators.dummy.EmptyOperator` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:66:1
|
||||
|
|
@ -437,16 +418,15 @@ AIR302 [*] `airflow.operators.dummy.EmptyOperator` is moved into `standard` prov
|
|||
68 | from airflow.operators.dummy_operator import DummyOperator
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.2` and use `EmptyOperator` from `airflow.providers.standard.operators.empty` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
61 61 |
|
||||
62 62 | DummyOperator()
|
||||
63 63 |
|
||||
64 |-from airflow.operators.dummy import EmptyOperator
|
||||
64 |+from airflow.providers.standard.operators.empty import EmptyOperator
|
||||
65 65 |
|
||||
66 66 | EmptyOperator()
|
||||
67 67 |
|
||||
61 |
|
||||
62 | DummyOperator()
|
||||
63 |
|
||||
- from airflow.operators.dummy import EmptyOperator
|
||||
64 + from airflow.providers.standard.operators.empty import EmptyOperator
|
||||
65 |
|
||||
66 | EmptyOperator()
|
||||
67 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.dummy_operator.DummyOperator` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:70:1
|
||||
|
|
@ -459,15 +439,14 @@ AIR302 [*] `airflow.operators.dummy_operator.DummyOperator` is moved into `stand
|
|||
72 | from airflow.operators.dummy_operator import EmptyOperator
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.2` and use `EmptyOperator` from `airflow.providers.standard.operators.empty` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
66 66 | EmptyOperator()
|
||||
67 67 |
|
||||
68 68 | from airflow.operators.dummy_operator import DummyOperator
|
||||
69 |+from airflow.providers.standard.operators.empty import EmptyOperator
|
||||
69 70 |
|
||||
70 71 | DummyOperator()
|
||||
71 72 |
|
||||
66 | EmptyOperator()
|
||||
67 |
|
||||
68 | from airflow.operators.dummy_operator import DummyOperator
|
||||
69 + from airflow.providers.standard.operators.empty import EmptyOperator
|
||||
70 |
|
||||
71 | DummyOperator()
|
||||
72 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.operators.dummy_operator.EmptyOperator` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:74:1
|
||||
|
|
@ -480,16 +459,15 @@ AIR302 [*] `airflow.operators.dummy_operator.EmptyOperator` is moved into `stand
|
|||
76 | from airflow.sensors.external_task_sensor import ExternalTaskSensorLink
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.2` and use `EmptyOperator` from `airflow.providers.standard.operators.empty` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
69 69 |
|
||||
70 70 | DummyOperator()
|
||||
71 71 |
|
||||
72 |-from airflow.operators.dummy_operator import EmptyOperator
|
||||
72 |+from airflow.providers.standard.operators.empty import EmptyOperator
|
||||
73 73 |
|
||||
74 74 | EmptyOperator()
|
||||
75 75 |
|
||||
69 |
|
||||
70 | DummyOperator()
|
||||
71 |
|
||||
- from airflow.operators.dummy_operator import EmptyOperator
|
||||
72 + from airflow.providers.standard.operators.empty import EmptyOperator
|
||||
73 |
|
||||
74 | EmptyOperator()
|
||||
75 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
AIR302 [*] `airflow.sensors.external_task_sensor.ExternalTaskSensorLink` is moved into `standard` provider in Airflow 3.0;
|
||||
--> AIR302_standard.py:78:1
|
||||
|
|
@ -500,12 +478,10 @@ AIR302 [*] `airflow.sensors.external_task_sensor.ExternalTaskSensorLink` is move
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Install `apache-airflow-providers-standard>=0.0.3` and use `ExternalDagLink` from `airflow.providers.standard.sensors.external_task` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
74 74 | EmptyOperator()
|
||||
75 75 |
|
||||
76 76 | from airflow.sensors.external_task_sensor import ExternalTaskSensorLink
|
||||
77 |+from airflow.providers.standard.sensors.external_task import ExternalDagLink
|
||||
77 78 |
|
||||
78 |-ExternalTaskSensorLink()
|
||||
79 |+ExternalDagLink()
|
||||
74 | EmptyOperator()
|
||||
75 |
|
||||
76 | from airflow.sensors.external_task_sensor import ExternalTaskSensorLink
|
||||
77 + from airflow.providers.standard.sensors.external_task import ExternalDagLink
|
||||
78 |
|
||||
- ExternalTaskSensorLink()
|
||||
79 + ExternalDagLink()
|
||||
|
|
|
|||
|
|
@ -10,11 +10,10 @@ AIR302 [*] `airflow.hooks.zendesk_hook.ZendeskHook` is moved into `zendesk` prov
|
|||
| ^^^^^^^^^^^
|
||||
|
|
||||
help: Install `apache-airflow-providers-zendesk>=1.0.0` and use `ZendeskHook` from `airflow.providers.zendesk.hooks.zendesk` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.hooks.zendesk_hook import ZendeskHook
|
||||
3 |+from airflow.providers.zendesk.hooks.zendesk import ZendeskHook
|
||||
4 4 |
|
||||
5 5 | ZendeskHook()
|
||||
1 | from __future__ import annotations
|
||||
2 |
|
||||
- from airflow.hooks.zendesk_hook import ZendeskHook
|
||||
3 + from airflow.providers.zendesk.hooks.zendesk import ZendeskHook
|
||||
4 |
|
||||
5 | ZendeskHook()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -10,12 +10,11 @@ ERA001 Found commented-out code
|
|||
3 | #a = 3
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
1 |-#import os
|
||||
2 1 | # from foo import junk
|
||||
3 2 | #a = 3
|
||||
4 3 | a = 4
|
||||
- #import os
|
||||
1 | # from foo import junk
|
||||
2 | #a = 3
|
||||
3 | a = 4
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:2:1
|
||||
|
|
@ -27,13 +26,12 @@ ERA001 Found commented-out code
|
|||
4 | a = 4
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
1 1 | #import os
|
||||
2 |-# from foo import junk
|
||||
3 2 | #a = 3
|
||||
4 3 | a = 4
|
||||
5 4 | #foo(1, 2, 3)
|
||||
1 | #import os
|
||||
- # from foo import junk
|
||||
2 | #a = 3
|
||||
3 | a = 4
|
||||
4 | #foo(1, 2, 3)
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:3:1
|
||||
|
|
@ -46,14 +44,13 @@ ERA001 Found commented-out code
|
|||
5 | #foo(1, 2, 3)
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
1 1 | #import os
|
||||
2 2 | # from foo import junk
|
||||
3 |-#a = 3
|
||||
4 3 | a = 4
|
||||
5 4 | #foo(1, 2, 3)
|
||||
6 5 |
|
||||
1 | #import os
|
||||
2 | # from foo import junk
|
||||
- #a = 3
|
||||
3 | a = 4
|
||||
4 | #foo(1, 2, 3)
|
||||
5 |
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:5:1
|
||||
|
|
@ -66,15 +63,14 @@ ERA001 Found commented-out code
|
|||
7 | def foo(x, y, z):
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
2 2 | # from foo import junk
|
||||
3 3 | #a = 3
|
||||
4 4 | a = 4
|
||||
5 |-#foo(1, 2, 3)
|
||||
6 5 |
|
||||
7 6 | def foo(x, y, z):
|
||||
8 7 | content = 1 # print('hello')
|
||||
2 | # from foo import junk
|
||||
3 | #a = 3
|
||||
4 | a = 4
|
||||
- #foo(1, 2, 3)
|
||||
5 |
|
||||
6 | def foo(x, y, z):
|
||||
7 | content = 1 # print('hello')
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:13:5
|
||||
|
|
@ -86,15 +82,14 @@ ERA001 Found commented-out code
|
|||
14 | return False
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
10 10 |
|
||||
11 11 | # This is a real comment.
|
||||
12 12 | # # This is a (nested) comment.
|
||||
13 |- #return True
|
||||
14 13 | return False
|
||||
15 14 |
|
||||
16 15 | #import os # noqa: ERA001
|
||||
10 |
|
||||
11 | # This is a real comment.
|
||||
12 | # # This is a (nested) comment.
|
||||
- #return True
|
||||
13 | return False
|
||||
14 |
|
||||
15 | #import os # noqa: ERA001
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:21:5
|
||||
|
|
@ -105,15 +100,14 @@ ERA001 Found commented-out code
|
|||
| ^^^^^^^
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
18 18 |
|
||||
19 19 | class A():
|
||||
20 20 | pass
|
||||
21 |- # b = c
|
||||
22 21 |
|
||||
23 22 |
|
||||
24 23 | dictionary = {
|
||||
18 |
|
||||
19 | class A():
|
||||
20 | pass
|
||||
- # b = c
|
||||
21 |
|
||||
22 |
|
||||
23 | dictionary = {
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:26:5
|
||||
|
|
@ -126,15 +120,14 @@ ERA001 Found commented-out code
|
|||
28 | }
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
23 23 |
|
||||
24 24 | dictionary = {
|
||||
25 25 | # "key1": 123, # noqa: ERA001
|
||||
26 |- # "key2": 456,
|
||||
27 26 | # "key3": 789, # test
|
||||
28 27 | }
|
||||
29 28 |
|
||||
23 |
|
||||
24 | dictionary = {
|
||||
25 | # "key1": 123, # noqa: ERA001
|
||||
- # "key2": 456,
|
||||
26 | # "key3": 789, # test
|
||||
27 | }
|
||||
28 |
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:27:5
|
||||
|
|
@ -146,15 +139,14 @@ ERA001 Found commented-out code
|
|||
28 | }
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
24 24 | dictionary = {
|
||||
25 25 | # "key1": 123, # noqa: ERA001
|
||||
26 26 | # "key2": 456,
|
||||
27 |- # "key3": 789, # test
|
||||
28 27 | }
|
||||
29 28 |
|
||||
30 29 | #import os # noqa
|
||||
24 | dictionary = {
|
||||
25 | # "key1": 123, # noqa: ERA001
|
||||
26 | # "key2": 456,
|
||||
- # "key3": 789, # test
|
||||
27 | }
|
||||
28 |
|
||||
29 | #import os # noqa
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:32:1
|
||||
|
|
@ -167,15 +159,14 @@ ERA001 Found commented-out code
|
|||
34 | # try: # with comment
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
29 29 |
|
||||
30 30 | #import os # noqa
|
||||
31 31 |
|
||||
32 |-# case 1:
|
||||
33 32 | # try:
|
||||
34 33 | # try: # with comment
|
||||
35 34 | # try: print()
|
||||
29 |
|
||||
30 | #import os # noqa
|
||||
31 |
|
||||
- # case 1:
|
||||
32 | # try:
|
||||
33 | # try: # with comment
|
||||
34 | # try: print()
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:33:1
|
||||
|
|
@ -187,15 +178,14 @@ ERA001 Found commented-out code
|
|||
35 | # try: print()
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
30 30 | #import os # noqa
|
||||
31 31 |
|
||||
32 32 | # case 1:
|
||||
33 |-# try:
|
||||
34 33 | # try: # with comment
|
||||
35 34 | # try: print()
|
||||
36 35 | # except:
|
||||
30 | #import os # noqa
|
||||
31 |
|
||||
32 | # case 1:
|
||||
- # try:
|
||||
33 | # try: # with comment
|
||||
34 | # try: print()
|
||||
35 | # except:
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:34:1
|
||||
|
|
@ -208,15 +198,14 @@ ERA001 Found commented-out code
|
|||
36 | # except:
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
31 31 |
|
||||
32 32 | # case 1:
|
||||
33 33 | # try:
|
||||
34 |-# try: # with comment
|
||||
35 34 | # try: print()
|
||||
36 35 | # except:
|
||||
37 36 | # except Foo:
|
||||
31 |
|
||||
32 | # case 1:
|
||||
33 | # try:
|
||||
- # try: # with comment
|
||||
34 | # try: print()
|
||||
35 | # except:
|
||||
36 | # except Foo:
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:35:1
|
||||
|
|
@ -229,15 +218,14 @@ ERA001 Found commented-out code
|
|||
37 | # except Foo:
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
32 32 | # case 1:
|
||||
33 33 | # try:
|
||||
34 34 | # try: # with comment
|
||||
35 |-# try: print()
|
||||
36 35 | # except:
|
||||
37 36 | # except Foo:
|
||||
38 37 | # except Exception as e: print(e)
|
||||
32 | # case 1:
|
||||
33 | # try:
|
||||
34 | # try: # with comment
|
||||
- # try: print()
|
||||
35 | # except:
|
||||
36 | # except Foo:
|
||||
37 | # except Exception as e: print(e)
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:36:1
|
||||
|
|
@ -250,15 +238,14 @@ ERA001 Found commented-out code
|
|||
38 | # except Exception as e: print(e)
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
33 33 | # try:
|
||||
34 34 | # try: # with comment
|
||||
35 35 | # try: print()
|
||||
36 |-# except:
|
||||
37 36 | # except Foo:
|
||||
38 37 | # except Exception as e: print(e)
|
||||
39 38 |
|
||||
33 | # try:
|
||||
34 | # try: # with comment
|
||||
35 | # try: print()
|
||||
- # except:
|
||||
36 | # except Foo:
|
||||
37 | # except Exception as e: print(e)
|
||||
38 |
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:37:1
|
||||
|
|
@ -270,15 +257,14 @@ ERA001 Found commented-out code
|
|||
38 | # except Exception as e: print(e)
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
34 34 | # try: # with comment
|
||||
35 35 | # try: print()
|
||||
36 36 | # except:
|
||||
37 |-# except Foo:
|
||||
38 37 | # except Exception as e: print(e)
|
||||
39 38 |
|
||||
40 39 |
|
||||
34 | # try: # with comment
|
||||
35 | # try: print()
|
||||
36 | # except:
|
||||
- # except Foo:
|
||||
37 | # except Exception as e: print(e)
|
||||
38 |
|
||||
39 |
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:38:1
|
||||
|
|
@ -289,15 +275,14 @@ ERA001 Found commented-out code
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
35 35 | # try: print()
|
||||
36 36 | # except:
|
||||
37 37 | # except Foo:
|
||||
38 |-# except Exception as e: print(e)
|
||||
39 38 |
|
||||
40 39 |
|
||||
41 40 | # Script tag without an opening tag (Error)
|
||||
35 | # try: print()
|
||||
36 | # except:
|
||||
37 | # except Foo:
|
||||
- # except Exception as e: print(e)
|
||||
38 |
|
||||
39 |
|
||||
40 | # Script tag without an opening tag (Error)
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:44:1
|
||||
|
|
@ -309,15 +294,14 @@ ERA001 Found commented-out code
|
|||
46 | # "rich",
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
41 41 | # Script tag without an opening tag (Error)
|
||||
42 42 |
|
||||
43 43 | # requires-python = ">=3.11"
|
||||
44 |-# dependencies = [
|
||||
45 44 | # "requests<3",
|
||||
46 45 | # "rich",
|
||||
47 46 | # ]
|
||||
41 | # Script tag without an opening tag (Error)
|
||||
42 |
|
||||
43 | # requires-python = ">=3.11"
|
||||
- # dependencies = [
|
||||
44 | # "requests<3",
|
||||
45 | # "rich",
|
||||
46 | # ]
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:47:1
|
||||
|
|
@ -329,15 +313,14 @@ ERA001 Found commented-out code
|
|||
48 | # ///
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
44 44 | # dependencies = [
|
||||
45 45 | # "requests<3",
|
||||
46 46 | # "rich",
|
||||
47 |-# ]
|
||||
48 47 | # ///
|
||||
49 48 |
|
||||
50 49 | # Script tag (OK)
|
||||
44 | # dependencies = [
|
||||
45 | # "requests<3",
|
||||
46 | # "rich",
|
||||
- # ]
|
||||
47 | # ///
|
||||
48 |
|
||||
49 | # Script tag (OK)
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:75:1
|
||||
|
|
@ -350,15 +333,14 @@ ERA001 Found commented-out code
|
|||
77 | # "rich",
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
72 72 |
|
||||
73 73 | # /// script
|
||||
74 74 | # requires-python = ">=3.11"
|
||||
75 |-# dependencies = [
|
||||
76 75 | # "requests<3",
|
||||
77 76 | # "rich",
|
||||
78 77 | # ]
|
||||
72 |
|
||||
73 | # /// script
|
||||
74 | # requires-python = ">=3.11"
|
||||
- # dependencies = [
|
||||
75 | # "requests<3",
|
||||
76 | # "rich",
|
||||
77 | # ]
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
||||
ERA001 Found commented-out code
|
||||
--> ERA001.py:78:1
|
||||
|
|
@ -371,12 +353,11 @@ ERA001 Found commented-out code
|
|||
80 | # Script tag block followed by normal block (Ok)
|
||||
|
|
||||
help: Remove commented-out code
|
||||
|
||||
ℹ Display-only fix
|
||||
75 75 | # dependencies = [
|
||||
76 76 | # "requests<3",
|
||||
77 77 | # "rich",
|
||||
78 |-# ]
|
||||
79 78 |
|
||||
80 79 | # Script tag block followed by normal block (Ok)
|
||||
81 80 |
|
||||
75 | # dependencies = [
|
||||
76 | # "requests<3",
|
||||
77 | # "rich",
|
||||
- # ]
|
||||
78 |
|
||||
79 | # Script tag block followed by normal block (Ok)
|
||||
80 |
|
||||
note: This is a display-only fix and is likely to be incorrect
|
||||
|
|
|
|||
|
|
@ -12,24 +12,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
26 | ):
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
21 22 |
|
||||
22 23 | @app.get("/items/")
|
||||
23 24 | def get_items(
|
||||
24 |- current_user: User = Depends(get_current_user),
|
||||
25 |+ current_user: Annotated[User, Depends(get_current_user)],
|
||||
25 26 | some_security_param: str = Security(get_oauth2_user),
|
||||
26 27 | ):
|
||||
27 28 | pass
|
||||
22 |
|
||||
23 | @app.get("/items/")
|
||||
24 | def get_items(
|
||||
- current_user: User = Depends(get_current_user),
|
||||
25 + current_user: Annotated[User, Depends(get_current_user)],
|
||||
26 | some_security_param: str = Security(get_oauth2_user),
|
||||
27 | ):
|
||||
28 | pass
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:25:5
|
||||
|
|
@ -42,24 +41,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
27 | pass
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
22 23 | @app.get("/items/")
|
||||
23 24 | def get_items(
|
||||
24 25 | current_user: User = Depends(get_current_user),
|
||||
25 |- some_security_param: str = Security(get_oauth2_user),
|
||||
26 |+ some_security_param: Annotated[str, Security(get_oauth2_user)],
|
||||
26 27 | ):
|
||||
27 28 | pass
|
||||
28 29 |
|
||||
23 | @app.get("/items/")
|
||||
24 | def get_items(
|
||||
25 | current_user: User = Depends(get_current_user),
|
||||
- some_security_param: str = Security(get_oauth2_user),
|
||||
26 + some_security_param: Annotated[str, Security(get_oauth2_user)],
|
||||
27 | ):
|
||||
28 | pass
|
||||
29 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:32:5
|
||||
|
|
@ -72,24 +70,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
34 | some_file_param: UploadFile = File(),
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
29 30 |
|
||||
30 31 | @app.post("/stuff/")
|
||||
31 32 | def do_stuff(
|
||||
32 |- some_path_param: str = Path(),
|
||||
33 |+ some_path_param: Annotated[str, Path()],
|
||||
33 34 | some_cookie_param: str = Cookie(),
|
||||
34 35 | some_file_param: UploadFile = File(),
|
||||
35 36 | some_form_param: str = Form(),
|
||||
30 |
|
||||
31 | @app.post("/stuff/")
|
||||
32 | def do_stuff(
|
||||
- some_path_param: str = Path(),
|
||||
33 + some_path_param: Annotated[str, Path()],
|
||||
34 | some_cookie_param: str = Cookie(),
|
||||
35 | some_file_param: UploadFile = File(),
|
||||
36 | some_form_param: str = Form(),
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:33:5
|
||||
|
|
@ -102,24 +99,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
35 | some_form_param: str = Form(),
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
30 31 | @app.post("/stuff/")
|
||||
31 32 | def do_stuff(
|
||||
32 33 | some_path_param: str = Path(),
|
||||
33 |- some_cookie_param: str = Cookie(),
|
||||
34 |+ some_cookie_param: Annotated[str, Cookie()],
|
||||
34 35 | some_file_param: UploadFile = File(),
|
||||
35 36 | some_form_param: str = Form(),
|
||||
36 37 | some_query_param: str | None = Query(default=None),
|
||||
31 | @app.post("/stuff/")
|
||||
32 | def do_stuff(
|
||||
33 | some_path_param: str = Path(),
|
||||
- some_cookie_param: str = Cookie(),
|
||||
34 + some_cookie_param: Annotated[str, Cookie()],
|
||||
35 | some_file_param: UploadFile = File(),
|
||||
36 | some_form_param: str = Form(),
|
||||
37 | some_query_param: str | None = Query(default=None),
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:34:5
|
||||
|
|
@ -132,24 +128,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
36 | some_query_param: str | None = Query(default=None),
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
31 32 | def do_stuff(
|
||||
32 33 | some_path_param: str = Path(),
|
||||
33 34 | some_cookie_param: str = Cookie(),
|
||||
34 |- some_file_param: UploadFile = File(),
|
||||
35 |+ some_file_param: Annotated[UploadFile, File()],
|
||||
35 36 | some_form_param: str = Form(),
|
||||
36 37 | some_query_param: str | None = Query(default=None),
|
||||
37 38 | some_body_param: str = Body("foo"),
|
||||
32 | def do_stuff(
|
||||
33 | some_path_param: str = Path(),
|
||||
34 | some_cookie_param: str = Cookie(),
|
||||
- some_file_param: UploadFile = File(),
|
||||
35 + some_file_param: Annotated[UploadFile, File()],
|
||||
36 | some_form_param: str = Form(),
|
||||
37 | some_query_param: str | None = Query(default=None),
|
||||
38 | some_body_param: str = Body("foo"),
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:35:5
|
||||
|
|
@ -162,24 +157,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
37 | some_body_param: str = Body("foo"),
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
32 33 | some_path_param: str = Path(),
|
||||
33 34 | some_cookie_param: str = Cookie(),
|
||||
34 35 | some_file_param: UploadFile = File(),
|
||||
35 |- some_form_param: str = Form(),
|
||||
36 |+ some_form_param: Annotated[str, Form()],
|
||||
36 37 | some_query_param: str | None = Query(default=None),
|
||||
37 38 | some_body_param: str = Body("foo"),
|
||||
38 39 | some_header_param: int = Header(default=5),
|
||||
33 | some_path_param: str = Path(),
|
||||
34 | some_cookie_param: str = Cookie(),
|
||||
35 | some_file_param: UploadFile = File(),
|
||||
- some_form_param: str = Form(),
|
||||
36 + some_form_param: Annotated[str, Form()],
|
||||
37 | some_query_param: str | None = Query(default=None),
|
||||
38 | some_body_param: str = Body("foo"),
|
||||
39 | some_header_param: int = Header(default=5),
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:36:5
|
||||
|
|
@ -192,24 +186,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
38 | some_header_param: int = Header(default=5),
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
33 34 | some_cookie_param: str = Cookie(),
|
||||
34 35 | some_file_param: UploadFile = File(),
|
||||
35 36 | some_form_param: str = Form(),
|
||||
36 |- some_query_param: str | None = Query(default=None),
|
||||
37 |+ some_query_param: Annotated[str | None, Query()] = None,
|
||||
37 38 | some_body_param: str = Body("foo"),
|
||||
38 39 | some_header_param: int = Header(default=5),
|
||||
39 40 | ):
|
||||
34 | some_cookie_param: str = Cookie(),
|
||||
35 | some_file_param: UploadFile = File(),
|
||||
36 | some_form_param: str = Form(),
|
||||
- some_query_param: str | None = Query(default=None),
|
||||
37 + some_query_param: Annotated[str | None, Query()] = None,
|
||||
38 | some_body_param: str = Body("foo"),
|
||||
39 | some_header_param: int = Header(default=5),
|
||||
40 | ):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:37:5
|
||||
|
|
@ -222,24 +215,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
39 | ):
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
34 35 | some_file_param: UploadFile = File(),
|
||||
35 36 | some_form_param: str = Form(),
|
||||
36 37 | some_query_param: str | None = Query(default=None),
|
||||
37 |- some_body_param: str = Body("foo"),
|
||||
38 |+ some_body_param: Annotated[str, Body()] = "foo",
|
||||
38 39 | some_header_param: int = Header(default=5),
|
||||
39 40 | ):
|
||||
40 41 | # do stuff
|
||||
35 | some_file_param: UploadFile = File(),
|
||||
36 | some_form_param: str = Form(),
|
||||
37 | some_query_param: str | None = Query(default=None),
|
||||
- some_body_param: str = Body("foo"),
|
||||
38 + some_body_param: Annotated[str, Body()] = "foo",
|
||||
39 | some_header_param: int = Header(default=5),
|
||||
40 | ):
|
||||
41 | # do stuff
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:38:5
|
||||
|
|
@ -252,24 +244,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
40 | # do stuff
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
35 36 | some_form_param: str = Form(),
|
||||
36 37 | some_query_param: str | None = Query(default=None),
|
||||
37 38 | some_body_param: str = Body("foo"),
|
||||
38 |- some_header_param: int = Header(default=5),
|
||||
39 |+ some_header_param: Annotated[int, Header()] = 5,
|
||||
39 40 | ):
|
||||
40 41 | # do stuff
|
||||
41 42 | pass
|
||||
36 | some_form_param: str = Form(),
|
||||
37 | some_query_param: str | None = Query(default=None),
|
||||
38 | some_body_param: str = Body("foo"),
|
||||
- some_header_param: int = Header(default=5),
|
||||
39 + some_header_param: Annotated[int, Header()] = 5,
|
||||
40 | ):
|
||||
41 | # do stuff
|
||||
42 | pass
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:47:5
|
||||
|
|
@ -282,24 +273,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
49 | pass
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
44 45 | def get_users(
|
||||
45 46 | skip: int,
|
||||
46 47 | limit: int,
|
||||
47 |- current_user: User = Depends(get_current_user),
|
||||
48 |+ current_user: Annotated[User, Depends(get_current_user)],
|
||||
48 49 | ):
|
||||
49 50 | pass
|
||||
50 51 |
|
||||
45 | def get_users(
|
||||
46 | skip: int,
|
||||
47 | limit: int,
|
||||
- current_user: User = Depends(get_current_user),
|
||||
48 + current_user: Annotated[User, Depends(get_current_user)],
|
||||
49 | ):
|
||||
50 | pass
|
||||
51 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:53:5
|
||||
|
|
@ -312,24 +302,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
55 | limit: int = 10,
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
50 51 |
|
||||
51 52 | @app.get("/users/")
|
||||
52 53 | def get_users(
|
||||
53 |- current_user: User = Depends(get_current_user),
|
||||
54 |+ current_user: Annotated[User, Depends(get_current_user)],
|
||||
54 55 | skip: int = 0,
|
||||
55 56 | limit: int = 10,
|
||||
56 57 | ):
|
||||
51 |
|
||||
52 | @app.get("/users/")
|
||||
53 | def get_users(
|
||||
- current_user: User = Depends(get_current_user),
|
||||
54 + current_user: Annotated[User, Depends(get_current_user)],
|
||||
55 | skip: int = 0,
|
||||
56 | limit: int = 10,
|
||||
57 | ):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:61:25
|
||||
|
|
@ -340,24 +329,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
62 | pass
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
58 59 |
|
||||
59 60 |
|
||||
60 61 | @app.get("/items/{item_id}")
|
||||
61 |-async def read_items(*, item_id: int = Path(title="The ID of the item to get"), q: str):
|
||||
62 |+async def read_items(*, item_id: Annotated[int, Path(title="The ID of the item to get")], q: str):
|
||||
62 63 | pass
|
||||
63 64 |
|
||||
64 65 | # Non fixable errors
|
||||
59 |
|
||||
60 |
|
||||
61 | @app.get("/items/{item_id}")
|
||||
- async def read_items(*, item_id: int = Path(title="The ID of the item to get"), q: str):
|
||||
62 + async def read_items(*, item_id: Annotated[int, Path(title="The ID of the item to get")], q: str):
|
||||
63 | pass
|
||||
64 |
|
||||
65 | # Non fixable errors
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:70:5
|
||||
|
|
|
|||
|
|
@ -12,24 +12,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
26 | ):
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
21 22 |
|
||||
22 23 | @app.get("/items/")
|
||||
23 24 | def get_items(
|
||||
24 |- current_user: User = Depends(get_current_user),
|
||||
25 |+ current_user: Annotated[User, Depends(get_current_user)],
|
||||
25 26 | some_security_param: str = Security(get_oauth2_user),
|
||||
26 27 | ):
|
||||
27 28 | pass
|
||||
22 |
|
||||
23 | @app.get("/items/")
|
||||
24 | def get_items(
|
||||
- current_user: User = Depends(get_current_user),
|
||||
25 + current_user: Annotated[User, Depends(get_current_user)],
|
||||
26 | some_security_param: str = Security(get_oauth2_user),
|
||||
27 | ):
|
||||
28 | pass
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:25:5
|
||||
|
|
@ -42,24 +41,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
27 | pass
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
22 23 | @app.get("/items/")
|
||||
23 24 | def get_items(
|
||||
24 25 | current_user: User = Depends(get_current_user),
|
||||
25 |- some_security_param: str = Security(get_oauth2_user),
|
||||
26 |+ some_security_param: Annotated[str, Security(get_oauth2_user)],
|
||||
26 27 | ):
|
||||
27 28 | pass
|
||||
28 29 |
|
||||
23 | @app.get("/items/")
|
||||
24 | def get_items(
|
||||
25 | current_user: User = Depends(get_current_user),
|
||||
- some_security_param: str = Security(get_oauth2_user),
|
||||
26 + some_security_param: Annotated[str, Security(get_oauth2_user)],
|
||||
27 | ):
|
||||
28 | pass
|
||||
29 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:32:5
|
||||
|
|
@ -72,24 +70,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
34 | some_file_param: UploadFile = File(),
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
29 30 |
|
||||
30 31 | @app.post("/stuff/")
|
||||
31 32 | def do_stuff(
|
||||
32 |- some_path_param: str = Path(),
|
||||
33 |+ some_path_param: Annotated[str, Path()],
|
||||
33 34 | some_cookie_param: str = Cookie(),
|
||||
34 35 | some_file_param: UploadFile = File(),
|
||||
35 36 | some_form_param: str = Form(),
|
||||
30 |
|
||||
31 | @app.post("/stuff/")
|
||||
32 | def do_stuff(
|
||||
- some_path_param: str = Path(),
|
||||
33 + some_path_param: Annotated[str, Path()],
|
||||
34 | some_cookie_param: str = Cookie(),
|
||||
35 | some_file_param: UploadFile = File(),
|
||||
36 | some_form_param: str = Form(),
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:33:5
|
||||
|
|
@ -102,24 +99,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
35 | some_form_param: str = Form(),
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
30 31 | @app.post("/stuff/")
|
||||
31 32 | def do_stuff(
|
||||
32 33 | some_path_param: str = Path(),
|
||||
33 |- some_cookie_param: str = Cookie(),
|
||||
34 |+ some_cookie_param: Annotated[str, Cookie()],
|
||||
34 35 | some_file_param: UploadFile = File(),
|
||||
35 36 | some_form_param: str = Form(),
|
||||
36 37 | some_query_param: str | None = Query(default=None),
|
||||
31 | @app.post("/stuff/")
|
||||
32 | def do_stuff(
|
||||
33 | some_path_param: str = Path(),
|
||||
- some_cookie_param: str = Cookie(),
|
||||
34 + some_cookie_param: Annotated[str, Cookie()],
|
||||
35 | some_file_param: UploadFile = File(),
|
||||
36 | some_form_param: str = Form(),
|
||||
37 | some_query_param: str | None = Query(default=None),
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:34:5
|
||||
|
|
@ -132,24 +128,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
36 | some_query_param: str | None = Query(default=None),
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
31 32 | def do_stuff(
|
||||
32 33 | some_path_param: str = Path(),
|
||||
33 34 | some_cookie_param: str = Cookie(),
|
||||
34 |- some_file_param: UploadFile = File(),
|
||||
35 |+ some_file_param: Annotated[UploadFile, File()],
|
||||
35 36 | some_form_param: str = Form(),
|
||||
36 37 | some_query_param: str | None = Query(default=None),
|
||||
37 38 | some_body_param: str = Body("foo"),
|
||||
32 | def do_stuff(
|
||||
33 | some_path_param: str = Path(),
|
||||
34 | some_cookie_param: str = Cookie(),
|
||||
- some_file_param: UploadFile = File(),
|
||||
35 + some_file_param: Annotated[UploadFile, File()],
|
||||
36 | some_form_param: str = Form(),
|
||||
37 | some_query_param: str | None = Query(default=None),
|
||||
38 | some_body_param: str = Body("foo"),
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:35:5
|
||||
|
|
@ -162,24 +157,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
37 | some_body_param: str = Body("foo"),
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
32 33 | some_path_param: str = Path(),
|
||||
33 34 | some_cookie_param: str = Cookie(),
|
||||
34 35 | some_file_param: UploadFile = File(),
|
||||
35 |- some_form_param: str = Form(),
|
||||
36 |+ some_form_param: Annotated[str, Form()],
|
||||
36 37 | some_query_param: str | None = Query(default=None),
|
||||
37 38 | some_body_param: str = Body("foo"),
|
||||
38 39 | some_header_param: int = Header(default=5),
|
||||
33 | some_path_param: str = Path(),
|
||||
34 | some_cookie_param: str = Cookie(),
|
||||
35 | some_file_param: UploadFile = File(),
|
||||
- some_form_param: str = Form(),
|
||||
36 + some_form_param: Annotated[str, Form()],
|
||||
37 | some_query_param: str | None = Query(default=None),
|
||||
38 | some_body_param: str = Body("foo"),
|
||||
39 | some_header_param: int = Header(default=5),
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:36:5
|
||||
|
|
@ -192,24 +186,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
38 | some_header_param: int = Header(default=5),
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
33 34 | some_cookie_param: str = Cookie(),
|
||||
34 35 | some_file_param: UploadFile = File(),
|
||||
35 36 | some_form_param: str = Form(),
|
||||
36 |- some_query_param: str | None = Query(default=None),
|
||||
37 |+ some_query_param: Annotated[str | None, Query()] = None,
|
||||
37 38 | some_body_param: str = Body("foo"),
|
||||
38 39 | some_header_param: int = Header(default=5),
|
||||
39 40 | ):
|
||||
34 | some_cookie_param: str = Cookie(),
|
||||
35 | some_file_param: UploadFile = File(),
|
||||
36 | some_form_param: str = Form(),
|
||||
- some_query_param: str | None = Query(default=None),
|
||||
37 + some_query_param: Annotated[str | None, Query()] = None,
|
||||
38 | some_body_param: str = Body("foo"),
|
||||
39 | some_header_param: int = Header(default=5),
|
||||
40 | ):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:37:5
|
||||
|
|
@ -222,24 +215,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
39 | ):
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
34 35 | some_file_param: UploadFile = File(),
|
||||
35 36 | some_form_param: str = Form(),
|
||||
36 37 | some_query_param: str | None = Query(default=None),
|
||||
37 |- some_body_param: str = Body("foo"),
|
||||
38 |+ some_body_param: Annotated[str, Body()] = "foo",
|
||||
38 39 | some_header_param: int = Header(default=5),
|
||||
39 40 | ):
|
||||
40 41 | # do stuff
|
||||
35 | some_file_param: UploadFile = File(),
|
||||
36 | some_form_param: str = Form(),
|
||||
37 | some_query_param: str | None = Query(default=None),
|
||||
- some_body_param: str = Body("foo"),
|
||||
38 + some_body_param: Annotated[str, Body()] = "foo",
|
||||
39 | some_header_param: int = Header(default=5),
|
||||
40 | ):
|
||||
41 | # do stuff
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:38:5
|
||||
|
|
@ -252,24 +244,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
40 | # do stuff
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
35 36 | some_form_param: str = Form(),
|
||||
36 37 | some_query_param: str | None = Query(default=None),
|
||||
37 38 | some_body_param: str = Body("foo"),
|
||||
38 |- some_header_param: int = Header(default=5),
|
||||
39 |+ some_header_param: Annotated[int, Header()] = 5,
|
||||
39 40 | ):
|
||||
40 41 | # do stuff
|
||||
41 42 | pass
|
||||
36 | some_form_param: str = Form(),
|
||||
37 | some_query_param: str | None = Query(default=None),
|
||||
38 | some_body_param: str = Body("foo"),
|
||||
- some_header_param: int = Header(default=5),
|
||||
39 + some_header_param: Annotated[int, Header()] = 5,
|
||||
40 | ):
|
||||
41 | # do stuff
|
||||
42 | pass
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:47:5
|
||||
|
|
@ -282,24 +273,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
49 | pass
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
44 45 | def get_users(
|
||||
45 46 | skip: int,
|
||||
46 47 | limit: int,
|
||||
47 |- current_user: User = Depends(get_current_user),
|
||||
48 |+ current_user: Annotated[User, Depends(get_current_user)],
|
||||
48 49 | ):
|
||||
49 50 | pass
|
||||
50 51 |
|
||||
45 | def get_users(
|
||||
46 | skip: int,
|
||||
47 | limit: int,
|
||||
- current_user: User = Depends(get_current_user),
|
||||
48 + current_user: Annotated[User, Depends(get_current_user)],
|
||||
49 | ):
|
||||
50 | pass
|
||||
51 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:53:5
|
||||
|
|
@ -312,24 +302,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
55 | limit: int = 10,
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
50 51 |
|
||||
51 52 | @app.get("/users/")
|
||||
52 53 | def get_users(
|
||||
53 |- current_user: User = Depends(get_current_user),
|
||||
54 |+ current_user: Annotated[User, Depends(get_current_user)],
|
||||
54 55 | skip: int = 0,
|
||||
55 56 | limit: int = 10,
|
||||
56 57 | ):
|
||||
51 |
|
||||
52 | @app.get("/users/")
|
||||
53 | def get_users(
|
||||
- current_user: User = Depends(get_current_user),
|
||||
54 + current_user: Annotated[User, Depends(get_current_user)],
|
||||
55 | skip: int = 0,
|
||||
56 | limit: int = 10,
|
||||
57 | ):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:61:25
|
||||
|
|
@ -340,24 +329,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
62 | pass
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | Security,
|
||||
13 13 | )
|
||||
14 14 | from pydantic import BaseModel
|
||||
15 |+from typing_extensions import Annotated
|
||||
15 16 |
|
||||
16 17 | app = FastAPI()
|
||||
17 18 | router = APIRouter()
|
||||
12 | Security,
|
||||
13 | )
|
||||
14 | from pydantic import BaseModel
|
||||
15 + from typing_extensions import Annotated
|
||||
16 |
|
||||
17 | app = FastAPI()
|
||||
18 | router = APIRouter()
|
||||
--------------------------------------------------------------------------------
|
||||
58 59 |
|
||||
59 60 |
|
||||
60 61 | @app.get("/items/{item_id}")
|
||||
61 |-async def read_items(*, item_id: int = Path(title="The ID of the item to get"), q: str):
|
||||
62 |+async def read_items(*, item_id: Annotated[int, Path(title="The ID of the item to get")], q: str):
|
||||
62 63 | pass
|
||||
63 64 |
|
||||
64 65 | # Non fixable errors
|
||||
59 |
|
||||
60 |
|
||||
61 | @app.get("/items/{item_id}")
|
||||
- async def read_items(*, item_id: int = Path(title="The ID of the item to get"), q: str):
|
||||
62 + async def read_items(*, item_id: Annotated[int, Path(title="The ID of the item to get")], q: str):
|
||||
63 | pass
|
||||
64 |
|
||||
65 | # Non fixable errors
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 FastAPI dependency without `Annotated`
|
||||
--> FAST002_0.py:70:5
|
||||
|
|
|
|||
|
|
@ -10,22 +10,21 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
11 | return echo
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | values. See #15043 for more details."""
|
||||
3 3 |
|
||||
4 4 | from fastapi import FastAPI, Query
|
||||
5 |+from typing import Annotated
|
||||
5 6 |
|
||||
6 7 | app = FastAPI()
|
||||
7 8 |
|
||||
8 9 |
|
||||
9 10 | @app.get("/test")
|
||||
10 |-def handler(echo: str = Query("")):
|
||||
11 |+def handler(echo: Annotated[str, Query()] = ""):
|
||||
11 12 | return echo
|
||||
12 13 |
|
||||
13 14 |
|
||||
2 | values. See #15043 for more details."""
|
||||
3 |
|
||||
4 | from fastapi import FastAPI, Query
|
||||
5 + from typing import Annotated
|
||||
6 |
|
||||
7 | app = FastAPI()
|
||||
8 |
|
||||
9 |
|
||||
10 | @app.get("/test")
|
||||
- def handler(echo: str = Query("")):
|
||||
11 + def handler(echo: Annotated[str, Query()] = ""):
|
||||
12 | return echo
|
||||
13 |
|
||||
14 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_1.py:15:14
|
||||
|
|
@ -36,24 +35,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
16 | return echo
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | values. See #15043 for more details."""
|
||||
3 3 |
|
||||
4 4 | from fastapi import FastAPI, Query
|
||||
5 |+from typing import Annotated
|
||||
5 6 |
|
||||
6 7 | app = FastAPI()
|
||||
7 8 |
|
||||
2 | values. See #15043 for more details."""
|
||||
3 |
|
||||
4 | from fastapi import FastAPI, Query
|
||||
5 + from typing import Annotated
|
||||
6 |
|
||||
7 | app = FastAPI()
|
||||
8 |
|
||||
--------------------------------------------------------------------------------
|
||||
12 13 |
|
||||
13 14 |
|
||||
14 15 | @app.get("/test")
|
||||
15 |-def handler2(echo: str = Query(default="")):
|
||||
16 |+def handler2(echo: Annotated[str, Query()] = ""):
|
||||
16 17 | return echo
|
||||
17 18 |
|
||||
18 19 |
|
||||
13 |
|
||||
14 |
|
||||
15 | @app.get("/test")
|
||||
- def handler2(echo: str = Query(default="")):
|
||||
16 + def handler2(echo: Annotated[str, Query()] = ""):
|
||||
17 | return echo
|
||||
18 |
|
||||
19 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_1.py:20:14
|
||||
|
|
@ -64,19 +62,18 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
21 | return echo
|
||||
|
|
||||
help: Replace with `typing.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | values. See #15043 for more details."""
|
||||
3 3 |
|
||||
4 4 | from fastapi import FastAPI, Query
|
||||
5 |+from typing import Annotated
|
||||
5 6 |
|
||||
6 7 | app = FastAPI()
|
||||
7 8 |
|
||||
2 | values. See #15043 for more details."""
|
||||
3 |
|
||||
4 | from fastapi import FastAPI, Query
|
||||
5 + from typing import Annotated
|
||||
6 |
|
||||
7 | app = FastAPI()
|
||||
8 |
|
||||
--------------------------------------------------------------------------------
|
||||
17 18 |
|
||||
18 19 |
|
||||
19 20 | @app.get("/test")
|
||||
20 |-def handler3(echo: str = Query("123", min_length=3, max_length=50)):
|
||||
21 |+def handler3(echo: Annotated[str, Query(min_length=3, max_length=50)] = "123"):
|
||||
21 22 | return echo
|
||||
18 |
|
||||
19 |
|
||||
20 | @app.get("/test")
|
||||
- def handler3(echo: str = Query("123", min_length=3, max_length=50)):
|
||||
21 + def handler3(echo: Annotated[str, Query(min_length=3, max_length=50)] = "123"):
|
||||
22 | return echo
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,22 +10,21 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
11 | return echo
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | values. See #15043 for more details."""
|
||||
3 3 |
|
||||
4 4 | from fastapi import FastAPI, Query
|
||||
5 |+from typing_extensions import Annotated
|
||||
5 6 |
|
||||
6 7 | app = FastAPI()
|
||||
7 8 |
|
||||
8 9 |
|
||||
9 10 | @app.get("/test")
|
||||
10 |-def handler(echo: str = Query("")):
|
||||
11 |+def handler(echo: Annotated[str, Query()] = ""):
|
||||
11 12 | return echo
|
||||
12 13 |
|
||||
13 14 |
|
||||
2 | values. See #15043 for more details."""
|
||||
3 |
|
||||
4 | from fastapi import FastAPI, Query
|
||||
5 + from typing_extensions import Annotated
|
||||
6 |
|
||||
7 | app = FastAPI()
|
||||
8 |
|
||||
9 |
|
||||
10 | @app.get("/test")
|
||||
- def handler(echo: str = Query("")):
|
||||
11 + def handler(echo: Annotated[str, Query()] = ""):
|
||||
12 | return echo
|
||||
13 |
|
||||
14 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_1.py:15:14
|
||||
|
|
@ -36,24 +35,23 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
16 | return echo
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | values. See #15043 for more details."""
|
||||
3 3 |
|
||||
4 4 | from fastapi import FastAPI, Query
|
||||
5 |+from typing_extensions import Annotated
|
||||
5 6 |
|
||||
6 7 | app = FastAPI()
|
||||
7 8 |
|
||||
2 | values. See #15043 for more details."""
|
||||
3 |
|
||||
4 | from fastapi import FastAPI, Query
|
||||
5 + from typing_extensions import Annotated
|
||||
6 |
|
||||
7 | app = FastAPI()
|
||||
8 |
|
||||
--------------------------------------------------------------------------------
|
||||
12 13 |
|
||||
13 14 |
|
||||
14 15 | @app.get("/test")
|
||||
15 |-def handler2(echo: str = Query(default="")):
|
||||
16 |+def handler2(echo: Annotated[str, Query()] = ""):
|
||||
16 17 | return echo
|
||||
17 18 |
|
||||
18 19 |
|
||||
13 |
|
||||
14 |
|
||||
15 | @app.get("/test")
|
||||
- def handler2(echo: str = Query(default="")):
|
||||
16 + def handler2(echo: Annotated[str, Query()] = ""):
|
||||
17 | return echo
|
||||
18 |
|
||||
19 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST002 [*] FastAPI dependency without `Annotated`
|
||||
--> FAST002_1.py:20:14
|
||||
|
|
@ -64,19 +62,18 @@ FAST002 [*] FastAPI dependency without `Annotated`
|
|||
21 | return echo
|
||||
|
|
||||
help: Replace with `typing_extensions.Annotated`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | values. See #15043 for more details."""
|
||||
3 3 |
|
||||
4 4 | from fastapi import FastAPI, Query
|
||||
5 |+from typing_extensions import Annotated
|
||||
5 6 |
|
||||
6 7 | app = FastAPI()
|
||||
7 8 |
|
||||
2 | values. See #15043 for more details."""
|
||||
3 |
|
||||
4 | from fastapi import FastAPI, Query
|
||||
5 + from typing_extensions import Annotated
|
||||
6 |
|
||||
7 | app = FastAPI()
|
||||
8 |
|
||||
--------------------------------------------------------------------------------
|
||||
17 18 |
|
||||
18 19 |
|
||||
19 20 | @app.get("/test")
|
||||
20 |-def handler3(echo: str = Query("123", min_length=3, max_length=50)):
|
||||
21 |+def handler3(echo: Annotated[str, Query(min_length=3, max_length=50)] = "123"):
|
||||
21 22 | return echo
|
||||
18 |
|
||||
19 |
|
||||
20 | @app.get("/test")
|
||||
- def handler3(echo: str = Query("123", min_length=3, max_length=50)):
|
||||
21 + def handler3(echo: Annotated[str, Query(min_length=3, max_length=50)] = "123"):
|
||||
22 | return echo
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,16 +10,15 @@ FAST001 [*] FastAPI route with redundant `response_model` argument
|
|||
19 | return item
|
||||
|
|
||||
help: Remove argument
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 | # Errors
|
||||
15 15 |
|
||||
16 16 |
|
||||
17 |-@app.post("/items/", response_model=Item)
|
||||
17 |+@app.post("/items/")
|
||||
18 18 | async def create_item(item: Item) -> Item:
|
||||
19 19 | return item
|
||||
20 20 |
|
||||
14 | # Errors
|
||||
15 |
|
||||
16 |
|
||||
- @app.post("/items/", response_model=Item)
|
||||
17 + @app.post("/items/")
|
||||
18 | async def create_item(item: Item) -> Item:
|
||||
19 | return item
|
||||
20 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST001 [*] FastAPI route with redundant `response_model` argument
|
||||
--> FAST001.py:22:22
|
||||
|
|
@ -30,16 +29,15 @@ FAST001 [*] FastAPI route with redundant `response_model` argument
|
|||
24 | return item
|
||||
|
|
||||
help: Remove argument
|
||||
|
||||
ℹ Unsafe fix
|
||||
19 19 | return item
|
||||
20 20 |
|
||||
21 21 |
|
||||
22 |-@app.post("/items/", response_model=list[Item])
|
||||
22 |+@app.post("/items/")
|
||||
23 23 | async def create_item(item: Item) -> list[Item]:
|
||||
24 24 | return item
|
||||
25 25 |
|
||||
19 | return item
|
||||
20 |
|
||||
21 |
|
||||
- @app.post("/items/", response_model=list[Item])
|
||||
22 + @app.post("/items/")
|
||||
23 | async def create_item(item: Item) -> list[Item]:
|
||||
24 | return item
|
||||
25 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST001 [*] FastAPI route with redundant `response_model` argument
|
||||
--> FAST001.py:27:22
|
||||
|
|
@ -50,16 +48,15 @@ FAST001 [*] FastAPI route with redundant `response_model` argument
|
|||
29 | return item
|
||||
|
|
||||
help: Remove argument
|
||||
|
||||
ℹ Unsafe fix
|
||||
24 24 | return item
|
||||
25 25 |
|
||||
26 26 |
|
||||
27 |-@app.post("/items/", response_model=List[Item])
|
||||
27 |+@app.post("/items/")
|
||||
28 28 | async def create_item(item: Item) -> List[Item]:
|
||||
29 29 | return item
|
||||
30 30 |
|
||||
24 | return item
|
||||
25 |
|
||||
26 |
|
||||
- @app.post("/items/", response_model=List[Item])
|
||||
27 + @app.post("/items/")
|
||||
28 | async def create_item(item: Item) -> List[Item]:
|
||||
29 | return item
|
||||
30 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST001 [*] FastAPI route with redundant `response_model` argument
|
||||
--> FAST001.py:32:22
|
||||
|
|
@ -70,16 +67,15 @@ FAST001 [*] FastAPI route with redundant `response_model` argument
|
|||
34 | return item
|
||||
|
|
||||
help: Remove argument
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 | return item
|
||||
30 30 |
|
||||
31 31 |
|
||||
32 |-@app.post("/items/", response_model=Dict[str, Item])
|
||||
32 |+@app.post("/items/")
|
||||
33 33 | async def create_item(item: Item) -> Dict[str, Item]:
|
||||
34 34 | return item
|
||||
35 35 |
|
||||
29 | return item
|
||||
30 |
|
||||
31 |
|
||||
- @app.post("/items/", response_model=Dict[str, Item])
|
||||
32 + @app.post("/items/")
|
||||
33 | async def create_item(item: Item) -> Dict[str, Item]:
|
||||
34 | return item
|
||||
35 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST001 [*] FastAPI route with redundant `response_model` argument
|
||||
--> FAST001.py:37:22
|
||||
|
|
@ -90,16 +86,15 @@ FAST001 [*] FastAPI route with redundant `response_model` argument
|
|||
39 | return item
|
||||
|
|
||||
help: Remove argument
|
||||
|
||||
ℹ Unsafe fix
|
||||
34 34 | return item
|
||||
35 35 |
|
||||
36 36 |
|
||||
37 |-@app.post("/items/", response_model=str)
|
||||
37 |+@app.post("/items/")
|
||||
38 38 | async def create_item(item: Item) -> str:
|
||||
39 39 | return item
|
||||
40 40 |
|
||||
34 | return item
|
||||
35 |
|
||||
36 |
|
||||
- @app.post("/items/", response_model=str)
|
||||
37 + @app.post("/items/")
|
||||
38 | async def create_item(item: Item) -> str:
|
||||
39 | return item
|
||||
40 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST001 [*] FastAPI route with redundant `response_model` argument
|
||||
--> FAST001.py:42:21
|
||||
|
|
@ -110,16 +105,15 @@ FAST001 [*] FastAPI route with redundant `response_model` argument
|
|||
44 | return item
|
||||
|
|
||||
help: Remove argument
|
||||
|
||||
ℹ Unsafe fix
|
||||
39 39 | return item
|
||||
40 40 |
|
||||
41 41 |
|
||||
42 |-@app.get("/items/", response_model=Item)
|
||||
42 |+@app.get("/items/")
|
||||
43 43 | async def create_item(item: Item) -> Item:
|
||||
44 44 | return item
|
||||
45 45 |
|
||||
39 | return item
|
||||
40 |
|
||||
41 |
|
||||
- @app.get("/items/", response_model=Item)
|
||||
42 + @app.get("/items/")
|
||||
43 | async def create_item(item: Item) -> Item:
|
||||
44 | return item
|
||||
45 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST001 [*] FastAPI route with redundant `response_model` argument
|
||||
--> FAST001.py:47:21
|
||||
|
|
@ -130,16 +124,15 @@ FAST001 [*] FastAPI route with redundant `response_model` argument
|
|||
49 | async def create_item(item: Item) -> Item:
|
||||
|
|
||||
help: Remove argument
|
||||
|
||||
ℹ Unsafe fix
|
||||
44 44 | return item
|
||||
45 45 |
|
||||
46 46 |
|
||||
47 |-@app.get("/items/", response_model=Item)
|
||||
47 |+@app.get("/items/")
|
||||
48 48 | @app.post("/items/", response_model=Item)
|
||||
49 49 | async def create_item(item: Item) -> Item:
|
||||
50 50 | return item
|
||||
44 | return item
|
||||
45 |
|
||||
46 |
|
||||
- @app.get("/items/", response_model=Item)
|
||||
47 + @app.get("/items/")
|
||||
48 | @app.post("/items/", response_model=Item)
|
||||
49 | async def create_item(item: Item) -> Item:
|
||||
50 | return item
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST001 [*] FastAPI route with redundant `response_model` argument
|
||||
--> FAST001.py:48:22
|
||||
|
|
@ -151,16 +144,15 @@ FAST001 [*] FastAPI route with redundant `response_model` argument
|
|||
50 | return item
|
||||
|
|
||||
help: Remove argument
|
||||
|
||||
ℹ Unsafe fix
|
||||
45 45 |
|
||||
46 46 |
|
||||
47 47 | @app.get("/items/", response_model=Item)
|
||||
48 |-@app.post("/items/", response_model=Item)
|
||||
48 |+@app.post("/items/")
|
||||
49 49 | async def create_item(item: Item) -> Item:
|
||||
50 50 | return item
|
||||
51 51 |
|
||||
45 |
|
||||
46 |
|
||||
47 | @app.get("/items/", response_model=Item)
|
||||
- @app.post("/items/", response_model=Item)
|
||||
48 + @app.post("/items/")
|
||||
49 | async def create_item(item: Item) -> Item:
|
||||
50 | return item
|
||||
51 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST001 [*] FastAPI route with redundant `response_model` argument
|
||||
--> FAST001.py:53:24
|
||||
|
|
@ -171,16 +163,15 @@ FAST001 [*] FastAPI route with redundant `response_model` argument
|
|||
55 | return item
|
||||
|
|
||||
help: Remove argument
|
||||
|
||||
ℹ Unsafe fix
|
||||
50 50 | return item
|
||||
51 51 |
|
||||
52 52 |
|
||||
53 |-@router.get("/items/", response_model=Item)
|
||||
53 |+@router.get("/items/")
|
||||
54 54 | async def create_item(item: Item) -> Item:
|
||||
55 55 | return item
|
||||
56 56 |
|
||||
50 | return item
|
||||
51 |
|
||||
52 |
|
||||
- @router.get("/items/", response_model=Item)
|
||||
53 + @router.get("/items/")
|
||||
54 | async def create_item(item: Item) -> Item:
|
||||
55 | return item
|
||||
56 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST001 [*] FastAPI route with redundant `response_model` argument
|
||||
--> FAST001.py:118:23
|
||||
|
|
@ -193,13 +184,12 @@ FAST001 [*] FastAPI route with redundant `response_model` argument
|
|||
120 | return "Hello World!"
|
||||
|
|
||||
help: Remove argument
|
||||
|
||||
ℹ Unsafe fix
|
||||
115 115 |
|
||||
116 116 | def setup_app(app_arg: FastAPI, non_app: str) -> None:
|
||||
117 117 | # Error
|
||||
118 |- @app_arg.get("/", response_model=str)
|
||||
118 |+ @app_arg.get("/")
|
||||
119 119 | async def get_root() -> str:
|
||||
120 120 | return "Hello World!"
|
||||
121 121 |
|
||||
115 |
|
||||
116 | def setup_app(app_arg: FastAPI, non_app: str) -> None:
|
||||
117 | # Error
|
||||
- @app_arg.get("/", response_model=str)
|
||||
118 + @app_arg.get("/")
|
||||
119 | async def get_root() -> str:
|
||||
120 | return "Hello World!"
|
||||
121 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -11,16 +11,15 @@ FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing`
|
|||
11 | return {"query": query}
|
||||
|
|
||||
help: Add `thing_id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 |
|
||||
8 8 | # Errors
|
||||
9 9 | @app.get("/things/{thing_id}")
|
||||
10 |-async def read_thing(query: str):
|
||||
10 |+async def read_thing(query: str, thing_id):
|
||||
11 11 | return {"query": query}
|
||||
12 12 |
|
||||
13 13 |
|
||||
7 |
|
||||
8 | # Errors
|
||||
9 | @app.get("/things/{thing_id}")
|
||||
- async def read_thing(query: str):
|
||||
10 + async def read_thing(query: str, thing_id):
|
||||
11 | return {"query": query}
|
||||
12 |
|
||||
13 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `isbn` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:14:23
|
||||
|
|
@ -31,16 +30,15 @@ FAST003 [*] Parameter `isbn` appears in route path, but not in `read_thing` sign
|
|||
16 | ...
|
||||
|
|
||||
help: Add `isbn` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 |
|
||||
13 13 |
|
||||
14 14 | @app.get("/books/isbn-{isbn}")
|
||||
15 |-async def read_thing():
|
||||
15 |+async def read_thing(isbn):
|
||||
16 16 | ...
|
||||
17 17 |
|
||||
18 18 |
|
||||
12 |
|
||||
13 |
|
||||
14 | @app.get("/books/isbn-{isbn}")
|
||||
- async def read_thing():
|
||||
15 + async def read_thing(isbn):
|
||||
16 | ...
|
||||
17 |
|
||||
18 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:19:19
|
||||
|
|
@ -51,16 +49,15 @@ FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing`
|
|||
21 | return {"query": query}
|
||||
|
|
||||
help: Add `thing_id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 |
|
||||
18 18 |
|
||||
19 19 | @app.get("/things/{thing_id:path}")
|
||||
20 |-async def read_thing(query: str):
|
||||
20 |+async def read_thing(query: str, thing_id):
|
||||
21 21 | return {"query": query}
|
||||
22 22 |
|
||||
23 23 |
|
||||
17 |
|
||||
18 |
|
||||
19 | @app.get("/things/{thing_id:path}")
|
||||
- async def read_thing(query: str):
|
||||
20 + async def read_thing(query: str, thing_id):
|
||||
21 | return {"query": query}
|
||||
22 |
|
||||
23 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:24:19
|
||||
|
|
@ -71,16 +68,15 @@ FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing`
|
|||
26 | return {"query": query}
|
||||
|
|
||||
help: Add `thing_id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 |
|
||||
23 23 |
|
||||
24 24 | @app.get("/things/{thing_id : path}")
|
||||
25 |-async def read_thing(query: str):
|
||||
25 |+async def read_thing(query: str, thing_id):
|
||||
26 26 | return {"query": query}
|
||||
27 27 |
|
||||
28 28 |
|
||||
22 |
|
||||
23 |
|
||||
24 | @app.get("/things/{thing_id : path}")
|
||||
- async def read_thing(query: str):
|
||||
25 + async def read_thing(query: str, thing_id):
|
||||
26 | return {"query": query}
|
||||
27 |
|
||||
28 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:29:27
|
||||
|
|
@ -91,16 +87,15 @@ FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` sig
|
|||
31 | return {"author": author}
|
||||
|
|
||||
help: Add `title` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
27 27 |
|
||||
28 28 |
|
||||
29 29 | @app.get("/books/{author}/{title}")
|
||||
30 |-async def read_thing(author: str):
|
||||
30 |+async def read_thing(author: str, title):
|
||||
31 31 | return {"author": author}
|
||||
32 32 |
|
||||
33 33 |
|
||||
27 |
|
||||
28 |
|
||||
29 | @app.get("/books/{author}/{title}")
|
||||
- async def read_thing(author: str):
|
||||
30 + async def read_thing(author: str, title):
|
||||
31 | return {"author": author}
|
||||
32 |
|
||||
33 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `author_name` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:34:18
|
||||
|
|
@ -111,16 +106,15 @@ FAST003 [*] Parameter `author_name` appears in route path, but not in `read_thin
|
|||
36 | ...
|
||||
|
|
||||
help: Add `author_name` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
32 32 |
|
||||
33 33 |
|
||||
34 34 | @app.get("/books/{author_name}/{title}")
|
||||
35 |-async def read_thing():
|
||||
35 |+async def read_thing(author_name):
|
||||
36 36 | ...
|
||||
37 37 |
|
||||
38 38 |
|
||||
32 |
|
||||
33 |
|
||||
34 | @app.get("/books/{author_name}/{title}")
|
||||
- async def read_thing():
|
||||
35 + async def read_thing(author_name):
|
||||
36 | ...
|
||||
37 |
|
||||
38 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:34:32
|
||||
|
|
@ -131,16 +125,15 @@ FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` sig
|
|||
36 | ...
|
||||
|
|
||||
help: Add `title` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
32 32 |
|
||||
33 33 |
|
||||
34 34 | @app.get("/books/{author_name}/{title}")
|
||||
35 |-async def read_thing():
|
||||
35 |+async def read_thing(title):
|
||||
36 36 | ...
|
||||
37 37 |
|
||||
38 38 |
|
||||
32 |
|
||||
33 |
|
||||
34 | @app.get("/books/{author_name}/{title}")
|
||||
- async def read_thing():
|
||||
35 + async def read_thing(title):
|
||||
36 | ...
|
||||
37 |
|
||||
38 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 Parameter `author` appears in route path, but only as a positional-only argument in `read_thing` signature
|
||||
--> FAST003.py:39:18
|
||||
|
|
@ -169,16 +162,15 @@ FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` sig
|
|||
46 | author: str,
|
||||
|
|
||||
help: Add `title` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
44 44 | @app.get("/books/{author}/{title}/{page}")
|
||||
45 45 | async def read_thing(
|
||||
46 46 | author: str,
|
||||
47 |- query: str,
|
||||
47 |+ query: str, title,
|
||||
48 48 | ): ...
|
||||
49 49 |
|
||||
50 50 |
|
||||
44 | @app.get("/books/{author}/{title}/{page}")
|
||||
45 | async def read_thing(
|
||||
46 | author: str,
|
||||
- query: str,
|
||||
47 + query: str, title,
|
||||
48 | ): ...
|
||||
49 |
|
||||
50 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `page` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:44:35
|
||||
|
|
@ -189,16 +181,15 @@ FAST003 [*] Parameter `page` appears in route path, but not in `read_thing` sign
|
|||
46 | author: str,
|
||||
|
|
||||
help: Add `page` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
44 44 | @app.get("/books/{author}/{title}/{page}")
|
||||
45 45 | async def read_thing(
|
||||
46 46 | author: str,
|
||||
47 |- query: str,
|
||||
47 |+ query: str, page,
|
||||
48 48 | ): ...
|
||||
49 49 |
|
||||
50 50 |
|
||||
44 | @app.get("/books/{author}/{title}/{page}")
|
||||
45 | async def read_thing(
|
||||
46 | author: str,
|
||||
- query: str,
|
||||
47 + query: str, page,
|
||||
48 | ): ...
|
||||
49 |
|
||||
50 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `author` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:51:18
|
||||
|
|
@ -209,16 +200,15 @@ FAST003 [*] Parameter `author` appears in route path, but not in `read_thing` si
|
|||
53 | ...
|
||||
|
|
||||
help: Add `author` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
49 49 |
|
||||
50 50 |
|
||||
51 51 | @app.get("/books/{author}/{title}")
|
||||
52 |-async def read_thing():
|
||||
52 |+async def read_thing(author):
|
||||
53 53 | ...
|
||||
54 54 |
|
||||
55 55 |
|
||||
49 |
|
||||
50 |
|
||||
51 | @app.get("/books/{author}/{title}")
|
||||
- async def read_thing():
|
||||
52 + async def read_thing(author):
|
||||
53 | ...
|
||||
54 |
|
||||
55 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:51:27
|
||||
|
|
@ -229,16 +219,15 @@ FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` sig
|
|||
53 | ...
|
||||
|
|
||||
help: Add `title` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
49 49 |
|
||||
50 50 |
|
||||
51 51 | @app.get("/books/{author}/{title}")
|
||||
52 |-async def read_thing():
|
||||
52 |+async def read_thing(title):
|
||||
53 53 | ...
|
||||
54 54 |
|
||||
55 55 |
|
||||
49 |
|
||||
50 |
|
||||
51 | @app.get("/books/{author}/{title}")
|
||||
- async def read_thing():
|
||||
52 + async def read_thing(title):
|
||||
53 | ...
|
||||
54 |
|
||||
55 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:56:27
|
||||
|
|
@ -249,16 +238,15 @@ FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` sig
|
|||
58 | ...
|
||||
|
|
||||
help: Add `title` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
54 54 |
|
||||
55 55 |
|
||||
56 56 | @app.get("/books/{author}/{title}")
|
||||
57 |-async def read_thing(*, author: str):
|
||||
57 |+async def read_thing(title, *, author: str):
|
||||
58 58 | ...
|
||||
59 59 |
|
||||
60 60 |
|
||||
54 |
|
||||
55 |
|
||||
56 | @app.get("/books/{author}/{title}")
|
||||
- async def read_thing(*, author: str):
|
||||
57 + async def read_thing(title, *, author: str):
|
||||
58 | ...
|
||||
59 |
|
||||
60 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:61:27
|
||||
|
|
@ -269,16 +257,15 @@ FAST003 [*] Parameter `title` appears in route path, but not in `read_thing` sig
|
|||
63 | ...
|
||||
|
|
||||
help: Add `title` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
59 59 |
|
||||
60 60 |
|
||||
61 61 | @app.get("/books/{author}/{title}")
|
||||
62 |-async def read_thing(hello, /, *, author: str):
|
||||
62 |+async def read_thing(hello, /, title, *, author: str):
|
||||
63 63 | ...
|
||||
64 64 |
|
||||
65 65 |
|
||||
59 |
|
||||
60 |
|
||||
61 | @app.get("/books/{author}/{title}")
|
||||
- async def read_thing(hello, /, *, author: str):
|
||||
62 + async def read_thing(hello, /, title, *, author: str):
|
||||
63 | ...
|
||||
64 |
|
||||
65 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:66:19
|
||||
|
|
@ -289,16 +276,15 @@ FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing`
|
|||
68 | query: str,
|
||||
|
|
||||
help: Add `thing_id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
65 65 |
|
||||
66 66 | @app.get("/things/{thing_id}")
|
||||
67 67 | async def read_thing(
|
||||
68 |- query: str,
|
||||
68 |+ query: str, thing_id,
|
||||
69 69 | ):
|
||||
70 70 | return {"query": query}
|
||||
71 71 |
|
||||
65 |
|
||||
66 | @app.get("/things/{thing_id}")
|
||||
67 | async def read_thing(
|
||||
- query: str,
|
||||
68 + query: str, thing_id,
|
||||
69 | ):
|
||||
70 | return {"query": query}
|
||||
71 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:73:19
|
||||
|
|
@ -309,16 +295,15 @@ FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing`
|
|||
75 | query: str = "default",
|
||||
|
|
||||
help: Add `thing_id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
72 72 |
|
||||
73 73 | @app.get("/things/{thing_id}")
|
||||
74 74 | async def read_thing(
|
||||
75 |- query: str = "default",
|
||||
75 |+ thing_id, query: str = "default",
|
||||
76 76 | ):
|
||||
77 77 | return {"query": query}
|
||||
78 78 |
|
||||
72 |
|
||||
73 | @app.get("/things/{thing_id}")
|
||||
74 | async def read_thing(
|
||||
- query: str = "default",
|
||||
75 + thing_id, query: str = "default",
|
||||
76 | ):
|
||||
77 | return {"query": query}
|
||||
78 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:80:19
|
||||
|
|
@ -329,16 +314,15 @@ FAST003 [*] Parameter `thing_id` appears in route path, but not in `read_thing`
|
|||
82 | *, query: str = "default",
|
||||
|
|
||||
help: Add `thing_id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
79 79 |
|
||||
80 80 | @app.get("/things/{thing_id}")
|
||||
81 81 | async def read_thing(
|
||||
82 |- *, query: str = "default",
|
||||
82 |+ thing_id, *, query: str = "default",
|
||||
83 83 | ):
|
||||
84 84 | return {"query": query}
|
||||
85 85 |
|
||||
79 |
|
||||
80 | @app.get("/things/{thing_id}")
|
||||
81 | async def read_thing(
|
||||
- *, query: str = "default",
|
||||
82 + thing_id, *, query: str = "default",
|
||||
83 | ):
|
||||
84 | return {"query": query}
|
||||
85 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `name` appears in route path, but not in `read_thing` signature
|
||||
--> FAST003.py:87:18
|
||||
|
|
@ -349,16 +333,15 @@ FAST003 [*] Parameter `name` appears in route path, but not in `read_thing` sign
|
|||
89 | return {"author": author, "title": title}
|
||||
|
|
||||
help: Add `name` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
85 85 |
|
||||
86 86 |
|
||||
87 87 | @app.get("/books/{name}/{title}")
|
||||
88 |-async def read_thing(*, author: Annotated[str, Path(alias="author_name")], title: str):
|
||||
88 |+async def read_thing(name, *, author: Annotated[str, Path(alias="author_name")], title: str):
|
||||
89 89 | return {"author": author, "title": title}
|
||||
90 90 |
|
||||
91 91 |
|
||||
85 |
|
||||
86 |
|
||||
87 | @app.get("/books/{name}/{title}")
|
||||
- async def read_thing(*, author: Annotated[str, Path(alias="author_name")], title: str):
|
||||
88 + async def read_thing(name, *, author: Annotated[str, Path(alias="author_name")], title: str):
|
||||
89 | return {"author": author, "title": title}
|
||||
90 |
|
||||
91 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `thing_id` appears in route path, but not in `single` signature
|
||||
--> FAST003.py:158:19
|
||||
|
|
@ -370,16 +353,15 @@ FAST003 [*] Parameter `thing_id` appears in route path, but not in `single` sign
|
|||
160 | @app.get("/things/{thing_id}")
|
||||
|
|
||||
help: Add `thing_id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
156 156 |
|
||||
157 157 | ### Errors
|
||||
158 158 | @app.get("/things/{thing_id}")
|
||||
159 |-async def single(other: Annotated[str, Depends(something_else)]): ...
|
||||
159 |+async def single(other: Annotated[str, Depends(something_else)], thing_id): ...
|
||||
160 160 | @app.get("/things/{thing_id}")
|
||||
161 161 | async def default(other: str = Depends(something_else)): ...
|
||||
162 162 |
|
||||
156 |
|
||||
157 | ### Errors
|
||||
158 | @app.get("/things/{thing_id}")
|
||||
- async def single(other: Annotated[str, Depends(something_else)]): ...
|
||||
159 + async def single(other: Annotated[str, Depends(something_else)], thing_id): ...
|
||||
160 | @app.get("/things/{thing_id}")
|
||||
161 | async def default(other: str = Depends(something_else)): ...
|
||||
162 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `thing_id` appears in route path, but not in `default` signature
|
||||
--> FAST003.py:160:19
|
||||
|
|
@ -391,16 +373,15 @@ FAST003 [*] Parameter `thing_id` appears in route path, but not in `default` sig
|
|||
161 | async def default(other: str = Depends(something_else)): ...
|
||||
|
|
||||
help: Add `thing_id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
158 158 | @app.get("/things/{thing_id}")
|
||||
159 159 | async def single(other: Annotated[str, Depends(something_else)]): ...
|
||||
160 160 | @app.get("/things/{thing_id}")
|
||||
161 |-async def default(other: str = Depends(something_else)): ...
|
||||
161 |+async def default(thing_id, other: str = Depends(something_else)): ...
|
||||
162 162 |
|
||||
163 163 |
|
||||
164 164 | ### No errors
|
||||
158 | @app.get("/things/{thing_id}")
|
||||
159 | async def single(other: Annotated[str, Depends(something_else)]): ...
|
||||
160 | @app.get("/things/{thing_id}")
|
||||
- async def default(other: str = Depends(something_else)): ...
|
||||
161 + async def default(thing_id, other: str = Depends(something_else)): ...
|
||||
162 |
|
||||
163 |
|
||||
164 | ### No errors
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `id` appears in route path, but not in `get_id_pydantic_full` signature
|
||||
--> FAST003.py:197:12
|
||||
|
|
@ -412,16 +393,15 @@ FAST003 [*] Parameter `id` appears in route path, but not in `get_id_pydantic_fu
|
|||
199 | params: Annotated[PydanticParams, Depends(PydanticParams)],
|
||||
|
|
||||
help: Add `id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
196 196 | # Errors
|
||||
197 197 | @app.get("/{id}")
|
||||
198 198 | async def get_id_pydantic_full(
|
||||
199 |- params: Annotated[PydanticParams, Depends(PydanticParams)],
|
||||
199 |+ params: Annotated[PydanticParams, Depends(PydanticParams)], id,
|
||||
200 200 | ): ...
|
||||
201 201 | @app.get("/{id}")
|
||||
202 202 | async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()]): ...
|
||||
196 | # Errors
|
||||
197 | @app.get("/{id}")
|
||||
198 | async def get_id_pydantic_full(
|
||||
- params: Annotated[PydanticParams, Depends(PydanticParams)],
|
||||
199 + params: Annotated[PydanticParams, Depends(PydanticParams)], id,
|
||||
200 | ): ...
|
||||
201 | @app.get("/{id}")
|
||||
202 | async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()]): ...
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `id` appears in route path, but not in `get_id_pydantic_short` signature
|
||||
--> FAST003.py:201:12
|
||||
|
|
@ -434,16 +414,15 @@ FAST003 [*] Parameter `id` appears in route path, but not in `get_id_pydantic_sh
|
|||
203 | @app.get("/{id}")
|
||||
|
|
||||
help: Add `id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
199 199 | params: Annotated[PydanticParams, Depends(PydanticParams)],
|
||||
200 200 | ): ...
|
||||
201 201 | @app.get("/{id}")
|
||||
202 |-async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()]): ...
|
||||
202 |+async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()], id): ...
|
||||
203 203 | @app.get("/{id}")
|
||||
204 204 | async def get_id_init_not_annotated(params = Depends(InitParams)): ...
|
||||
205 205 |
|
||||
199 | params: Annotated[PydanticParams, Depends(PydanticParams)],
|
||||
200 | ): ...
|
||||
201 | @app.get("/{id}")
|
||||
- async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()]): ...
|
||||
202 + async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()], id): ...
|
||||
203 | @app.get("/{id}")
|
||||
204 | async def get_id_init_not_annotated(params = Depends(InitParams)): ...
|
||||
205 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
FAST003 [*] Parameter `id` appears in route path, but not in `get_id_init_not_annotated` signature
|
||||
--> FAST003.py:203:12
|
||||
|
|
@ -455,13 +434,12 @@ FAST003 [*] Parameter `id` appears in route path, but not in `get_id_init_not_an
|
|||
204 | async def get_id_init_not_annotated(params = Depends(InitParams)): ...
|
||||
|
|
||||
help: Add `id` to function signature
|
||||
|
||||
ℹ Unsafe fix
|
||||
201 201 | @app.get("/{id}")
|
||||
202 202 | async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()]): ...
|
||||
203 203 | @app.get("/{id}")
|
||||
204 |-async def get_id_init_not_annotated(params = Depends(InitParams)): ...
|
||||
204 |+async def get_id_init_not_annotated(id, params = Depends(InitParams)): ...
|
||||
205 205 |
|
||||
206 206 |
|
||||
207 207 | # No errors
|
||||
201 | @app.get("/{id}")
|
||||
202 | async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()]): ...
|
||||
203 | @app.get("/{id}")
|
||||
- async def get_id_init_not_annotated(params = Depends(InitParams)): ...
|
||||
204 + async def get_id_init_not_annotated(id, params = Depends(InitParams)): ...
|
||||
205 |
|
||||
206 |
|
||||
207 | # No errors
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -9,13 +9,12 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
2 | return 1
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-def func():
|
||||
1 |+def func() -> int:
|
||||
2 2 | return 1
|
||||
3 3 |
|
||||
4 4 |
|
||||
- def func():
|
||||
1 + def func() -> int:
|
||||
2 | return 1
|
||||
3 |
|
||||
4 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:5:5
|
||||
|
|
@ -25,16 +24,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
6 | return 1.5
|
||||
|
|
||||
help: Add return type annotation: `float`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | return 1
|
||||
3 3 |
|
||||
4 4 |
|
||||
5 |-def func():
|
||||
5 |+def func() -> float:
|
||||
6 6 | return 1.5
|
||||
7 7 |
|
||||
8 8 |
|
||||
2 | return 1
|
||||
3 |
|
||||
4 |
|
||||
- def func():
|
||||
5 + def func() -> float:
|
||||
6 | return 1.5
|
||||
7 |
|
||||
8 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:9:5
|
||||
|
|
@ -45,16 +43,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
11 | return 1
|
||||
|
|
||||
help: Add return type annotation: `float`
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 | return 1.5
|
||||
7 7 |
|
||||
8 8 |
|
||||
9 |-def func(x: int):
|
||||
9 |+def func(x: int) -> float:
|
||||
10 10 | if x > 0:
|
||||
11 11 | return 1
|
||||
12 12 | else:
|
||||
6 | return 1.5
|
||||
7 |
|
||||
8 |
|
||||
- def func(x: int):
|
||||
9 + def func(x: int) -> float:
|
||||
10 | if x > 0:
|
||||
11 | return 1
|
||||
12 | else:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:16:5
|
||||
|
|
@ -64,16 +61,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
17 | return True
|
||||
|
|
||||
help: Add return type annotation: `bool`
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 | return 1.5
|
||||
14 14 |
|
||||
15 15 |
|
||||
16 |-def func():
|
||||
16 |+def func() -> bool:
|
||||
17 17 | return True
|
||||
18 18 |
|
||||
19 19 |
|
||||
13 | return 1.5
|
||||
14 |
|
||||
15 |
|
||||
- def func():
|
||||
16 + def func() -> bool:
|
||||
17 | return True
|
||||
18 |
|
||||
19 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:20:5
|
||||
|
|
@ -84,16 +80,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
22 | return None
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 | return True
|
||||
18 18 |
|
||||
19 19 |
|
||||
20 |-def func(x: int):
|
||||
20 |+def func(x: int) -> None:
|
||||
21 21 | if x > 0:
|
||||
22 22 | return None
|
||||
23 23 | else:
|
||||
17 | return True
|
||||
18 |
|
||||
19 |
|
||||
- def func(x: int):
|
||||
20 + def func(x: int) -> None:
|
||||
21 | if x > 0:
|
||||
22 | return None
|
||||
23 | else:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:27:5
|
||||
|
|
@ -103,16 +98,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
28 | return 1 or 2.5 if x > 0 else 1.5 or "str"
|
||||
|
|
||||
help: Add return type annotation: `str | float`
|
||||
|
||||
ℹ Unsafe fix
|
||||
24 24 | return
|
||||
25 25 |
|
||||
26 26 |
|
||||
27 |-def func(x: int):
|
||||
27 |+def func(x: int) -> str | float:
|
||||
28 28 | return 1 or 2.5 if x > 0 else 1.5 or "str"
|
||||
29 29 |
|
||||
30 30 |
|
||||
24 | return
|
||||
25 |
|
||||
26 |
|
||||
- def func(x: int):
|
||||
27 + def func(x: int) -> str | float:
|
||||
28 | return 1 or 2.5 if x > 0 else 1.5 or "str"
|
||||
29 |
|
||||
30 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:31:5
|
||||
|
|
@ -122,16 +116,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
32 | return 1 + 2.5 if x > 0 else 1.5 or "str"
|
||||
|
|
||||
help: Add return type annotation: `str | float`
|
||||
|
||||
ℹ Unsafe fix
|
||||
28 28 | return 1 or 2.5 if x > 0 else 1.5 or "str"
|
||||
29 29 |
|
||||
30 30 |
|
||||
31 |-def func(x: int):
|
||||
31 |+def func(x: int) -> str | float:
|
||||
32 32 | return 1 + 2.5 if x > 0 else 1.5 or "str"
|
||||
33 33 |
|
||||
34 34 |
|
||||
28 | return 1 or 2.5 if x > 0 else 1.5 or "str"
|
||||
29 |
|
||||
30 |
|
||||
- def func(x: int):
|
||||
31 + def func(x: int) -> str | float:
|
||||
32 | return 1 + 2.5 if x > 0 else 1.5 or "str"
|
||||
33 |
|
||||
34 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:35:5
|
||||
|
|
@ -161,16 +154,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
47 | return 1
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
42 42 | return {"foo": 1}
|
||||
43 43 |
|
||||
44 44 |
|
||||
45 |-def func(x: int):
|
||||
45 |+def func(x: int) -> int:
|
||||
46 46 | if not x:
|
||||
47 47 | return 1
|
||||
48 48 | else:
|
||||
42 | return {"foo": 1}
|
||||
43 |
|
||||
44 |
|
||||
- def func(x: int):
|
||||
45 + def func(x: int) -> int:
|
||||
46 | if not x:
|
||||
47 | return 1
|
||||
48 | else:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:52:5
|
||||
|
|
@ -181,16 +173,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
54 | return 1
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
49 49 | return True
|
||||
50 50 |
|
||||
51 51 |
|
||||
52 |-def func(x: int):
|
||||
52 |+def func(x: int) -> int | None:
|
||||
53 53 | if not x:
|
||||
54 54 | return 1
|
||||
55 55 | else:
|
||||
49 | return True
|
||||
50 |
|
||||
51 |
|
||||
- def func(x: int):
|
||||
52 + def func(x: int) -> int | None:
|
||||
53 | if not x:
|
||||
54 | return 1
|
||||
55 | else:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:59:5
|
||||
|
|
@ -201,16 +192,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
61 | return 1
|
||||
|
|
||||
help: Add return type annotation: `str | int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
56 56 | return None
|
||||
57 57 |
|
||||
58 58 |
|
||||
59 |-def func(x: int):
|
||||
59 |+def func(x: int) -> str | int | None:
|
||||
60 60 | if not x:
|
||||
61 61 | return 1
|
||||
62 62 | elif x > 5:
|
||||
56 | return None
|
||||
57 |
|
||||
58 |
|
||||
- def func(x: int):
|
||||
59 + def func(x: int) -> str | int | None:
|
||||
60 | if not x:
|
||||
61 | return 1
|
||||
62 | elif x > 5:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:68:5
|
||||
|
|
@ -221,16 +211,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
70 | return 1
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
65 65 | return None
|
||||
66 66 |
|
||||
67 67 |
|
||||
68 |-def func(x: int):
|
||||
68 |+def func(x: int) -> int | None:
|
||||
69 69 | if x:
|
||||
70 70 | return 1
|
||||
71 71 |
|
||||
65 | return None
|
||||
66 |
|
||||
67 |
|
||||
- def func(x: int):
|
||||
68 + def func(x: int) -> int | None:
|
||||
69 | if x:
|
||||
70 | return 1
|
||||
71 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:73:5
|
||||
|
|
@ -240,16 +229,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
74 | x = 1
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
70 70 | return 1
|
||||
71 71 |
|
||||
72 72 |
|
||||
73 |-def func():
|
||||
73 |+def func() -> None:
|
||||
74 74 | x = 1
|
||||
75 75 |
|
||||
76 76 |
|
||||
70 | return 1
|
||||
71 |
|
||||
72 |
|
||||
- def func():
|
||||
73 + def func() -> None:
|
||||
74 | x = 1
|
||||
75 |
|
||||
76 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:77:5
|
||||
|
|
@ -260,16 +248,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
79 | return 1
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
74 74 | x = 1
|
||||
75 75 |
|
||||
76 76 |
|
||||
77 |-def func(x: int):
|
||||
77 |+def func(x: int) -> int | None:
|
||||
78 78 | if x > 0:
|
||||
79 79 | return 1
|
||||
80 80 |
|
||||
74 | x = 1
|
||||
75 |
|
||||
76 |
|
||||
- def func(x: int):
|
||||
77 + def func(x: int) -> int | None:
|
||||
78 | if x > 0:
|
||||
79 | return 1
|
||||
80 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:82:5
|
||||
|
|
@ -280,16 +267,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
84 | case [1, 2, 3]:
|
||||
|
|
||||
help: Add return type annotation: `str | int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
79 79 | return 1
|
||||
80 80 |
|
||||
81 81 |
|
||||
82 |-def func(x: int):
|
||||
82 |+def func(x: int) -> str | int | None:
|
||||
83 83 | match x:
|
||||
84 84 | case [1, 2, 3]:
|
||||
85 85 | return 1
|
||||
79 | return 1
|
||||
80 |
|
||||
81 |
|
||||
- def func(x: int):
|
||||
82 + def func(x: int) -> str | int | None:
|
||||
83 | match x:
|
||||
84 | case [1, 2, 3]:
|
||||
85 | return 1
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:90:5
|
||||
|
|
@ -300,16 +286,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
92 | if i > 0:
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
87 87 | return "foo"
|
||||
88 88 |
|
||||
89 89 |
|
||||
90 |-def func(x: int):
|
||||
90 |+def func(x: int) -> int | None:
|
||||
91 91 | for i in range(5):
|
||||
92 92 | if i > 0:
|
||||
93 93 | return 1
|
||||
87 | return "foo"
|
||||
88 |
|
||||
89 |
|
||||
- def func(x: int):
|
||||
90 + def func(x: int) -> int | None:
|
||||
91 | for i in range(5):
|
||||
92 | if i > 0:
|
||||
93 | return 1
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:96:5
|
||||
|
|
@ -320,16 +305,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
98 | if i > 0:
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
93 93 | return 1
|
||||
94 94 |
|
||||
95 95 |
|
||||
96 |-def func(x: int):
|
||||
96 |+def func(x: int) -> int:
|
||||
97 97 | for i in range(5):
|
||||
98 98 | if i > 0:
|
||||
99 99 | return 1
|
||||
93 | return 1
|
||||
94 |
|
||||
95 |
|
||||
- def func(x: int):
|
||||
96 + def func(x: int) -> int:
|
||||
97 | for i in range(5):
|
||||
98 | if i > 0:
|
||||
99 | return 1
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:104:5
|
||||
|
|
@ -340,16 +324,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
106 | if i > 0:
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
101 101 | return 4
|
||||
102 102 |
|
||||
103 103 |
|
||||
104 |-def func(x: int):
|
||||
104 |+def func(x: int) -> int | None:
|
||||
105 105 | for i in range(5):
|
||||
106 106 | if i > 0:
|
||||
107 107 | break
|
||||
101 | return 4
|
||||
102 |
|
||||
103 |
|
||||
- def func(x: int):
|
||||
104 + def func(x: int) -> int | None:
|
||||
105 | for i in range(5):
|
||||
106 | if i > 0:
|
||||
107 | break
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:112:5
|
||||
|
|
@ -360,16 +343,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
114 | pass
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
109 109 | return 4
|
||||
110 110 |
|
||||
111 111 |
|
||||
112 |-def func(x: int):
|
||||
112 |+def func(x: int) -> int | None:
|
||||
113 113 | try:
|
||||
114 114 | pass
|
||||
115 115 | except:
|
||||
109 | return 4
|
||||
110 |
|
||||
111 |
|
||||
- def func(x: int):
|
||||
112 + def func(x: int) -> int | None:
|
||||
113 | try:
|
||||
114 | pass
|
||||
115 | except:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:119:5
|
||||
|
|
@ -380,16 +362,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
121 | pass
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
116 116 | return 1
|
||||
117 117 |
|
||||
118 118 |
|
||||
119 |-def func(x: int):
|
||||
119 |+def func(x: int) -> int:
|
||||
120 120 | try:
|
||||
121 121 | pass
|
||||
122 122 | except:
|
||||
116 | return 1
|
||||
117 |
|
||||
118 |
|
||||
- def func(x: int):
|
||||
119 + def func(x: int) -> int:
|
||||
120 | try:
|
||||
121 | pass
|
||||
122 | except:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:128:5
|
||||
|
|
@ -400,16 +381,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
130 | pass
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
125 125 | return 2
|
||||
126 126 |
|
||||
127 127 |
|
||||
128 |-def func(x: int):
|
||||
128 |+def func(x: int) -> int:
|
||||
129 129 | try:
|
||||
130 130 | pass
|
||||
131 131 | except:
|
||||
125 | return 2
|
||||
126 |
|
||||
127 |
|
||||
- def func(x: int):
|
||||
128 + def func(x: int) -> int:
|
||||
129 | try:
|
||||
130 | pass
|
||||
131 | except:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:137:5
|
||||
|
|
@ -420,16 +400,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
139 | return 1
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
134 134 | return 2
|
||||
135 135 |
|
||||
136 136 |
|
||||
137 |-def func(x: int):
|
||||
137 |+def func(x: int) -> int | None:
|
||||
138 138 | try:
|
||||
139 139 | return 1
|
||||
140 140 | except:
|
||||
134 | return 2
|
||||
135 |
|
||||
136 |
|
||||
- def func(x: int):
|
||||
137 + def func(x: int) -> int | None:
|
||||
138 | try:
|
||||
139 | return 1
|
||||
140 | except:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:146:5
|
||||
|
|
@ -440,16 +419,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
148 | break
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
143 143 | pass
|
||||
144 144 |
|
||||
145 145 |
|
||||
146 |-def func(x: int):
|
||||
146 |+def func(x: int) -> int | None:
|
||||
147 147 | while x > 0:
|
||||
148 148 | break
|
||||
149 149 | return 1
|
||||
143 | pass
|
||||
144 |
|
||||
145 |
|
||||
- def func(x: int):
|
||||
146 + def func(x: int) -> int | None:
|
||||
147 | while x > 0:
|
||||
148 | break
|
||||
149 | return 1
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 Missing return type annotation for public function `method`
|
||||
--> auto_return_type.py:158:9
|
||||
|
|
@ -514,16 +492,15 @@ ANN201 [*] Missing return type annotation for public function `method`
|
|||
182 | return 1
|
||||
|
|
||||
help: Add return type annotation: `float`
|
||||
|
||||
ℹ Unsafe fix
|
||||
177 177 | pass
|
||||
178 178 |
|
||||
179 179 | @abstractmethod
|
||||
180 |- def method(self):
|
||||
180 |+ def method(self) -> float:
|
||||
181 181 | if self.x > 0:
|
||||
182 182 | return 1
|
||||
183 183 | else:
|
||||
177 | pass
|
||||
178 |
|
||||
179 | @abstractmethod
|
||||
- def method(self):
|
||||
180 + def method(self) -> float:
|
||||
181 | if self.x > 0:
|
||||
182 | return 1
|
||||
183 | else:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:187:5
|
||||
|
|
@ -534,16 +511,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
189 | pass
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
184 184 | return 1.5
|
||||
185 185 |
|
||||
186 186 |
|
||||
187 |-def func(x: int):
|
||||
187 |+def func(x: int) -> int | None:
|
||||
188 188 | try:
|
||||
189 189 | pass
|
||||
190 190 | except:
|
||||
184 | return 1.5
|
||||
185 |
|
||||
186 |
|
||||
- def func(x: int):
|
||||
187 + def func(x: int) -> int | None:
|
||||
188 | try:
|
||||
189 | pass
|
||||
190 | except:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:194:5
|
||||
|
|
@ -554,16 +530,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
196 | pass
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
191 191 | return 2
|
||||
192 192 |
|
||||
193 193 |
|
||||
194 |-def func(x: int):
|
||||
194 |+def func(x: int) -> int:
|
||||
195 195 | try:
|
||||
196 196 | pass
|
||||
197 197 | except:
|
||||
191 | return 2
|
||||
192 |
|
||||
193 |
|
||||
- def func(x: int):
|
||||
194 + def func(x: int) -> int:
|
||||
195 | try:
|
||||
196 | pass
|
||||
197 | except:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:203:5
|
||||
|
|
@ -574,24 +549,23 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
205 | raise ValueError
|
||||
|
|
||||
help: Add return type annotation: `Never`
|
||||
|
||||
ℹ Unsafe fix
|
||||
151 151 |
|
||||
152 152 | import abc
|
||||
153 153 | from abc import abstractmethod
|
||||
154 |+from typing import Never
|
||||
154 155 |
|
||||
155 156 |
|
||||
156 157 | class Foo(abc.ABC):
|
||||
151 |
|
||||
152 | import abc
|
||||
153 | from abc import abstractmethod
|
||||
154 + from typing import Never
|
||||
155 |
|
||||
156 |
|
||||
157 | class Foo(abc.ABC):
|
||||
--------------------------------------------------------------------------------
|
||||
200 201 | return 3
|
||||
201 202 |
|
||||
202 203 |
|
||||
203 |-def func(x: int):
|
||||
204 |+def func(x: int) -> Never:
|
||||
204 205 | if not x:
|
||||
205 206 | raise ValueError
|
||||
206 207 | else:
|
||||
201 | return 3
|
||||
202 |
|
||||
203 |
|
||||
- def func(x: int):
|
||||
204 + def func(x: int) -> Never:
|
||||
205 | if not x:
|
||||
206 | raise ValueError
|
||||
207 | else:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:210:5
|
||||
|
|
@ -602,16 +576,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
212 | raise ValueError
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
207 207 | raise TypeError
|
||||
208 208 |
|
||||
209 209 |
|
||||
210 |-def func(x: int):
|
||||
210 |+def func(x: int) -> int:
|
||||
211 211 | if not x:
|
||||
212 212 | raise ValueError
|
||||
213 213 | else:
|
||||
207 | raise TypeError
|
||||
208 |
|
||||
209 |
|
||||
- def func(x: int):
|
||||
210 + def func(x: int) -> int:
|
||||
211 | if not x:
|
||||
212 | raise ValueError
|
||||
213 | else:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:234:5
|
||||
|
|
@ -622,16 +595,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
236 | return 1
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
231 231 | return i
|
||||
232 232 |
|
||||
233 233 |
|
||||
234 |-def func(x: int):
|
||||
234 |+def func(x: int) -> int:
|
||||
235 235 | if not x:
|
||||
236 236 | return 1
|
||||
237 237 | raise ValueError
|
||||
231 | return i
|
||||
232 |
|
||||
233 |
|
||||
- def func(x: int):
|
||||
234 + def func(x: int) -> int:
|
||||
235 | if not x:
|
||||
236 | return 1
|
||||
237 | raise ValueError
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:240:5
|
||||
|
|
@ -642,16 +614,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
242 | return 1
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
237 237 | raise ValueError
|
||||
238 238 |
|
||||
239 239 |
|
||||
240 |-def func(x: int):
|
||||
240 |+def func(x: int) -> int:
|
||||
241 241 | if not x:
|
||||
242 242 | return 1
|
||||
243 243 | else:
|
||||
237 | raise ValueError
|
||||
238 |
|
||||
239 |
|
||||
- def func(x: int):
|
||||
240 + def func(x: int) -> int:
|
||||
241 | if not x:
|
||||
242 | return 1
|
||||
243 | else:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:248:5
|
||||
|
|
@ -662,16 +633,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
250 | raise ValueError
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
245 245 | raise ValueError
|
||||
246 246 |
|
||||
247 247 |
|
||||
248 |-def func():
|
||||
248 |+def func() -> int | None:
|
||||
249 249 | try:
|
||||
250 250 | raise ValueError
|
||||
251 251 | except:
|
||||
245 | raise ValueError
|
||||
246 |
|
||||
247 |
|
||||
- def func():
|
||||
248 + def func() -> int | None:
|
||||
249 | try:
|
||||
250 | raise ValueError
|
||||
251 | except:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:255:5
|
||||
|
|
@ -682,16 +652,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
257 | return 1
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
252 252 | return 2
|
||||
253 253 |
|
||||
254 254 |
|
||||
255 |-def func():
|
||||
255 |+def func() -> int | None:
|
||||
256 256 | try:
|
||||
257 257 | return 1
|
||||
258 258 | except:
|
||||
252 | return 2
|
||||
253 |
|
||||
254 |
|
||||
- def func():
|
||||
255 + def func() -> int | None:
|
||||
256 | try:
|
||||
257 | return 1
|
||||
258 | except:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:262:5
|
||||
|
|
@ -702,16 +671,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
264 | if x > 0:
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
259 259 | pass
|
||||
260 260 |
|
||||
261 261 |
|
||||
262 |-def func(x: int):
|
||||
262 |+def func(x: int) -> int:
|
||||
263 263 | for _ in range(3):
|
||||
264 264 | if x > 0:
|
||||
265 265 | return 1
|
||||
259 | pass
|
||||
260 |
|
||||
261 |
|
||||
- def func(x: int):
|
||||
262 + def func(x: int) -> int:
|
||||
263 | for _ in range(3):
|
||||
264 | if x > 0:
|
||||
265 | return 1
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:269:5
|
||||
|
|
@ -722,16 +690,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
271 | raise ValueError
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
266 266 | raise ValueError
|
||||
267 267 |
|
||||
268 268 |
|
||||
269 |-def func(x: int):
|
||||
269 |+def func(x: int) -> None:
|
||||
270 270 | if x > 5:
|
||||
271 271 | raise ValueError
|
||||
272 272 | else:
|
||||
266 | raise ValueError
|
||||
267 |
|
||||
268 |
|
||||
- def func(x: int):
|
||||
269 + def func(x: int) -> None:
|
||||
270 | if x > 5:
|
||||
271 | raise ValueError
|
||||
272 | else:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:276:5
|
||||
|
|
@ -742,16 +709,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
278 | raise ValueError
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
273 273 | pass
|
||||
274 274 |
|
||||
275 275 |
|
||||
276 |-def func(x: int):
|
||||
276 |+def func(x: int) -> None:
|
||||
277 277 | if x > 5:
|
||||
278 278 | raise ValueError
|
||||
279 279 | elif x > 10:
|
||||
273 | pass
|
||||
274 |
|
||||
275 |
|
||||
- def func(x: int):
|
||||
276 + def func(x: int) -> None:
|
||||
277 | if x > 5:
|
||||
278 | raise ValueError
|
||||
279 | elif x > 10:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:283:5
|
||||
|
|
@ -762,16 +728,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
285 | raise ValueError
|
||||
|
|
||||
help: Add return type annotation: `int | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
280 280 | pass
|
||||
281 281 |
|
||||
282 282 |
|
||||
283 |-def func(x: int):
|
||||
283 |+def func(x: int) -> int | None:
|
||||
284 284 | if x > 5:
|
||||
285 285 | raise ValueError
|
||||
286 286 | elif x > 10:
|
||||
280 | pass
|
||||
281 |
|
||||
282 |
|
||||
- def func(x: int):
|
||||
283 + def func(x: int) -> int | None:
|
||||
284 | if x > 5:
|
||||
285 | raise ValueError
|
||||
286 | elif x > 10:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:290:5
|
||||
|
|
@ -782,16 +747,15 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
292 | return 5
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
287 287 | return 5
|
||||
288 288 |
|
||||
289 289 |
|
||||
290 |-def func():
|
||||
290 |+def func() -> int:
|
||||
291 291 | try:
|
||||
292 292 | return 5
|
||||
293 293 | except:
|
||||
287 | return 5
|
||||
288 |
|
||||
289 |
|
||||
- def func():
|
||||
290 + def func() -> int:
|
||||
291 | try:
|
||||
292 | return 5
|
||||
293 | except:
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `func`
|
||||
--> auto_return_type.py:299:5
|
||||
|
|
@ -802,13 +766,12 @@ ANN201 [*] Missing return type annotation for public function `func`
|
|||
301 | case [1, 2, 3]:
|
||||
|
|
||||
help: Add return type annotation: `str | int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
296 296 | raise ValueError
|
||||
297 297 |
|
||||
298 298 |
|
||||
299 |-def func(x: int):
|
||||
299 |+def func(x: int) -> str | int:
|
||||
300 300 | match x:
|
||||
301 301 | case [1, 2, 3]:
|
||||
302 302 | return 1
|
||||
296 | raise ValueError
|
||||
297 |
|
||||
298 |
|
||||
- def func(x: int):
|
||||
299 + def func(x: int) -> str | int:
|
||||
300 | match x:
|
||||
301 | case [1, 2, 3]:
|
||||
302 | return 1
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -10,16 +10,15 @@ ANN201 [*] Missing return type annotation for public function `foo`
|
|||
6 | pass
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | from typing_extensions import override
|
||||
3 3 |
|
||||
4 4 | # Error
|
||||
5 |-def foo(a, b):
|
||||
5 |+def foo(a, b) -> None:
|
||||
6 6 | pass
|
||||
7 7 |
|
||||
8 8 |
|
||||
2 | from typing_extensions import override
|
||||
3 |
|
||||
4 | # Error
|
||||
- def foo(a, b):
|
||||
5 + def foo(a, b) -> None:
|
||||
6 | pass
|
||||
7 |
|
||||
8 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN001 Missing type annotation for function argument `a`
|
||||
--> annotation_presence.py:5:9
|
||||
|
|
@ -48,16 +47,15 @@ ANN201 [*] Missing return type annotation for public function `foo`
|
|||
11 | pass
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 |
|
||||
8 8 |
|
||||
9 9 | # Error
|
||||
10 |-def foo(a: int, b):
|
||||
10 |+def foo(a: int, b) -> None:
|
||||
11 11 | pass
|
||||
12 12 |
|
||||
13 13 |
|
||||
7 |
|
||||
8 |
|
||||
9 | # Error
|
||||
- def foo(a: int, b):
|
||||
10 + def foo(a: int, b) -> None:
|
||||
11 | pass
|
||||
12 |
|
||||
13 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN001 Missing type annotation for function argument `b`
|
||||
--> annotation_presence.py:10:17
|
||||
|
|
@ -86,16 +84,15 @@ ANN201 [*] Missing return type annotation for public function `foo`
|
|||
21 | pass
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 |
|
||||
18 18 |
|
||||
19 19 | # Error
|
||||
20 |-def foo(a: int, b: int):
|
||||
20 |+def foo(a: int, b: int) -> None:
|
||||
21 21 | pass
|
||||
22 22 |
|
||||
23 23 |
|
||||
17 |
|
||||
18 |
|
||||
19 | # Error
|
||||
- def foo(a: int, b: int):
|
||||
20 + def foo(a: int, b: int) -> None:
|
||||
21 | pass
|
||||
22 |
|
||||
23 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `foo`
|
||||
--> annotation_presence.py:25:5
|
||||
|
|
@ -106,16 +103,15 @@ ANN201 [*] Missing return type annotation for public function `foo`
|
|||
26 | pass
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 |
|
||||
23 23 |
|
||||
24 24 | # Error
|
||||
25 |-def foo():
|
||||
25 |+def foo() -> None:
|
||||
26 26 | pass
|
||||
27 27 |
|
||||
28 28 |
|
||||
22 |
|
||||
23 |
|
||||
24 | # Error
|
||||
- def foo():
|
||||
25 + def foo() -> None:
|
||||
26 | pass
|
||||
27 |
|
||||
28 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a`
|
||||
--> annotation_presence.py:45:12
|
||||
|
|
@ -297,16 +293,15 @@ ANN204 [*] Missing return type annotation for special method `__init__`
|
|||
160 | ...
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
156 156 |
|
||||
157 157 | class Foo:
|
||||
158 158 | @decorator()
|
||||
159 |- def __init__(self: "Foo", foo: int):
|
||||
159 |+ def __init__(self: "Foo", foo: int) -> None:
|
||||
160 160 | ...
|
||||
161 161 |
|
||||
162 162 |
|
||||
156 |
|
||||
157 | class Foo:
|
||||
158 | @decorator()
|
||||
- def __init__(self: "Foo", foo: int):
|
||||
159 + def __init__(self: "Foo", foo: int) -> None:
|
||||
160 | ...
|
||||
161 |
|
||||
162 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
--> annotation_presence.py:165:9
|
||||
|
|
@ -318,11 +313,10 @@ ANN204 [*] Missing return type annotation for special method `__init__`
|
|||
166 | print(f"{self.attr=}")
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
162 162 |
|
||||
163 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711
|
||||
164 164 | class Class:
|
||||
165 |- def __init__(self):
|
||||
165 |+ def __init__(self) -> None:
|
||||
166 166 | print(f"{self.attr=}")
|
||||
162 |
|
||||
163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711
|
||||
164 | class Class:
|
||||
- def __init__(self):
|
||||
165 + def __init__(self) -> None:
|
||||
166 | print(f"{self.attr=}")
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -9,16 +9,15 @@ ANN201 [*] Missing return type annotation for public function `error_partially_t
|
|||
25 | pass
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
21 21 | pass
|
||||
22 22 |
|
||||
23 23 |
|
||||
24 |-def error_partially_typed_1(a: int, b):
|
||||
24 |+def error_partially_typed_1(a: int, b) -> None:
|
||||
25 25 | pass
|
||||
26 26 |
|
||||
27 27 |
|
||||
21 | pass
|
||||
22 |
|
||||
23 |
|
||||
- def error_partially_typed_1(a: int, b):
|
||||
24 + def error_partially_typed_1(a: int, b) -> None:
|
||||
25 | pass
|
||||
26 |
|
||||
27 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN001 Missing type annotation for function argument `b`
|
||||
--> ignore_fully_untyped.py:24:37
|
||||
|
|
@ -44,16 +43,15 @@ ANN201 [*] Missing return type annotation for public function `error_partially_t
|
|||
33 | pass
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 | pass
|
||||
30 30 |
|
||||
31 31 |
|
||||
32 |-def error_partially_typed_3(a: int, b: int):
|
||||
32 |+def error_partially_typed_3(a: int, b: int) -> None:
|
||||
33 33 | pass
|
||||
34 34 |
|
||||
35 35 |
|
||||
29 | pass
|
||||
30 |
|
||||
31 |
|
||||
- def error_partially_typed_3(a: int, b: int):
|
||||
32 + def error_partially_typed_3(a: int, b: int) -> None:
|
||||
33 | pass
|
||||
34 |
|
||||
35 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `error_typed_self`
|
||||
--> ignore_fully_untyped.py:43:9
|
||||
|
|
@ -65,11 +63,10 @@ ANN201 [*] Missing return type annotation for public function `error_typed_self`
|
|||
44 | pass
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
40 40 | def ok_untyped_method(self):
|
||||
41 41 | pass
|
||||
42 42 |
|
||||
43 |- def error_typed_self(self: X):
|
||||
43 |+ def error_typed_self(self: X) -> None:
|
||||
44 44 | pass
|
||||
40 | def ok_untyped_method(self):
|
||||
41 | pass
|
||||
42 |
|
||||
- def error_typed_self(self: X):
|
||||
43 + def error_typed_self(self: X) -> None:
|
||||
44 | pass
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -11,16 +11,15 @@ ANN204 [*] Missing return type annotation for special method `__init__`
|
|||
6 | ...
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 | # Error
|
||||
4 4 | class Foo:
|
||||
5 |- def __init__(self):
|
||||
5 |+ def __init__(self) -> None:
|
||||
6 6 | ...
|
||||
7 7 |
|
||||
8 8 |
|
||||
2 |
|
||||
3 | # Error
|
||||
4 | class Foo:
|
||||
- def __init__(self):
|
||||
5 + def __init__(self) -> None:
|
||||
6 | ...
|
||||
7 |
|
||||
8 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
--> mypy_init_return.py:11:9
|
||||
|
|
@ -32,16 +31,15 @@ ANN204 [*] Missing return type annotation for special method `__init__`
|
|||
12 | ...
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 |
|
||||
9 9 | # Error
|
||||
10 10 | class Foo:
|
||||
11 |- def __init__(self, foo):
|
||||
11 |+ def __init__(self, foo) -> None:
|
||||
12 12 | ...
|
||||
13 13 |
|
||||
14 14 |
|
||||
8 |
|
||||
9 | # Error
|
||||
10 | class Foo:
|
||||
- def __init__(self, foo):
|
||||
11 + def __init__(self, foo) -> None:
|
||||
12 | ...
|
||||
13 |
|
||||
14 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN202 [*] Missing return type annotation for private function `__init__`
|
||||
--> mypy_init_return.py:40:5
|
||||
|
|
@ -52,16 +50,15 @@ ANN202 [*] Missing return type annotation for private function `__init__`
|
|||
41 | ...
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
37 37 |
|
||||
38 38 |
|
||||
39 39 | # Error
|
||||
40 |-def __init__(self, foo: int):
|
||||
40 |+def __init__(self, foo: int) -> None:
|
||||
41 41 | ...
|
||||
42 42 |
|
||||
43 43 |
|
||||
37 |
|
||||
38 |
|
||||
39 | # Error
|
||||
- def __init__(self, foo: int):
|
||||
40 + def __init__(self, foo: int) -> None:
|
||||
41 | ...
|
||||
42 |
|
||||
43 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
--> mypy_init_return.py:47:9
|
||||
|
|
@ -73,11 +70,10 @@ ANN204 [*] Missing return type annotation for special method `__init__`
|
|||
48 | ...
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
44 44 | # Error – used to be ok for a moment since the mere presence
|
||||
45 45 | # of a vararg falsely indicated that the function has a typed argument.
|
||||
46 46 | class Foo:
|
||||
47 |- def __init__(self, *arg):
|
||||
47 |+ def __init__(self, *arg) -> None:
|
||||
48 48 | ...
|
||||
44 | # Error – used to be ok for a moment since the mere presence
|
||||
45 | # of a vararg falsely indicated that the function has a typed argument.
|
||||
46 | class Foo:
|
||||
- def __init__(self, *arg):
|
||||
47 + def __init__(self, *arg) -> None:
|
||||
48 | ...
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,14 +10,13 @@ ANN204 [*] Missing return type annotation for special method `__str__`
|
|||
3 | ...
|
||||
|
|
||||
help: Add return type annotation: `str`
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | class Foo:
|
||||
2 |- def __str__(self):
|
||||
2 |+ def __str__(self) -> str:
|
||||
3 3 | ...
|
||||
4 4 |
|
||||
5 5 | def __repr__(self):
|
||||
1 | class Foo:
|
||||
- def __str__(self):
|
||||
2 + def __str__(self) -> str:
|
||||
3 | ...
|
||||
4 |
|
||||
5 | def __repr__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__repr__`
|
||||
--> simple_magic_methods.py:5:9
|
||||
|
|
@ -29,16 +28,15 @@ ANN204 [*] Missing return type annotation for special method `__repr__`
|
|||
6 | ...
|
||||
|
|
||||
help: Add return type annotation: `str`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | def __str__(self):
|
||||
3 3 | ...
|
||||
4 4 |
|
||||
5 |- def __repr__(self):
|
||||
5 |+ def __repr__(self) -> str:
|
||||
6 6 | ...
|
||||
7 7 |
|
||||
8 8 | def __len__(self):
|
||||
2 | def __str__(self):
|
||||
3 | ...
|
||||
4 |
|
||||
- def __repr__(self):
|
||||
5 + def __repr__(self) -> str:
|
||||
6 | ...
|
||||
7 |
|
||||
8 | def __len__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__len__`
|
||||
--> simple_magic_methods.py:8:9
|
||||
|
|
@ -50,16 +48,15 @@ ANN204 [*] Missing return type annotation for special method `__len__`
|
|||
9 | ...
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | def __repr__(self):
|
||||
6 6 | ...
|
||||
7 7 |
|
||||
8 |- def __len__(self):
|
||||
8 |+ def __len__(self) -> int:
|
||||
9 9 | ...
|
||||
10 10 |
|
||||
11 11 | def __length_hint__(self):
|
||||
5 | def __repr__(self):
|
||||
6 | ...
|
||||
7 |
|
||||
- def __len__(self):
|
||||
8 + def __len__(self) -> int:
|
||||
9 | ...
|
||||
10 |
|
||||
11 | def __length_hint__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__length_hint__`
|
||||
--> simple_magic_methods.py:11:9
|
||||
|
|
@ -71,16 +68,15 @@ ANN204 [*] Missing return type annotation for special method `__length_hint__`
|
|||
12 | ...
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | def __len__(self):
|
||||
9 9 | ...
|
||||
10 10 |
|
||||
11 |- def __length_hint__(self):
|
||||
11 |+ def __length_hint__(self) -> int:
|
||||
12 12 | ...
|
||||
13 13 |
|
||||
14 14 | def __init__(self):
|
||||
8 | def __len__(self):
|
||||
9 | ...
|
||||
10 |
|
||||
- def __length_hint__(self):
|
||||
11 + def __length_hint__(self) -> int:
|
||||
12 | ...
|
||||
13 |
|
||||
14 | def __init__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__init__`
|
||||
--> simple_magic_methods.py:14:9
|
||||
|
|
@ -92,16 +88,15 @@ ANN204 [*] Missing return type annotation for special method `__init__`
|
|||
15 | ...
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
11 11 | def __length_hint__(self):
|
||||
12 12 | ...
|
||||
13 13 |
|
||||
14 |- def __init__(self):
|
||||
14 |+ def __init__(self) -> None:
|
||||
15 15 | ...
|
||||
16 16 |
|
||||
17 17 | def __del__(self):
|
||||
11 | def __length_hint__(self):
|
||||
12 | ...
|
||||
13 |
|
||||
- def __init__(self):
|
||||
14 + def __init__(self) -> None:
|
||||
15 | ...
|
||||
16 |
|
||||
17 | def __del__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__del__`
|
||||
--> simple_magic_methods.py:17:9
|
||||
|
|
@ -113,16 +108,15 @@ ANN204 [*] Missing return type annotation for special method `__del__`
|
|||
18 | ...
|
||||
|
|
||||
help: Add return type annotation: `None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 | def __init__(self):
|
||||
15 15 | ...
|
||||
16 16 |
|
||||
17 |- def __del__(self):
|
||||
17 |+ def __del__(self) -> None:
|
||||
18 18 | ...
|
||||
19 19 |
|
||||
20 20 | def __bool__(self):
|
||||
14 | def __init__(self):
|
||||
15 | ...
|
||||
16 |
|
||||
- def __del__(self):
|
||||
17 + def __del__(self) -> None:
|
||||
18 | ...
|
||||
19 |
|
||||
20 | def __bool__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__bool__`
|
||||
--> simple_magic_methods.py:20:9
|
||||
|
|
@ -134,16 +128,15 @@ ANN204 [*] Missing return type annotation for special method `__bool__`
|
|||
21 | ...
|
||||
|
|
||||
help: Add return type annotation: `bool`
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 | def __del__(self):
|
||||
18 18 | ...
|
||||
19 19 |
|
||||
20 |- def __bool__(self):
|
||||
20 |+ def __bool__(self) -> bool:
|
||||
21 21 | ...
|
||||
22 22 |
|
||||
23 23 | def __bytes__(self):
|
||||
17 | def __del__(self):
|
||||
18 | ...
|
||||
19 |
|
||||
- def __bool__(self):
|
||||
20 + def __bool__(self) -> bool:
|
||||
21 | ...
|
||||
22 |
|
||||
23 | def __bytes__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__bytes__`
|
||||
--> simple_magic_methods.py:23:9
|
||||
|
|
@ -155,16 +148,15 @@ ANN204 [*] Missing return type annotation for special method `__bytes__`
|
|||
24 | ...
|
||||
|
|
||||
help: Add return type annotation: `bytes`
|
||||
|
||||
ℹ Unsafe fix
|
||||
20 20 | def __bool__(self):
|
||||
21 21 | ...
|
||||
22 22 |
|
||||
23 |- def __bytes__(self):
|
||||
23 |+ def __bytes__(self) -> bytes:
|
||||
24 24 | ...
|
||||
25 25 |
|
||||
26 26 | def __format__(self, format_spec):
|
||||
20 | def __bool__(self):
|
||||
21 | ...
|
||||
22 |
|
||||
- def __bytes__(self):
|
||||
23 + def __bytes__(self) -> bytes:
|
||||
24 | ...
|
||||
25 |
|
||||
26 | def __format__(self, format_spec):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__format__`
|
||||
--> simple_magic_methods.py:26:9
|
||||
|
|
@ -176,16 +168,15 @@ ANN204 [*] Missing return type annotation for special method `__format__`
|
|||
27 | ...
|
||||
|
|
||||
help: Add return type annotation: `str`
|
||||
|
||||
ℹ Unsafe fix
|
||||
23 23 | def __bytes__(self):
|
||||
24 24 | ...
|
||||
25 25 |
|
||||
26 |- def __format__(self, format_spec):
|
||||
26 |+ def __format__(self, format_spec) -> str:
|
||||
27 27 | ...
|
||||
28 28 |
|
||||
29 29 | def __contains__(self, item):
|
||||
23 | def __bytes__(self):
|
||||
24 | ...
|
||||
25 |
|
||||
- def __format__(self, format_spec):
|
||||
26 + def __format__(self, format_spec) -> str:
|
||||
27 | ...
|
||||
28 |
|
||||
29 | def __contains__(self, item):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__contains__`
|
||||
--> simple_magic_methods.py:29:9
|
||||
|
|
@ -197,16 +188,15 @@ ANN204 [*] Missing return type annotation for special method `__contains__`
|
|||
30 | ...
|
||||
|
|
||||
help: Add return type annotation: `bool`
|
||||
|
||||
ℹ Unsafe fix
|
||||
26 26 | def __format__(self, format_spec):
|
||||
27 27 | ...
|
||||
28 28 |
|
||||
29 |- def __contains__(self, item):
|
||||
29 |+ def __contains__(self, item) -> bool:
|
||||
30 30 | ...
|
||||
31 31 |
|
||||
32 32 | def __complex__(self):
|
||||
26 | def __format__(self, format_spec):
|
||||
27 | ...
|
||||
28 |
|
||||
- def __contains__(self, item):
|
||||
29 + def __contains__(self, item) -> bool:
|
||||
30 | ...
|
||||
31 |
|
||||
32 | def __complex__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__complex__`
|
||||
--> simple_magic_methods.py:32:9
|
||||
|
|
@ -218,16 +208,15 @@ ANN204 [*] Missing return type annotation for special method `__complex__`
|
|||
33 | ...
|
||||
|
|
||||
help: Add return type annotation: `complex`
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 | def __contains__(self, item):
|
||||
30 30 | ...
|
||||
31 31 |
|
||||
32 |- def __complex__(self):
|
||||
32 |+ def __complex__(self) -> complex:
|
||||
33 33 | ...
|
||||
34 34 |
|
||||
35 35 | def __int__(self):
|
||||
29 | def __contains__(self, item):
|
||||
30 | ...
|
||||
31 |
|
||||
- def __complex__(self):
|
||||
32 + def __complex__(self) -> complex:
|
||||
33 | ...
|
||||
34 |
|
||||
35 | def __int__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__int__`
|
||||
--> simple_magic_methods.py:35:9
|
||||
|
|
@ -239,16 +228,15 @@ ANN204 [*] Missing return type annotation for special method `__int__`
|
|||
36 | ...
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
32 32 | def __complex__(self):
|
||||
33 33 | ...
|
||||
34 34 |
|
||||
35 |- def __int__(self):
|
||||
35 |+ def __int__(self) -> int:
|
||||
36 36 | ...
|
||||
37 37 |
|
||||
38 38 | def __float__(self):
|
||||
32 | def __complex__(self):
|
||||
33 | ...
|
||||
34 |
|
||||
- def __int__(self):
|
||||
35 + def __int__(self) -> int:
|
||||
36 | ...
|
||||
37 |
|
||||
38 | def __float__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__float__`
|
||||
--> simple_magic_methods.py:38:9
|
||||
|
|
@ -260,16 +248,15 @@ ANN204 [*] Missing return type annotation for special method `__float__`
|
|||
39 | ...
|
||||
|
|
||||
help: Add return type annotation: `float`
|
||||
|
||||
ℹ Unsafe fix
|
||||
35 35 | def __int__(self):
|
||||
36 36 | ...
|
||||
37 37 |
|
||||
38 |- def __float__(self):
|
||||
38 |+ def __float__(self) -> float:
|
||||
39 39 | ...
|
||||
40 40 |
|
||||
41 41 | def __index__(self):
|
||||
35 | def __int__(self):
|
||||
36 | ...
|
||||
37 |
|
||||
- def __float__(self):
|
||||
38 + def __float__(self) -> float:
|
||||
39 | ...
|
||||
40 |
|
||||
41 | def __index__(self):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN204 [*] Missing return type annotation for special method `__index__`
|
||||
--> simple_magic_methods.py:41:9
|
||||
|
|
@ -281,11 +268,10 @@ ANN204 [*] Missing return type annotation for special method `__index__`
|
|||
42 | ...
|
||||
|
|
||||
help: Add return type annotation: `int`
|
||||
|
||||
ℹ Unsafe fix
|
||||
38 38 | def __float__(self):
|
||||
39 39 | ...
|
||||
40 40 |
|
||||
41 |- def __index__(self):
|
||||
41 |+ def __index__(self) -> int:
|
||||
42 42 | ...
|
||||
38 | def __float__(self):
|
||||
39 | ...
|
||||
40 |
|
||||
- def __index__(self):
|
||||
41 + def __index__(self) -> int:
|
||||
42 | ...
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,16 +10,15 @@ ANN201 [*] Missing return type annotation for public function `foo`
|
|||
46 | return True
|
||||
|
|
||||
help: Add return type annotation: `bool`
|
||||
|
||||
ℹ Unsafe fix
|
||||
42 42 |
|
||||
43 43 |
|
||||
44 44 | # Error
|
||||
45 |-def foo():
|
||||
45 |+def foo() -> bool:
|
||||
46 46 | return True
|
||||
47 47 |
|
||||
48 48 |
|
||||
42 |
|
||||
43 |
|
||||
44 | # Error
|
||||
- def foo():
|
||||
45 + def foo() -> bool:
|
||||
46 | return True
|
||||
47 |
|
||||
48 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN201 [*] Missing return type annotation for public function `foo`
|
||||
--> suppress_none_returning.py:50:5
|
||||
|
|
@ -31,16 +30,15 @@ ANN201 [*] Missing return type annotation for public function `foo`
|
|||
52 | if a == 4:
|
||||
|
|
||||
help: Add return type annotation: `bool | None`
|
||||
|
||||
ℹ Unsafe fix
|
||||
47 47 |
|
||||
48 48 |
|
||||
49 49 | # Error
|
||||
50 |-def foo():
|
||||
50 |+def foo() -> bool | None:
|
||||
51 51 | a = 2 + 2
|
||||
52 52 | if a == 4:
|
||||
53 53 | return True
|
||||
47 |
|
||||
48 |
|
||||
49 | # Error
|
||||
- def foo():
|
||||
50 + def foo() -> bool | None:
|
||||
51 | a = 2 + 2
|
||||
52 | if a == 4:
|
||||
53 | return True
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ANN001 Missing type annotation for function argument `a`
|
||||
--> suppress_none_returning.py:59:9
|
||||
|
|
|
|||
|
|
@ -11,16 +11,15 @@ ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediately awaited
|
|||
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
27 27 | await trio.lowlevel.wait_writable(foo)
|
||||
28 28 |
|
||||
29 29 | # ASYNC105
|
||||
30 |- trio.aclose_forcefully(foo)
|
||||
30 |+ await trio.aclose_forcefully(foo)
|
||||
31 31 | trio.open_file(foo)
|
||||
32 32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
27 | await trio.lowlevel.wait_writable(foo)
|
||||
28 |
|
||||
29 | # ASYNC105
|
||||
- trio.aclose_forcefully(foo)
|
||||
30 + await trio.aclose_forcefully(foo)
|
||||
31 | trio.open_file(foo)
|
||||
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.open_file` is not immediately awaited
|
||||
--> ASYNC105.py:31:5
|
||||
|
|
@ -33,16 +32,15 @@ ASYNC105 [*] Call to `trio.open_file` is not immediately awaited
|
|||
33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
28 28 |
|
||||
29 29 | # ASYNC105
|
||||
30 30 | trio.aclose_forcefully(foo)
|
||||
31 |- trio.open_file(foo)
|
||||
31 |+ await trio.open_file(foo)
|
||||
32 32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 34 | trio.open_tcp_listeners(foo)
|
||||
28 |
|
||||
29 | # ASYNC105
|
||||
30 | trio.aclose_forcefully(foo)
|
||||
- trio.open_file(foo)
|
||||
31 + await trio.open_file(foo)
|
||||
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 | trio.open_tcp_listeners(foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not immediately awaited
|
||||
--> ASYNC105.py:32:5
|
||||
|
|
@ -55,16 +53,15 @@ ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not immediately await
|
|||
34 | trio.open_tcp_listeners(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 | # ASYNC105
|
||||
30 30 | trio.aclose_forcefully(foo)
|
||||
31 31 | trio.open_file(foo)
|
||||
32 |- trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
32 |+ await trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 34 | trio.open_tcp_listeners(foo)
|
||||
35 35 | trio.open_tcp_stream(foo, foo)
|
||||
29 | # ASYNC105
|
||||
30 | trio.aclose_forcefully(foo)
|
||||
31 | trio.open_file(foo)
|
||||
- trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
32 + await trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 | trio.open_tcp_listeners(foo)
|
||||
35 | trio.open_tcp_stream(foo, foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not immediately awaited
|
||||
--> ASYNC105.py:33:5
|
||||
|
|
@ -77,16 +74,15 @@ ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not immediately awaited
|
|||
35 | trio.open_tcp_stream(foo, foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
30 30 | trio.aclose_forcefully(foo)
|
||||
31 31 | trio.open_file(foo)
|
||||
32 32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 |- trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
33 |+ await trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 34 | trio.open_tcp_listeners(foo)
|
||||
35 35 | trio.open_tcp_stream(foo, foo)
|
||||
36 36 | trio.open_unix_socket(foo)
|
||||
30 | trio.aclose_forcefully(foo)
|
||||
31 | trio.open_file(foo)
|
||||
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
- trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
33 + await trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 | trio.open_tcp_listeners(foo)
|
||||
35 | trio.open_tcp_stream(foo, foo)
|
||||
36 | trio.open_unix_socket(foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediately awaited
|
||||
--> ASYNC105.py:34:5
|
||||
|
|
@ -99,16 +95,15 @@ ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediately awaited
|
|||
36 | trio.open_unix_socket(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
31 31 | trio.open_file(foo)
|
||||
32 32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 |- trio.open_tcp_listeners(foo)
|
||||
34 |+ await trio.open_tcp_listeners(foo)
|
||||
35 35 | trio.open_tcp_stream(foo, foo)
|
||||
36 36 | trio.open_unix_socket(foo)
|
||||
37 37 | trio.run_process(foo)
|
||||
31 | trio.open_file(foo)
|
||||
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
- trio.open_tcp_listeners(foo)
|
||||
34 + await trio.open_tcp_listeners(foo)
|
||||
35 | trio.open_tcp_stream(foo, foo)
|
||||
36 | trio.open_unix_socket(foo)
|
||||
37 | trio.run_process(foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately awaited
|
||||
--> ASYNC105.py:35:5
|
||||
|
|
@ -121,16 +116,15 @@ ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately awaited
|
|||
37 | trio.run_process(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
32 32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 34 | trio.open_tcp_listeners(foo)
|
||||
35 |- trio.open_tcp_stream(foo, foo)
|
||||
35 |+ await trio.open_tcp_stream(foo, foo)
|
||||
36 36 | trio.open_unix_socket(foo)
|
||||
37 37 | trio.run_process(foo)
|
||||
38 38 | trio.serve_listeners(foo, foo)
|
||||
32 | trio.open_ssl_over_tcp_listeners(foo, foo)
|
||||
33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 | trio.open_tcp_listeners(foo)
|
||||
- trio.open_tcp_stream(foo, foo)
|
||||
35 + await trio.open_tcp_stream(foo, foo)
|
||||
36 | trio.open_unix_socket(foo)
|
||||
37 | trio.run_process(foo)
|
||||
38 | trio.serve_listeners(foo, foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.open_unix_socket` is not immediately awaited
|
||||
--> ASYNC105.py:36:5
|
||||
|
|
@ -143,16 +137,15 @@ ASYNC105 [*] Call to `trio.open_unix_socket` is not immediately awaited
|
|||
38 | trio.serve_listeners(foo, foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
33 33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 34 | trio.open_tcp_listeners(foo)
|
||||
35 35 | trio.open_tcp_stream(foo, foo)
|
||||
36 |- trio.open_unix_socket(foo)
|
||||
36 |+ await trio.open_unix_socket(foo)
|
||||
37 37 | trio.run_process(foo)
|
||||
38 38 | trio.serve_listeners(foo, foo)
|
||||
39 39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
33 | trio.open_ssl_over_tcp_stream(foo, foo)
|
||||
34 | trio.open_tcp_listeners(foo)
|
||||
35 | trio.open_tcp_stream(foo, foo)
|
||||
- trio.open_unix_socket(foo)
|
||||
36 + await trio.open_unix_socket(foo)
|
||||
37 | trio.run_process(foo)
|
||||
38 | trio.serve_listeners(foo, foo)
|
||||
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.run_process` is not immediately awaited
|
||||
--> ASYNC105.py:37:5
|
||||
|
|
@ -165,16 +158,15 @@ ASYNC105 [*] Call to `trio.run_process` is not immediately awaited
|
|||
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
34 34 | trio.open_tcp_listeners(foo)
|
||||
35 35 | trio.open_tcp_stream(foo, foo)
|
||||
36 36 | trio.open_unix_socket(foo)
|
||||
37 |- trio.run_process(foo)
|
||||
37 |+ await trio.run_process(foo)
|
||||
38 38 | trio.serve_listeners(foo, foo)
|
||||
39 39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 40 | trio.serve_tcp(foo, foo)
|
||||
34 | trio.open_tcp_listeners(foo)
|
||||
35 | trio.open_tcp_stream(foo, foo)
|
||||
36 | trio.open_unix_socket(foo)
|
||||
- trio.run_process(foo)
|
||||
37 + await trio.run_process(foo)
|
||||
38 | trio.serve_listeners(foo, foo)
|
||||
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 | trio.serve_tcp(foo, foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.serve_listeners` is not immediately awaited
|
||||
--> ASYNC105.py:38:5
|
||||
|
|
@ -187,16 +179,15 @@ ASYNC105 [*] Call to `trio.serve_listeners` is not immediately awaited
|
|||
40 | trio.serve_tcp(foo, foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
35 35 | trio.open_tcp_stream(foo, foo)
|
||||
36 36 | trio.open_unix_socket(foo)
|
||||
37 37 | trio.run_process(foo)
|
||||
38 |- trio.serve_listeners(foo, foo)
|
||||
38 |+ await trio.serve_listeners(foo, foo)
|
||||
39 39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 40 | trio.serve_tcp(foo, foo)
|
||||
41 41 | trio.sleep(foo)
|
||||
35 | trio.open_tcp_stream(foo, foo)
|
||||
36 | trio.open_unix_socket(foo)
|
||||
37 | trio.run_process(foo)
|
||||
- trio.serve_listeners(foo, foo)
|
||||
38 + await trio.serve_listeners(foo, foo)
|
||||
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 | trio.serve_tcp(foo, foo)
|
||||
41 | trio.sleep(foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediately awaited
|
||||
--> ASYNC105.py:39:5
|
||||
|
|
@ -209,16 +200,15 @@ ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediately awaited
|
|||
41 | trio.sleep(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
36 36 | trio.open_unix_socket(foo)
|
||||
37 37 | trio.run_process(foo)
|
||||
38 38 | trio.serve_listeners(foo, foo)
|
||||
39 |- trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
39 |+ await trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 40 | trio.serve_tcp(foo, foo)
|
||||
41 41 | trio.sleep(foo)
|
||||
42 42 | trio.sleep_forever()
|
||||
36 | trio.open_unix_socket(foo)
|
||||
37 | trio.run_process(foo)
|
||||
38 | trio.serve_listeners(foo, foo)
|
||||
- trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
39 + await trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 | trio.serve_tcp(foo, foo)
|
||||
41 | trio.sleep(foo)
|
||||
42 | trio.sleep_forever()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.serve_tcp` is not immediately awaited
|
||||
--> ASYNC105.py:40:5
|
||||
|
|
@ -231,16 +221,15 @@ ASYNC105 [*] Call to `trio.serve_tcp` is not immediately awaited
|
|||
42 | trio.sleep_forever()
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
37 37 | trio.run_process(foo)
|
||||
38 38 | trio.serve_listeners(foo, foo)
|
||||
39 39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 |- trio.serve_tcp(foo, foo)
|
||||
40 |+ await trio.serve_tcp(foo, foo)
|
||||
41 41 | trio.sleep(foo)
|
||||
42 42 | trio.sleep_forever()
|
||||
43 43 | trio.sleep_until(foo)
|
||||
37 | trio.run_process(foo)
|
||||
38 | trio.serve_listeners(foo, foo)
|
||||
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
- trio.serve_tcp(foo, foo)
|
||||
40 + await trio.serve_tcp(foo, foo)
|
||||
41 | trio.sleep(foo)
|
||||
42 | trio.sleep_forever()
|
||||
43 | trio.sleep_until(foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.sleep` is not immediately awaited
|
||||
--> ASYNC105.py:41:5
|
||||
|
|
@ -253,16 +242,15 @@ ASYNC105 [*] Call to `trio.sleep` is not immediately awaited
|
|||
43 | trio.sleep_until(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
38 38 | trio.serve_listeners(foo, foo)
|
||||
39 39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 40 | trio.serve_tcp(foo, foo)
|
||||
41 |- trio.sleep(foo)
|
||||
41 |+ await trio.sleep(foo)
|
||||
42 42 | trio.sleep_forever()
|
||||
43 43 | trio.sleep_until(foo)
|
||||
44 44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
38 | trio.serve_listeners(foo, foo)
|
||||
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 | trio.serve_tcp(foo, foo)
|
||||
- trio.sleep(foo)
|
||||
41 + await trio.sleep(foo)
|
||||
42 | trio.sleep_forever()
|
||||
43 | trio.sleep_until(foo)
|
||||
44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.sleep_forever` is not immediately awaited
|
||||
--> ASYNC105.py:42:5
|
||||
|
|
@ -275,16 +263,15 @@ ASYNC105 [*] Call to `trio.sleep_forever` is not immediately awaited
|
|||
44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
39 39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 40 | trio.serve_tcp(foo, foo)
|
||||
41 41 | trio.sleep(foo)
|
||||
42 |- trio.sleep_forever()
|
||||
42 |+ await trio.sleep_forever()
|
||||
43 43 | trio.sleep_until(foo)
|
||||
44 44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
45 45 | trio.lowlevel.checkpoint()
|
||||
39 | trio.serve_ssl_over_tcp(foo, foo, foo)
|
||||
40 | trio.serve_tcp(foo, foo)
|
||||
41 | trio.sleep(foo)
|
||||
- trio.sleep_forever()
|
||||
42 + await trio.sleep_forever()
|
||||
43 | trio.sleep_until(foo)
|
||||
44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
45 | trio.lowlevel.checkpoint()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint` is not immediately awaited
|
||||
--> ASYNC105.py:44:5
|
||||
|
|
@ -297,16 +284,15 @@ ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint` is not immediate
|
|||
46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
41 41 | trio.sleep(foo)
|
||||
42 42 | trio.sleep_forever()
|
||||
43 43 | trio.sleep_until(foo)
|
||||
44 |- trio.lowlevel.cancel_shielded_checkpoint()
|
||||
44 |+ await trio.lowlevel.cancel_shielded_checkpoint()
|
||||
45 45 | trio.lowlevel.checkpoint()
|
||||
46 46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 47 | trio.lowlevel.open_process()
|
||||
41 | trio.sleep(foo)
|
||||
42 | trio.sleep_forever()
|
||||
43 | trio.sleep_until(foo)
|
||||
- trio.lowlevel.cancel_shielded_checkpoint()
|
||||
44 + await trio.lowlevel.cancel_shielded_checkpoint()
|
||||
45 | trio.lowlevel.checkpoint()
|
||||
46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 | trio.lowlevel.open_process()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immediately awaited
|
||||
--> ASYNC105.py:45:5
|
||||
|
|
@ -319,16 +305,15 @@ ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immediately awaited
|
|||
47 | trio.lowlevel.open_process()
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
42 42 | trio.sleep_forever()
|
||||
43 43 | trio.sleep_until(foo)
|
||||
44 44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
45 |- trio.lowlevel.checkpoint()
|
||||
45 |+ await trio.lowlevel.checkpoint()
|
||||
46 46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 47 | trio.lowlevel.open_process()
|
||||
48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
42 | trio.sleep_forever()
|
||||
43 | trio.sleep_until(foo)
|
||||
44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
- trio.lowlevel.checkpoint()
|
||||
45 + await trio.lowlevel.checkpoint()
|
||||
46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 | trio.lowlevel.open_process()
|
||||
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` is not immediately awaited
|
||||
--> ASYNC105.py:46:5
|
||||
|
|
@ -341,16 +326,15 @@ ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` is not immediately
|
|||
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
43 43 | trio.sleep_until(foo)
|
||||
44 44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
45 45 | trio.lowlevel.checkpoint()
|
||||
46 |- trio.lowlevel.checkpoint_if_cancelled()
|
||||
46 |+ await trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 47 | trio.lowlevel.open_process()
|
||||
48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
43 | trio.sleep_until(foo)
|
||||
44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
45 | trio.lowlevel.checkpoint()
|
||||
- trio.lowlevel.checkpoint_if_cancelled()
|
||||
46 + await trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 | trio.lowlevel.open_process()
|
||||
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immediately awaited
|
||||
--> ASYNC105.py:47:5
|
||||
|
|
@ -363,16 +347,15 @@ ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immediately awaited
|
|||
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
44 44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
45 45 | trio.lowlevel.checkpoint()
|
||||
46 46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 |- trio.lowlevel.open_process()
|
||||
47 |+ await trio.lowlevel.open_process()
|
||||
48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
44 | trio.lowlevel.cancel_shielded_checkpoint()
|
||||
45 | trio.lowlevel.checkpoint()
|
||||
46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
- trio.lowlevel.open_process()
|
||||
47 + await trio.lowlevel.open_process()
|
||||
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_coroutine_object` is not immediately awaited
|
||||
--> ASYNC105.py:48:5
|
||||
|
|
@ -385,16 +368,15 @@ ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_coroutine_object` is not
|
|||
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
45 45 | trio.lowlevel.checkpoint()
|
||||
46 46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 47 | trio.lowlevel.open_process()
|
||||
48 |- trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
48 |+ await trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 51 | trio.lowlevel.wait_readable(foo)
|
||||
45 | trio.lowlevel.checkpoint()
|
||||
46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 | trio.lowlevel.open_process()
|
||||
- trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
48 + await trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 | trio.lowlevel.wait_readable(foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutine_object` is not immediately awaited
|
||||
--> ASYNC105.py:49:5
|
||||
|
|
@ -407,16 +389,15 @@ ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutine_object` is not i
|
|||
51 | trio.lowlevel.wait_readable(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
46 46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 47 | trio.lowlevel.open_process()
|
||||
48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 |- trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
49 |+ await trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 51 | trio.lowlevel.wait_readable(foo)
|
||||
52 52 | trio.lowlevel.wait_task_rescheduled(foo)
|
||||
46 | trio.lowlevel.checkpoint_if_cancelled()
|
||||
47 | trio.lowlevel.open_process()
|
||||
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
- trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
49 + await trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 | trio.lowlevel.wait_readable(foo)
|
||||
52 | trio.lowlevel.wait_task_rescheduled(foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_coroutine_object` is not immediately awaited
|
||||
--> ASYNC105.py:50:5
|
||||
|
|
@ -429,16 +410,15 @@ ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_coroutine_object` is not
|
|||
52 | trio.lowlevel.wait_task_rescheduled(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
47 47 | trio.lowlevel.open_process()
|
||||
48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 |- trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
50 |+ await trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 51 | trio.lowlevel.wait_readable(foo)
|
||||
52 52 | trio.lowlevel.wait_task_rescheduled(foo)
|
||||
53 53 | trio.lowlevel.wait_writable(foo)
|
||||
47 | trio.lowlevel.open_process()
|
||||
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
- trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
50 + await trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 | trio.lowlevel.wait_readable(foo)
|
||||
52 | trio.lowlevel.wait_task_rescheduled(foo)
|
||||
53 | trio.lowlevel.wait_writable(foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not immediately awaited
|
||||
--> ASYNC105.py:51:5
|
||||
|
|
@ -451,16 +431,15 @@ ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not immediately awaited
|
|||
53 | trio.lowlevel.wait_writable(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 |- trio.lowlevel.wait_readable(foo)
|
||||
51 |+ await trio.lowlevel.wait_readable(foo)
|
||||
52 52 | trio.lowlevel.wait_task_rescheduled(foo)
|
||||
53 53 | trio.lowlevel.wait_writable(foo)
|
||||
54 54 |
|
||||
48 | trio.lowlevel.permanently_detach_coroutine_object(foo)
|
||||
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
- trio.lowlevel.wait_readable(foo)
|
||||
51 + await trio.lowlevel.wait_readable(foo)
|
||||
52 | trio.lowlevel.wait_task_rescheduled(foo)
|
||||
53 | trio.lowlevel.wait_writable(foo)
|
||||
54 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is not immediately awaited
|
||||
--> ASYNC105.py:52:5
|
||||
|
|
@ -472,16 +451,15 @@ ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is not immediately aw
|
|||
53 | trio.lowlevel.wait_writable(foo)
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 51 | trio.lowlevel.wait_readable(foo)
|
||||
52 |- trio.lowlevel.wait_task_rescheduled(foo)
|
||||
52 |+ await trio.lowlevel.wait_task_rescheduled(foo)
|
||||
53 53 | trio.lowlevel.wait_writable(foo)
|
||||
54 54 |
|
||||
55 55 | async with await trio.open_file(foo): # Ok
|
||||
49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo)
|
||||
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 | trio.lowlevel.wait_readable(foo)
|
||||
- trio.lowlevel.wait_task_rescheduled(foo)
|
||||
52 + await trio.lowlevel.wait_task_rescheduled(foo)
|
||||
53 | trio.lowlevel.wait_writable(foo)
|
||||
54 |
|
||||
55 | async with await trio.open_file(foo): # Ok
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not immediately awaited
|
||||
--> ASYNC105.py:53:5
|
||||
|
|
@ -494,16 +472,15 @@ ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not immediately awaited
|
|||
55 | async with await trio.open_file(foo): # Ok
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 51 | trio.lowlevel.wait_readable(foo)
|
||||
52 52 | trio.lowlevel.wait_task_rescheduled(foo)
|
||||
53 |- trio.lowlevel.wait_writable(foo)
|
||||
53 |+ await trio.lowlevel.wait_writable(foo)
|
||||
54 54 |
|
||||
55 55 | async with await trio.open_file(foo): # Ok
|
||||
56 56 | pass
|
||||
50 | trio.lowlevel.temporarily_detach_coroutine_object(foo)
|
||||
51 | trio.lowlevel.wait_readable(foo)
|
||||
52 | trio.lowlevel.wait_task_rescheduled(foo)
|
||||
- trio.lowlevel.wait_writable(foo)
|
||||
53 + await trio.lowlevel.wait_writable(foo)
|
||||
54 |
|
||||
55 | async with await trio.open_file(foo): # Ok
|
||||
56 | pass
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 [*] Call to `trio.open_file` is not immediately awaited
|
||||
--> ASYNC105.py:58:16
|
||||
|
|
@ -515,16 +492,15 @@ ASYNC105 [*] Call to `trio.open_file` is not immediately awaited
|
|||
59 | pass
|
||||
|
|
||||
help: Add `await`
|
||||
|
||||
ℹ Unsafe fix
|
||||
55 55 | async with await trio.open_file(foo): # Ok
|
||||
56 56 | pass
|
||||
57 57 |
|
||||
58 |- async with trio.open_file(foo): # ASYNC105
|
||||
58 |+ async with await trio.open_file(foo): # ASYNC105
|
||||
59 59 | pass
|
||||
60 60 |
|
||||
61 61 |
|
||||
55 | async with await trio.open_file(foo): # Ok
|
||||
56 | pass
|
||||
57 |
|
||||
- async with trio.open_file(foo): # ASYNC105
|
||||
58 + async with await trio.open_file(foo): # ASYNC105
|
||||
59 | pass
|
||||
60 |
|
||||
61 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC105 Call to `trio.open_file` is not immediately awaited
|
||||
--> ASYNC105.py:64:5
|
||||
|
|
|
|||
|
|
@ -12,16 +12,14 @@ ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
|||
7 | await trio.sleep(0, 1) # OK
|
||||
|
|
||||
help: Replace with `trio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
2 2 | import trio
|
||||
3 3 | from trio import sleep
|
||||
4 4 |
|
||||
5 |- await trio.sleep(0) # ASYNC115
|
||||
5 |+ await trio.lowlevel.checkpoint() # ASYNC115
|
||||
6 6 | await trio.sleep(1) # OK
|
||||
7 7 | await trio.sleep(0, 1) # OK
|
||||
8 8 | await trio.sleep(...) # OK
|
||||
2 | import trio
|
||||
3 | from trio import sleep
|
||||
4 |
|
||||
- await trio.sleep(0) # ASYNC115
|
||||
5 + await trio.lowlevel.checkpoint() # ASYNC115
|
||||
6 | await trio.sleep(1) # OK
|
||||
7 | await trio.sleep(0, 1) # OK
|
||||
8 | await trio.sleep(...) # OK
|
||||
|
||||
ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
||||
--> ASYNC115.py:11:5
|
||||
|
|
@ -34,16 +32,14 @@ ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
|||
13 | trio.sleep(foo) # OK
|
||||
|
|
||||
help: Replace with `trio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
8 8 | await trio.sleep(...) # OK
|
||||
9 9 | await trio.sleep() # OK
|
||||
10 10 |
|
||||
11 |- trio.sleep(0) # ASYNC115
|
||||
11 |+ trio.lowlevel.checkpoint() # ASYNC115
|
||||
12 12 | foo = 0
|
||||
13 13 | trio.sleep(foo) # OK
|
||||
14 14 | trio.sleep(1) # OK
|
||||
8 | await trio.sleep(...) # OK
|
||||
9 | await trio.sleep() # OK
|
||||
10 |
|
||||
- trio.sleep(0) # ASYNC115
|
||||
11 + trio.lowlevel.checkpoint() # ASYNC115
|
||||
12 | foo = 0
|
||||
13 | trio.sleep(foo) # OK
|
||||
14 | trio.sleep(1) # OK
|
||||
|
||||
ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
||||
--> ASYNC115.py:17:5
|
||||
|
|
@ -56,16 +52,14 @@ ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
|||
19 | bar = "bar"
|
||||
|
|
||||
help: Replace with `trio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
14 14 | trio.sleep(1) # OK
|
||||
15 15 | time.sleep(0) # OK
|
||||
16 16 |
|
||||
17 |- sleep(0) # ASYNC115
|
||||
17 |+ trio.lowlevel.checkpoint() # ASYNC115
|
||||
18 18 |
|
||||
19 19 | bar = "bar"
|
||||
20 20 | trio.sleep(bar)
|
||||
14 | trio.sleep(1) # OK
|
||||
15 | time.sleep(0) # OK
|
||||
16 |
|
||||
- sleep(0) # ASYNC115
|
||||
17 + trio.lowlevel.checkpoint() # ASYNC115
|
||||
18 |
|
||||
19 | bar = "bar"
|
||||
20 | trio.sleep(bar)
|
||||
|
||||
ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
||||
--> ASYNC115.py:48:14
|
||||
|
|
@ -76,16 +70,14 @@ ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
|||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `trio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
45 45 | def func():
|
||||
46 46 | import trio
|
||||
47 47 |
|
||||
48 |- trio.run(trio.sleep(0)) # ASYNC115
|
||||
48 |+ trio.run(trio.lowlevel.checkpoint()) # ASYNC115
|
||||
49 49 |
|
||||
50 50 |
|
||||
51 51 | from trio import Event, sleep
|
||||
45 | def func():
|
||||
46 | import trio
|
||||
47 |
|
||||
- trio.run(trio.sleep(0)) # ASYNC115
|
||||
48 + trio.run(trio.lowlevel.checkpoint()) # ASYNC115
|
||||
49 |
|
||||
50 |
|
||||
51 | from trio import Event, sleep
|
||||
|
||||
ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
||||
--> ASYNC115.py:55:5
|
||||
|
|
@ -95,21 +87,19 @@ ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
|||
| ^^^^^^^^
|
||||
|
|
||||
help: Replace with `trio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
48 48 | trio.run(trio.sleep(0)) # ASYNC115
|
||||
49 49 |
|
||||
50 50 |
|
||||
51 |-from trio import Event, sleep
|
||||
51 |+from trio import Event, sleep, lowlevel
|
||||
52 52 |
|
||||
53 53 |
|
||||
54 54 | def func():
|
||||
55 |- sleep(0) # ASYNC115
|
||||
55 |+ lowlevel.checkpoint() # ASYNC115
|
||||
56 56 |
|
||||
57 57 |
|
||||
58 58 | async def func():
|
||||
48 | trio.run(trio.sleep(0)) # ASYNC115
|
||||
49 |
|
||||
50 |
|
||||
- from trio import Event, sleep
|
||||
51 + from trio import Event, sleep, lowlevel
|
||||
52 |
|
||||
53 |
|
||||
54 | def func():
|
||||
- sleep(0) # ASYNC115
|
||||
55 + lowlevel.checkpoint() # ASYNC115
|
||||
56 |
|
||||
57 |
|
||||
58 | async def func():
|
||||
|
||||
ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
||||
--> ASYNC115.py:59:11
|
||||
|
|
@ -119,25 +109,23 @@ ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
|||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `trio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
48 48 | trio.run(trio.sleep(0)) # ASYNC115
|
||||
49 49 |
|
||||
50 50 |
|
||||
51 |-from trio import Event, sleep
|
||||
51 |+from trio import Event, sleep, lowlevel
|
||||
52 52 |
|
||||
53 53 |
|
||||
54 54 | def func():
|
||||
48 | trio.run(trio.sleep(0)) # ASYNC115
|
||||
49 |
|
||||
50 |
|
||||
- from trio import Event, sleep
|
||||
51 + from trio import Event, sleep, lowlevel
|
||||
52 |
|
||||
53 |
|
||||
54 | def func():
|
||||
--------------------------------------------------------------------------------
|
||||
56 56 |
|
||||
57 57 |
|
||||
58 58 | async def func():
|
||||
59 |- await sleep(seconds=0) # ASYNC115
|
||||
59 |+ await lowlevel.checkpoint() # ASYNC115
|
||||
60 60 |
|
||||
61 61 |
|
||||
62 62 | def func():
|
||||
56 |
|
||||
57 |
|
||||
58 | async def func():
|
||||
- await sleep(seconds=0) # ASYNC115
|
||||
59 + await lowlevel.checkpoint() # ASYNC115
|
||||
60 |
|
||||
61 |
|
||||
62 | def func():
|
||||
|
||||
ASYNC115 [*] Use `anyio.lowlevel.checkpoint()` instead of `anyio.sleep(0)`
|
||||
--> ASYNC115.py:85:11
|
||||
|
|
@ -150,16 +138,14 @@ ASYNC115 [*] Use `anyio.lowlevel.checkpoint()` instead of `anyio.sleep(0)`
|
|||
87 | await anyio.sleep(0, 1) # OK
|
||||
|
|
||||
help: Replace with `anyio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
82 82 | import anyio
|
||||
83 83 | from anyio import sleep
|
||||
84 84 |
|
||||
85 |- await anyio.sleep(0) # ASYNC115
|
||||
85 |+ await anyio.lowlevel.checkpoint() # ASYNC115
|
||||
86 86 | await anyio.sleep(1) # OK
|
||||
87 87 | await anyio.sleep(0, 1) # OK
|
||||
88 88 | await anyio.sleep(...) # OK
|
||||
82 | import anyio
|
||||
83 | from anyio import sleep
|
||||
84 |
|
||||
- await anyio.sleep(0) # ASYNC115
|
||||
85 + await anyio.lowlevel.checkpoint() # ASYNC115
|
||||
86 | await anyio.sleep(1) # OK
|
||||
87 | await anyio.sleep(0, 1) # OK
|
||||
88 | await anyio.sleep(...) # OK
|
||||
|
||||
ASYNC115 [*] Use `anyio.lowlevel.checkpoint()` instead of `anyio.sleep(0)`
|
||||
--> ASYNC115.py:91:5
|
||||
|
|
@ -172,16 +158,14 @@ ASYNC115 [*] Use `anyio.lowlevel.checkpoint()` instead of `anyio.sleep(0)`
|
|||
93 | anyio.sleep(foo) # OK
|
||||
|
|
||||
help: Replace with `anyio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
88 88 | await anyio.sleep(...) # OK
|
||||
89 89 | await anyio.sleep() # OK
|
||||
90 90 |
|
||||
91 |- anyio.sleep(0) # ASYNC115
|
||||
91 |+ anyio.lowlevel.checkpoint() # ASYNC115
|
||||
92 92 | foo = 0
|
||||
93 93 | anyio.sleep(foo) # OK
|
||||
94 94 | anyio.sleep(1) # OK
|
||||
88 | await anyio.sleep(...) # OK
|
||||
89 | await anyio.sleep() # OK
|
||||
90 |
|
||||
- anyio.sleep(0) # ASYNC115
|
||||
91 + anyio.lowlevel.checkpoint() # ASYNC115
|
||||
92 | foo = 0
|
||||
93 | anyio.sleep(foo) # OK
|
||||
94 | anyio.sleep(1) # OK
|
||||
|
||||
ASYNC115 [*] Use `anyio.lowlevel.checkpoint()` instead of `anyio.sleep(0)`
|
||||
--> ASYNC115.py:97:5
|
||||
|
|
@ -194,16 +178,14 @@ ASYNC115 [*] Use `anyio.lowlevel.checkpoint()` instead of `anyio.sleep(0)`
|
|||
99 | bar = "bar"
|
||||
|
|
||||
help: Replace with `anyio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
94 94 | anyio.sleep(1) # OK
|
||||
95 95 | time.sleep(0) # OK
|
||||
96 96 |
|
||||
97 |- sleep(0) # ASYNC115
|
||||
97 |+ anyio.lowlevel.checkpoint() # ASYNC115
|
||||
98 98 |
|
||||
99 99 | bar = "bar"
|
||||
100 100 | anyio.sleep(bar)
|
||||
94 | anyio.sleep(1) # OK
|
||||
95 | time.sleep(0) # OK
|
||||
96 |
|
||||
- sleep(0) # ASYNC115
|
||||
97 + anyio.lowlevel.checkpoint() # ASYNC115
|
||||
98 |
|
||||
99 | bar = "bar"
|
||||
100 | anyio.sleep(bar)
|
||||
|
||||
ASYNC115 [*] Use `anyio.lowlevel.checkpoint()` instead of `anyio.sleep(0)`
|
||||
--> ASYNC115.py:128:15
|
||||
|
|
@ -214,16 +196,14 @@ ASYNC115 [*] Use `anyio.lowlevel.checkpoint()` instead of `anyio.sleep(0)`
|
|||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `anyio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
125 125 | def func():
|
||||
126 126 | import anyio
|
||||
127 127 |
|
||||
128 |- anyio.run(anyio.sleep(0)) # ASYNC115
|
||||
128 |+ anyio.run(anyio.lowlevel.checkpoint()) # ASYNC115
|
||||
129 129 |
|
||||
130 130 |
|
||||
131 131 | def func():
|
||||
125 | def func():
|
||||
126 | import anyio
|
||||
127 |
|
||||
- anyio.run(anyio.sleep(0)) # ASYNC115
|
||||
128 + anyio.run(anyio.lowlevel.checkpoint()) # ASYNC115
|
||||
129 |
|
||||
130 |
|
||||
131 | def func():
|
||||
|
||||
ASYNC115 [*] Use `anyio.lowlevel.checkpoint()` instead of `anyio.sleep(0)`
|
||||
--> ASYNC115.py:156:11
|
||||
|
|
@ -235,16 +215,14 @@ ASYNC115 [*] Use `anyio.lowlevel.checkpoint()` instead of `anyio.sleep(0)`
|
|||
157 | await anyio.sleep(seconds=0) # OK
|
||||
|
|
||||
help: Replace with `anyio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
153 153 | await anyio.sleep(delay=1) # OK
|
||||
154 154 | await anyio.sleep(seconds=1) # OK
|
||||
155 155 |
|
||||
156 |- await anyio.sleep(delay=0) # ASYNC115
|
||||
156 |+ await anyio.lowlevel.checkpoint() # ASYNC115
|
||||
157 157 | await anyio.sleep(seconds=0) # OK
|
||||
158 158 |
|
||||
159 159 |
|
||||
153 | await anyio.sleep(delay=1) # OK
|
||||
154 | await anyio.sleep(seconds=1) # OK
|
||||
155 |
|
||||
- await anyio.sleep(delay=0) # ASYNC115
|
||||
156 + await anyio.lowlevel.checkpoint() # ASYNC115
|
||||
157 | await anyio.sleep(seconds=0) # OK
|
||||
158 |
|
||||
159 |
|
||||
|
||||
ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
||||
--> ASYNC115.py:166:11
|
||||
|
|
@ -256,16 +234,14 @@ ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
|||
167 | await trio.sleep(delay=0) # OK
|
||||
|
|
||||
help: Replace with `trio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Safe fix
|
||||
163 163 | await trio.sleep(seconds=1) # OK
|
||||
164 164 | await trio.sleep(delay=1) # OK
|
||||
165 165 |
|
||||
166 |- await trio.sleep(seconds=0) # ASYNC115
|
||||
166 |+ await trio.lowlevel.checkpoint() # ASYNC115
|
||||
167 167 | await trio.sleep(delay=0) # OK
|
||||
168 168 |
|
||||
169 169 | # https://github.com/astral-sh/ruff/issues/18740
|
||||
163 | await trio.sleep(seconds=1) # OK
|
||||
164 | await trio.sleep(delay=1) # OK
|
||||
165 |
|
||||
- await trio.sleep(seconds=0) # ASYNC115
|
||||
166 + await trio.lowlevel.checkpoint() # ASYNC115
|
||||
167 | await trio.sleep(delay=0) # OK
|
||||
168 |
|
||||
169 | # https://github.com/astral-sh/ruff/issues/18740
|
||||
|
||||
ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
||||
--> ASYNC115.py:175:5
|
||||
|
|
@ -279,14 +255,13 @@ ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
|
|||
179 | )
|
||||
|
|
||||
help: Replace with `trio.lowlevel.checkpoint()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
172 172 | import trio
|
||||
173 173 |
|
||||
174 174 | await (
|
||||
175 |- trio # comment
|
||||
176 |- .sleep( # comment
|
||||
177 |- 0 # comment
|
||||
178 |- )
|
||||
175 |+ trio.lowlevel.checkpoint()
|
||||
179 176 | )
|
||||
172 | import trio
|
||||
173 |
|
||||
174 | await (
|
||||
- trio # comment
|
||||
- .sleep( # comment
|
||||
- 0 # comment
|
||||
- )
|
||||
175 + trio.lowlevel.checkpoint()
|
||||
176 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -11,16 +11,15 @@ ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep
|
|||
13 | # 'inf literal' overflow trick
|
||||
|
|
||||
help: Replace with `trio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | import trio
|
||||
9 9 |
|
||||
10 10 | # These examples are probably not meant to ever wake up:
|
||||
11 |- await trio.sleep(100000) # error: 116, "async"
|
||||
11 |+ await trio.sleep_forever() # error: 116, "async"
|
||||
12 12 |
|
||||
13 13 | # 'inf literal' overflow trick
|
||||
14 14 | await trio.sleep(1e999) # error: 116, "async"
|
||||
8 | import trio
|
||||
9 |
|
||||
10 | # These examples are probably not meant to ever wake up:
|
||||
- await trio.sleep(100000) # error: 116, "async"
|
||||
11 + await trio.sleep_forever() # error: 116, "async"
|
||||
12 |
|
||||
13 | # 'inf literal' overflow trick
|
||||
14 | await trio.sleep(1e999) # error: 116, "async"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
|
||||
--> ASYNC116.py:14:11
|
||||
|
|
@ -32,16 +31,15 @@ ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep
|
|||
16 | await trio.sleep(86399)
|
||||
|
|
||||
help: Replace with `trio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
11 11 | await trio.sleep(100000) # error: 116, "async"
|
||||
12 12 |
|
||||
13 13 | # 'inf literal' overflow trick
|
||||
14 |- await trio.sleep(1e999) # error: 116, "async"
|
||||
14 |+ await trio.sleep_forever() # error: 116, "async"
|
||||
15 15 |
|
||||
16 16 | await trio.sleep(86399)
|
||||
17 17 | await trio.sleep(86400)
|
||||
11 | await trio.sleep(100000) # error: 116, "async"
|
||||
12 |
|
||||
13 | # 'inf literal' overflow trick
|
||||
- await trio.sleep(1e999) # error: 116, "async"
|
||||
14 + await trio.sleep_forever() # error: 116, "async"
|
||||
15 |
|
||||
16 | await trio.sleep(86399)
|
||||
17 | await trio.sleep(86400)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
|
||||
--> ASYNC116.py:18:11
|
||||
|
|
@ -53,16 +51,15 @@ ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep
|
|||
19 | await trio.sleep(86401) # error: 116, "async"
|
||||
|
|
||||
help: Replace with `trio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
15 15 |
|
||||
16 16 | await trio.sleep(86399)
|
||||
17 17 | await trio.sleep(86400)
|
||||
18 |- await trio.sleep(86400.01) # error: 116, "async"
|
||||
18 |+ await trio.sleep_forever() # error: 116, "async"
|
||||
19 19 | await trio.sleep(86401) # error: 116, "async"
|
||||
20 20 |
|
||||
21 21 | await trio.sleep(-1) # will raise a runtime error
|
||||
15 |
|
||||
16 | await trio.sleep(86399)
|
||||
17 | await trio.sleep(86400)
|
||||
- await trio.sleep(86400.01) # error: 116, "async"
|
||||
18 + await trio.sleep_forever() # error: 116, "async"
|
||||
19 | await trio.sleep(86401) # error: 116, "async"
|
||||
20 |
|
||||
21 | await trio.sleep(-1) # will raise a runtime error
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
|
||||
--> ASYNC116.py:19:11
|
||||
|
|
@ -75,16 +72,15 @@ ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep
|
|||
21 | await trio.sleep(-1) # will raise a runtime error
|
||||
|
|
||||
help: Replace with `trio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
16 16 | await trio.sleep(86399)
|
||||
17 17 | await trio.sleep(86400)
|
||||
18 18 | await trio.sleep(86400.01) # error: 116, "async"
|
||||
19 |- await trio.sleep(86401) # error: 116, "async"
|
||||
19 |+ await trio.sleep_forever() # error: 116, "async"
|
||||
20 20 |
|
||||
21 21 | await trio.sleep(-1) # will raise a runtime error
|
||||
22 22 | await trio.sleep(0) # handled by different check
|
||||
16 | await trio.sleep(86399)
|
||||
17 | await trio.sleep(86400)
|
||||
18 | await trio.sleep(86400.01) # error: 116, "async"
|
||||
- await trio.sleep(86401) # error: 116, "async"
|
||||
19 + await trio.sleep_forever() # error: 116, "async"
|
||||
20 |
|
||||
21 | await trio.sleep(-1) # will raise a runtime error
|
||||
22 | await trio.sleep(0) # handled by different check
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
|
||||
--> ASYNC116.py:48:5
|
||||
|
|
@ -96,16 +92,15 @@ ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep
|
|||
50 | trio.run(trio.sleep(86401)) # error: 116, "async"
|
||||
|
|
||||
help: Replace with `trio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
45 45 | import trio
|
||||
46 46 |
|
||||
47 47 | # does not require the call to be awaited, nor in an async fun
|
||||
48 |- trio.sleep(86401) # error: 116, "async"
|
||||
48 |+ trio.sleep_forever() # error: 116, "async"
|
||||
49 49 | # also checks that we don't break visit_Call
|
||||
50 50 | trio.run(trio.sleep(86401)) # error: 116, "async"
|
||||
51 51 |
|
||||
45 | import trio
|
||||
46 |
|
||||
47 | # does not require the call to be awaited, nor in an async fun
|
||||
- trio.sleep(86401) # error: 116, "async"
|
||||
48 + trio.sleep_forever() # error: 116, "async"
|
||||
49 | # also checks that we don't break visit_Call
|
||||
50 | trio.run(trio.sleep(86401)) # error: 116, "async"
|
||||
51 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
|
||||
--> ASYNC116.py:50:14
|
||||
|
|
@ -116,16 +111,15 @@ ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep
|
|||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `trio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
47 47 | # does not require the call to be awaited, nor in an async fun
|
||||
48 48 | trio.sleep(86401) # error: 116, "async"
|
||||
49 49 | # also checks that we don't break visit_Call
|
||||
50 |- trio.run(trio.sleep(86401)) # error: 116, "async"
|
||||
50 |+ trio.run(trio.sleep_forever()) # error: 116, "async"
|
||||
51 51 |
|
||||
52 52 |
|
||||
53 53 | async def import_from_trio():
|
||||
47 | # does not require the call to be awaited, nor in an async fun
|
||||
48 | trio.sleep(86401) # error: 116, "async"
|
||||
49 | # also checks that we don't break visit_Call
|
||||
- trio.run(trio.sleep(86401)) # error: 116, "async"
|
||||
50 + trio.run(trio.sleep_forever()) # error: 116, "async"
|
||||
51 |
|
||||
52 |
|
||||
53 | async def import_from_trio():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
|
||||
--> ASYNC116.py:57:11
|
||||
|
|
@ -135,24 +129,23 @@ ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep
|
|||
| ^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `trio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
|
||||
3 3 | import math
|
||||
4 4 | from math import inf
|
||||
5 |+from trio import sleep_forever
|
||||
5 6 |
|
||||
6 7 |
|
||||
7 8 | async def import_trio():
|
||||
2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
|
||||
3 | import math
|
||||
4 | from math import inf
|
||||
5 + from trio import sleep_forever
|
||||
6 |
|
||||
7 |
|
||||
8 | async def import_trio():
|
||||
--------------------------------------------------------------------------------
|
||||
54 55 | from trio import sleep
|
||||
55 56 |
|
||||
56 57 | # catch from import
|
||||
57 |- await sleep(86401) # error: 116, "async"
|
||||
58 |+ await sleep_forever() # error: 116, "async"
|
||||
58 59 |
|
||||
59 60 |
|
||||
60 61 | async def import_anyio():
|
||||
55 | from trio import sleep
|
||||
56 |
|
||||
57 | # catch from import
|
||||
- await sleep(86401) # error: 116, "async"
|
||||
58 + await sleep_forever() # error: 116, "async"
|
||||
59 |
|
||||
60 |
|
||||
61 | async def import_anyio():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
|
||||
--> ASYNC116.py:64:11
|
||||
|
|
@ -164,16 +157,15 @@ ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sle
|
|||
66 | # 'inf literal' overflow trick
|
||||
|
|
||||
help: Replace with `anyio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
61 61 | import anyio
|
||||
62 62 |
|
||||
63 63 | # These examples are probably not meant to ever wake up:
|
||||
64 |- await anyio.sleep(100000) # error: 116, "async"
|
||||
64 |+ await anyio.sleep_forever() # error: 116, "async"
|
||||
65 65 |
|
||||
66 66 | # 'inf literal' overflow trick
|
||||
67 67 | await anyio.sleep(1e999) # error: 116, "async"
|
||||
61 | import anyio
|
||||
62 |
|
||||
63 | # These examples are probably not meant to ever wake up:
|
||||
- await anyio.sleep(100000) # error: 116, "async"
|
||||
64 + await anyio.sleep_forever() # error: 116, "async"
|
||||
65 |
|
||||
66 | # 'inf literal' overflow trick
|
||||
67 | await anyio.sleep(1e999) # error: 116, "async"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
|
||||
--> ASYNC116.py:67:11
|
||||
|
|
@ -185,16 +177,15 @@ ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sle
|
|||
69 | await anyio.sleep(86399)
|
||||
|
|
||||
help: Replace with `anyio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
64 64 | await anyio.sleep(100000) # error: 116, "async"
|
||||
65 65 |
|
||||
66 66 | # 'inf literal' overflow trick
|
||||
67 |- await anyio.sleep(1e999) # error: 116, "async"
|
||||
67 |+ await anyio.sleep_forever() # error: 116, "async"
|
||||
68 68 |
|
||||
69 69 | await anyio.sleep(86399)
|
||||
70 70 | await anyio.sleep(86400)
|
||||
64 | await anyio.sleep(100000) # error: 116, "async"
|
||||
65 |
|
||||
66 | # 'inf literal' overflow trick
|
||||
- await anyio.sleep(1e999) # error: 116, "async"
|
||||
67 + await anyio.sleep_forever() # error: 116, "async"
|
||||
68 |
|
||||
69 | await anyio.sleep(86399)
|
||||
70 | await anyio.sleep(86400)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
|
||||
--> ASYNC116.py:71:11
|
||||
|
|
@ -206,16 +197,15 @@ ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sle
|
|||
72 | await anyio.sleep(86401) # error: 116, "async"
|
||||
|
|
||||
help: Replace with `anyio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
68 68 |
|
||||
69 69 | await anyio.sleep(86399)
|
||||
70 70 | await anyio.sleep(86400)
|
||||
71 |- await anyio.sleep(86400.01) # error: 116, "async"
|
||||
71 |+ await anyio.sleep_forever() # error: 116, "async"
|
||||
72 72 | await anyio.sleep(86401) # error: 116, "async"
|
||||
73 73 |
|
||||
74 74 | await anyio.sleep(-1) # will raise a runtime error
|
||||
68 |
|
||||
69 | await anyio.sleep(86399)
|
||||
70 | await anyio.sleep(86400)
|
||||
- await anyio.sleep(86400.01) # error: 116, "async"
|
||||
71 + await anyio.sleep_forever() # error: 116, "async"
|
||||
72 | await anyio.sleep(86401) # error: 116, "async"
|
||||
73 |
|
||||
74 | await anyio.sleep(-1) # will raise a runtime error
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
|
||||
--> ASYNC116.py:72:11
|
||||
|
|
@ -228,16 +218,15 @@ ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sle
|
|||
74 | await anyio.sleep(-1) # will raise a runtime error
|
||||
|
|
||||
help: Replace with `anyio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
69 69 | await anyio.sleep(86399)
|
||||
70 70 | await anyio.sleep(86400)
|
||||
71 71 | await anyio.sleep(86400.01) # error: 116, "async"
|
||||
72 |- await anyio.sleep(86401) # error: 116, "async"
|
||||
72 |+ await anyio.sleep_forever() # error: 116, "async"
|
||||
73 73 |
|
||||
74 74 | await anyio.sleep(-1) # will raise a runtime error
|
||||
75 75 | await anyio.sleep(0) # handled by different check
|
||||
69 | await anyio.sleep(86399)
|
||||
70 | await anyio.sleep(86400)
|
||||
71 | await anyio.sleep(86400.01) # error: 116, "async"
|
||||
- await anyio.sleep(86401) # error: 116, "async"
|
||||
72 + await anyio.sleep_forever() # error: 116, "async"
|
||||
73 |
|
||||
74 | await anyio.sleep(-1) # will raise a runtime error
|
||||
75 | await anyio.sleep(0) # handled by different check
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
|
||||
--> ASYNC116.py:101:5
|
||||
|
|
@ -249,16 +238,15 @@ ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sle
|
|||
103 | anyio.run(anyio.sleep(86401)) # error: 116, "async"
|
||||
|
|
||||
help: Replace with `anyio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
98 98 | import anyio
|
||||
99 99 |
|
||||
100 100 | # does not require the call to be awaited, nor in an async fun
|
||||
101 |- anyio.sleep(86401) # error: 116, "async"
|
||||
101 |+ anyio.sleep_forever() # error: 116, "async"
|
||||
102 102 | # also checks that we don't break visit_Call
|
||||
103 103 | anyio.run(anyio.sleep(86401)) # error: 116, "async"
|
||||
104 104 |
|
||||
98 | import anyio
|
||||
99 |
|
||||
100 | # does not require the call to be awaited, nor in an async fun
|
||||
- anyio.sleep(86401) # error: 116, "async"
|
||||
101 + anyio.sleep_forever() # error: 116, "async"
|
||||
102 | # also checks that we don't break visit_Call
|
||||
103 | anyio.run(anyio.sleep(86401)) # error: 116, "async"
|
||||
104 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
|
||||
--> ASYNC116.py:103:15
|
||||
|
|
@ -269,16 +257,15 @@ ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sle
|
|||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `anyio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
100 100 | # does not require the call to be awaited, nor in an async fun
|
||||
101 101 | anyio.sleep(86401) # error: 116, "async"
|
||||
102 102 | # also checks that we don't break visit_Call
|
||||
103 |- anyio.run(anyio.sleep(86401)) # error: 116, "async"
|
||||
103 |+ anyio.run(anyio.sleep_forever()) # error: 116, "async"
|
||||
104 104 |
|
||||
105 105 |
|
||||
106 106 | async def import_from_anyio():
|
||||
100 | # does not require the call to be awaited, nor in an async fun
|
||||
101 | anyio.sleep(86401) # error: 116, "async"
|
||||
102 | # also checks that we don't break visit_Call
|
||||
- anyio.run(anyio.sleep(86401)) # error: 116, "async"
|
||||
103 + anyio.run(anyio.sleep_forever()) # error: 116, "async"
|
||||
104 |
|
||||
105 |
|
||||
106 | async def import_from_anyio():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
|
||||
--> ASYNC116.py:110:11
|
||||
|
|
@ -288,24 +275,23 @@ ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sle
|
|||
| ^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `anyio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
|
||||
3 3 | import math
|
||||
4 4 | from math import inf
|
||||
5 |+from anyio import sleep_forever
|
||||
5 6 |
|
||||
6 7 |
|
||||
7 8 | async def import_trio():
|
||||
2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger.
|
||||
3 | import math
|
||||
4 | from math import inf
|
||||
5 + from anyio import sleep_forever
|
||||
6 |
|
||||
7 |
|
||||
8 | async def import_trio():
|
||||
--------------------------------------------------------------------------------
|
||||
107 108 | from anyio import sleep
|
||||
108 109 |
|
||||
109 110 | # catch from import
|
||||
110 |- await sleep(86401) # error: 116, "async"
|
||||
111 |+ await sleep_forever() # error: 116, "async"
|
||||
111 112 |
|
||||
112 113 |
|
||||
113 114 | async def test_anyio_async116_helpers():
|
||||
108 | from anyio import sleep
|
||||
109 |
|
||||
110 | # catch from import
|
||||
- await sleep(86401) # error: 116, "async"
|
||||
111 + await sleep_forever() # error: 116, "async"
|
||||
112 |
|
||||
113 |
|
||||
114 | async def test_anyio_async116_helpers():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sleep_forever()`
|
||||
--> ASYNC116.py:119:11
|
||||
|
|
@ -317,16 +303,15 @@ ASYNC116 [*] `anyio.sleep()` with >24 hour interval should usually be `anyio.sle
|
|||
120 | await anyio.sleep(seconds=86401) # OK
|
||||
|
|
||||
help: Replace with `anyio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
116 116 | await anyio.sleep(delay=1) # OK
|
||||
117 117 | await anyio.sleep(seconds=1) # OK
|
||||
118 118 |
|
||||
119 |- await anyio.sleep(delay=86401) # ASYNC116
|
||||
119 |+ await anyio.sleep_forever() # ASYNC116
|
||||
120 120 | await anyio.sleep(seconds=86401) # OK
|
||||
121 121 |
|
||||
122 122 |
|
||||
116 | await anyio.sleep(delay=1) # OK
|
||||
117 | await anyio.sleep(seconds=1) # OK
|
||||
118 |
|
||||
- await anyio.sleep(delay=86401) # ASYNC116
|
||||
119 + await anyio.sleep_forever() # ASYNC116
|
||||
120 | await anyio.sleep(seconds=86401) # OK
|
||||
121 |
|
||||
122 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
|
||||
--> ASYNC116.py:129:11
|
||||
|
|
@ -338,16 +323,15 @@ ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep
|
|||
130 | await trio.sleep(delay=86401) # OK
|
||||
|
|
||||
help: Replace with `trio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
126 126 | await trio.sleep(seconds=1) # OK
|
||||
127 127 | await trio.sleep(delay=1) # OK
|
||||
128 128 |
|
||||
129 |- await trio.sleep(seconds=86401) # ASYNC116
|
||||
129 |+ await trio.sleep_forever() # ASYNC116
|
||||
130 130 | await trio.sleep(delay=86401) # OK
|
||||
131 131 |
|
||||
132 132 |
|
||||
126 | await trio.sleep(seconds=1) # OK
|
||||
127 | await trio.sleep(delay=1) # OK
|
||||
128 |
|
||||
- await trio.sleep(seconds=86401) # ASYNC116
|
||||
129 + await trio.sleep_forever() # ASYNC116
|
||||
130 | await trio.sleep(delay=86401) # OK
|
||||
131 |
|
||||
132 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
|
||||
--> ASYNC116.py:137:11
|
||||
|
|
@ -359,14 +343,13 @@ ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep
|
|||
138 | await trio.sleep(99999999999999999999)
|
||||
|
|
||||
help: Replace with `trio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
134 134 | import trio
|
||||
135 135 | from trio import sleep
|
||||
136 136 |
|
||||
137 |- await sleep(18446744073709551616)
|
||||
137 |+ await trio.sleep_forever()
|
||||
138 138 | await trio.sleep(99999999999999999999)
|
||||
134 | import trio
|
||||
135 | from trio import sleep
|
||||
136 |
|
||||
- await sleep(18446744073709551616)
|
||||
137 + await trio.sleep_forever()
|
||||
138 | await trio.sleep(99999999999999999999)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()`
|
||||
--> ASYNC116.py:138:11
|
||||
|
|
@ -376,10 +359,9 @@ ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `trio.sleep_forever()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
135 135 | from trio import sleep
|
||||
136 136 |
|
||||
137 137 | await sleep(18446744073709551616)
|
||||
138 |- await trio.sleep(99999999999999999999)
|
||||
138 |+ await trio.sleep_forever()
|
||||
135 | from trio import sleep
|
||||
136 |
|
||||
137 | await sleep(18446744073709551616)
|
||||
- await trio.sleep(99999999999999999999)
|
||||
138 + await trio.sleep_forever()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,15 +12,13 @@ B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable.
|
|||
5 | if getattr(o, "__call__", False):
|
||||
|
|
||||
help: Replace with `callable()`
|
||||
|
||||
ℹ Safe fix
|
||||
1 1 | def this_is_a_bug():
|
||||
2 2 | o = object()
|
||||
3 |- if hasattr(o, "__call__"):
|
||||
3 |+ if callable(o):
|
||||
4 4 | print("Ooh, callable! Or is it?")
|
||||
5 5 | if getattr(o, "__call__", False):
|
||||
6 6 | print("Ooh, callable! Or is it?")
|
||||
1 | def this_is_a_bug():
|
||||
2 | o = object()
|
||||
- if hasattr(o, "__call__"):
|
||||
3 + if callable(o):
|
||||
4 | print("Ooh, callable! Or is it?")
|
||||
5 | if getattr(o, "__call__", False):
|
||||
6 | print("Ooh, callable! Or is it?")
|
||||
|
||||
B004 Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
|
||||
--> B004.py:5:8
|
||||
|
|
@ -44,16 +42,14 @@ B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable.
|
|||
14 | if builtins.getattr(o, "__call__", False):
|
||||
|
|
||||
help: Replace with `callable()`
|
||||
|
||||
ℹ Safe fix
|
||||
9 9 | def still_a_bug():
|
||||
10 10 | import builtins
|
||||
11 11 | o = object()
|
||||
12 |- if builtins.hasattr(o, "__call__"):
|
||||
12 |+ if callable(o):
|
||||
13 13 | print("B U G")
|
||||
14 14 | if builtins.getattr(o, "__call__", False):
|
||||
15 15 | print("B U G")
|
||||
9 | def still_a_bug():
|
||||
10 | import builtins
|
||||
11 | o = object()
|
||||
- if builtins.hasattr(o, "__call__"):
|
||||
12 + if callable(o):
|
||||
13 | print("B U G")
|
||||
14 | if builtins.getattr(o, "__call__", False):
|
||||
15 | print("B U G")
|
||||
|
||||
B004 Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
|
||||
--> B004.py:14:8
|
||||
|
|
@ -76,21 +72,19 @@ B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable.
|
|||
25 | print("STILL a bug!")
|
||||
|
|
||||
help: Replace with `callable()`
|
||||
|
||||
ℹ Safe fix
|
||||
1 |+import builtins
|
||||
1 2 | def this_is_a_bug():
|
||||
2 3 | o = object()
|
||||
3 4 | if hasattr(o, "__call__"):
|
||||
1 + import builtins
|
||||
2 | def this_is_a_bug():
|
||||
3 | o = object()
|
||||
4 | if hasattr(o, "__call__"):
|
||||
--------------------------------------------------------------------------------
|
||||
21 22 | def callable(x):
|
||||
22 23 | return True
|
||||
23 24 |
|
||||
24 |- if hasattr(o, "__call__"):
|
||||
25 |+ if builtins.callable(o):
|
||||
25 26 | print("STILL a bug!")
|
||||
26 27 |
|
||||
27 28 |
|
||||
22 | def callable(x):
|
||||
23 | return True
|
||||
24 |
|
||||
- if hasattr(o, "__call__"):
|
||||
25 + if builtins.callable(o):
|
||||
26 | print("STILL a bug!")
|
||||
27 |
|
||||
28 |
|
||||
|
||||
B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
|
||||
--> B004.py:35:1
|
||||
|
|
@ -107,16 +101,15 @@ B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is unreliable.
|
|||
| |_^
|
||||
|
|
||||
help: Replace with `callable()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
32 32 |
|
||||
33 33 | # https://github.com/astral-sh/ruff/issues/18741
|
||||
34 34 | # The autofix for this is unsafe due to the comments.
|
||||
35 |-hasattr(
|
||||
36 |- # comment 1
|
||||
37 |- obj, # comment 2
|
||||
38 |- # comment 3
|
||||
39 |- "__call__", # comment 4
|
||||
40 |- # comment 5
|
||||
41 |-)
|
||||
35 |+callable(obj)
|
||||
32 |
|
||||
33 | # https://github.com/astral-sh/ruff/issues/18741
|
||||
34 | # The autofix for this is unsafe due to the comments.
|
||||
- hasattr(
|
||||
- # comment 1
|
||||
- obj, # comment 2
|
||||
- # comment 3
|
||||
- "__call__", # comment 4
|
||||
- # comment 5
|
||||
- )
|
||||
35 + callable(obj)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,11 +12,10 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
5 | """
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Docstring followed by a newline
|
||||
2 2 |
|
||||
3 |-def foobar(foor, bar={}):
|
||||
3 |+def foobar(foor, bar=None):
|
||||
4 4 | """
|
||||
5 5 | """
|
||||
1 | # Docstring followed by a newline
|
||||
2 |
|
||||
- def foobar(foor, bar={}):
|
||||
3 + def foobar(foor, bar=None):
|
||||
4 | """
|
||||
5 | """
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,12 +12,11 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
6 | """
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Docstring followed by whitespace with no newline
|
||||
2 2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155
|
||||
3 3 |
|
||||
4 |-def foobar(foor, bar={}):
|
||||
4 |+def foobar(foor, bar=None):
|
||||
5 5 | """
|
||||
6 6 | """
|
||||
1 | # Docstring followed by whitespace with no newline
|
||||
2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155
|
||||
3 |
|
||||
- def foobar(foor, bar={}):
|
||||
4 + def foobar(foor, bar=None):
|
||||
5 | """
|
||||
6 | """
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,12 +10,11 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
6 | """
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Docstring with no newline
|
||||
2 2 |
|
||||
3 3 |
|
||||
4 |-def foobar(foor, bar={}):
|
||||
4 |+def foobar(foor, bar=None):
|
||||
5 5 | """
|
||||
6 6 | """
|
||||
1 | # Docstring with no newline
|
||||
2 |
|
||||
3 |
|
||||
- def foobar(foor, bar={}):
|
||||
4 + def foobar(foor, bar=None):
|
||||
5 | """
|
||||
6 | """
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,14 +10,13 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
8 | print(a)
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 |
|
||||
5 5 |
|
||||
6 6 | class FormFeedIndent:
|
||||
7 |- def __init__(self, a=[]):
|
||||
7 |+ def __init__(self, a=None):
|
||||
8 |+ if a is None:
|
||||
9 |+ a = []
|
||||
8 10 | print(a)
|
||||
9 11 |
|
||||
4 |
|
||||
5 |
|
||||
6 | class FormFeedIndent:
|
||||
- def __init__(self, a=[]):
|
||||
7 + def __init__(self, a=None):
|
||||
8 + if a is None:
|
||||
9 + a = []
|
||||
10 | print(a)
|
||||
11 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -9,19 +9,18 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
6 | import os
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | # https://github.com/astral-sh/ruff/issues/7616
|
||||
3 3 |
|
||||
4 4 |
|
||||
5 |-def import_module_wrong(value: dict[str, str] = {}):
|
||||
5 |+def import_module_wrong(value: dict[str, str] = None):
|
||||
6 6 | import os
|
||||
7 |+ if value is None:
|
||||
8 |+ value = {}
|
||||
7 9 |
|
||||
8 10 |
|
||||
9 11 | def import_module_with_values_wrong(value: dict[str, str] = {}):
|
||||
2 | # https://github.com/astral-sh/ruff/issues/7616
|
||||
3 |
|
||||
4 |
|
||||
- def import_module_wrong(value: dict[str, str] = {}):
|
||||
5 + def import_module_wrong(value: dict[str, str] = None):
|
||||
6 | import os
|
||||
7 + if value is None:
|
||||
8 + value = {}
|
||||
9 |
|
||||
10 |
|
||||
11 | def import_module_with_values_wrong(value: dict[str, str] = {}):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:9:61
|
||||
|
|
@ -31,20 +30,19 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
10 | import os
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 | import os
|
||||
7 7 |
|
||||
8 8 |
|
||||
9 |-def import_module_with_values_wrong(value: dict[str, str] = {}):
|
||||
9 |+def import_module_with_values_wrong(value: dict[str, str] = None):
|
||||
10 10 | import os
|
||||
11 11 |
|
||||
12 |+ if value is None:
|
||||
13 |+ value = {}
|
||||
12 14 | return 2
|
||||
13 15 |
|
||||
14 16 |
|
||||
6 | import os
|
||||
7 |
|
||||
8 |
|
||||
- def import_module_with_values_wrong(value: dict[str, str] = {}):
|
||||
9 + def import_module_with_values_wrong(value: dict[str, str] = None):
|
||||
10 | import os
|
||||
11 |
|
||||
12 + if value is None:
|
||||
13 + value = {}
|
||||
14 | return 2
|
||||
15 |
|
||||
16 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:15:50
|
||||
|
|
@ -55,21 +53,20 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
17 | import sys
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | return 2
|
||||
13 13 |
|
||||
14 14 |
|
||||
15 |-def import_modules_wrong(value: dict[str, str] = {}):
|
||||
15 |+def import_modules_wrong(value: dict[str, str] = None):
|
||||
16 16 | import os
|
||||
17 17 | import sys
|
||||
18 18 | import itertools
|
||||
19 |+ if value is None:
|
||||
20 |+ value = {}
|
||||
19 21 |
|
||||
20 22 |
|
||||
21 23 | def from_import_module_wrong(value: dict[str, str] = {}):
|
||||
12 | return 2
|
||||
13 |
|
||||
14 |
|
||||
- def import_modules_wrong(value: dict[str, str] = {}):
|
||||
15 + def import_modules_wrong(value: dict[str, str] = None):
|
||||
16 | import os
|
||||
17 | import sys
|
||||
18 | import itertools
|
||||
19 + if value is None:
|
||||
20 + value = {}
|
||||
21 |
|
||||
22 |
|
||||
23 | def from_import_module_wrong(value: dict[str, str] = {}):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:21:54
|
||||
|
|
@ -79,19 +76,18 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
22 | from os import path
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
18 18 | import itertools
|
||||
19 19 |
|
||||
20 20 |
|
||||
21 |-def from_import_module_wrong(value: dict[str, str] = {}):
|
||||
21 |+def from_import_module_wrong(value: dict[str, str] = None):
|
||||
22 22 | from os import path
|
||||
23 |+ if value is None:
|
||||
24 |+ value = {}
|
||||
23 25 |
|
||||
24 26 |
|
||||
25 27 | def from_imports_module_wrong(value: dict[str, str] = {}):
|
||||
18 | import itertools
|
||||
19 |
|
||||
20 |
|
||||
- def from_import_module_wrong(value: dict[str, str] = {}):
|
||||
21 + def from_import_module_wrong(value: dict[str, str] = None):
|
||||
22 | from os import path
|
||||
23 + if value is None:
|
||||
24 + value = {}
|
||||
25 |
|
||||
26 |
|
||||
27 | def from_imports_module_wrong(value: dict[str, str] = {}):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:25:55
|
||||
|
|
@ -102,20 +98,19 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
27 | from sys import version_info
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 | from os import path
|
||||
23 23 |
|
||||
24 24 |
|
||||
25 |-def from_imports_module_wrong(value: dict[str, str] = {}):
|
||||
25 |+def from_imports_module_wrong(value: dict[str, str] = None):
|
||||
26 26 | from os import path
|
||||
27 27 | from sys import version_info
|
||||
28 |+ if value is None:
|
||||
29 |+ value = {}
|
||||
28 30 |
|
||||
29 31 |
|
||||
30 32 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}):
|
||||
22 | from os import path
|
||||
23 |
|
||||
24 |
|
||||
- def from_imports_module_wrong(value: dict[str, str] = {}):
|
||||
25 + def from_imports_module_wrong(value: dict[str, str] = None):
|
||||
26 | from os import path
|
||||
27 | from sys import version_info
|
||||
28 + if value is None:
|
||||
29 + value = {}
|
||||
30 |
|
||||
31 |
|
||||
32 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:30:66
|
||||
|
|
@ -126,20 +121,19 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
32 | from sys import version_info
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
27 27 | from sys import version_info
|
||||
28 28 |
|
||||
29 29 |
|
||||
30 |-def import_and_from_imports_module_wrong(value: dict[str, str] = {}):
|
||||
30 |+def import_and_from_imports_module_wrong(value: dict[str, str] = None):
|
||||
31 31 | import os
|
||||
32 32 | from sys import version_info
|
||||
33 |+ if value is None:
|
||||
34 |+ value = {}
|
||||
33 35 |
|
||||
34 36 |
|
||||
35 37 | def import_docstring_module_wrong(value: dict[str, str] = {}):
|
||||
27 | from sys import version_info
|
||||
28 |
|
||||
29 |
|
||||
- def import_and_from_imports_module_wrong(value: dict[str, str] = {}):
|
||||
30 + def import_and_from_imports_module_wrong(value: dict[str, str] = None):
|
||||
31 | import os
|
||||
32 | from sys import version_info
|
||||
33 + if value is None:
|
||||
34 + value = {}
|
||||
35 |
|
||||
36 |
|
||||
37 | def import_docstring_module_wrong(value: dict[str, str] = {}):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:35:59
|
||||
|
|
@ -150,20 +144,19 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
37 | import os
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
32 32 | from sys import version_info
|
||||
33 33 |
|
||||
34 34 |
|
||||
35 |-def import_docstring_module_wrong(value: dict[str, str] = {}):
|
||||
35 |+def import_docstring_module_wrong(value: dict[str, str] = None):
|
||||
36 36 | """Docstring"""
|
||||
37 37 | import os
|
||||
38 |+ if value is None:
|
||||
39 |+ value = {}
|
||||
38 40 |
|
||||
39 41 |
|
||||
40 42 | def import_module_wrong(value: dict[str, str] = {}):
|
||||
32 | from sys import version_info
|
||||
33 |
|
||||
34 |
|
||||
- def import_docstring_module_wrong(value: dict[str, str] = {}):
|
||||
35 + def import_docstring_module_wrong(value: dict[str, str] = None):
|
||||
36 | """Docstring"""
|
||||
37 | import os
|
||||
38 + if value is None:
|
||||
39 + value = {}
|
||||
40 |
|
||||
41 |
|
||||
42 | def import_module_wrong(value: dict[str, str] = {}):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:40:49
|
||||
|
|
@ -174,20 +167,19 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
42 | import os; import sys
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
37 37 | import os
|
||||
38 38 |
|
||||
39 39 |
|
||||
40 |-def import_module_wrong(value: dict[str, str] = {}):
|
||||
40 |+def import_module_wrong(value: dict[str, str] = None):
|
||||
41 41 | """Docstring"""
|
||||
42 42 | import os; import sys
|
||||
43 |+ if value is None:
|
||||
44 |+ value = {}
|
||||
43 45 |
|
||||
44 46 |
|
||||
45 47 | def import_module_wrong(value: dict[str, str] = {}):
|
||||
37 | import os
|
||||
38 |
|
||||
39 |
|
||||
- def import_module_wrong(value: dict[str, str] = {}):
|
||||
40 + def import_module_wrong(value: dict[str, str] = None):
|
||||
41 | """Docstring"""
|
||||
42 | import os; import sys
|
||||
43 + if value is None:
|
||||
44 + value = {}
|
||||
45 |
|
||||
46 |
|
||||
47 | def import_module_wrong(value: dict[str, str] = {}):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:45:49
|
||||
|
|
@ -198,19 +190,18 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
47 | import os; import sys; x = 1
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
42 42 | import os; import sys
|
||||
43 43 |
|
||||
44 44 |
|
||||
45 |-def import_module_wrong(value: dict[str, str] = {}):
|
||||
45 |+def import_module_wrong(value: dict[str, str] = None):
|
||||
46 46 | """Docstring"""
|
||||
47 |+ if value is None:
|
||||
48 |+ value = {}
|
||||
47 49 | import os; import sys; x = 1
|
||||
48 50 |
|
||||
49 51 |
|
||||
42 | import os; import sys
|
||||
43 |
|
||||
44 |
|
||||
- def import_module_wrong(value: dict[str, str] = {}):
|
||||
45 + def import_module_wrong(value: dict[str, str] = None):
|
||||
46 | """Docstring"""
|
||||
47 + if value is None:
|
||||
48 + value = {}
|
||||
49 | import os; import sys; x = 1
|
||||
50 |
|
||||
51 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:50:49
|
||||
|
|
@ -221,20 +212,19 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
52 | import os; import sys
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
47 47 | import os; import sys; x = 1
|
||||
48 48 |
|
||||
49 49 |
|
||||
50 |-def import_module_wrong(value: dict[str, str] = {}):
|
||||
50 |+def import_module_wrong(value: dict[str, str] = None):
|
||||
51 51 | """Docstring"""
|
||||
52 52 | import os; import sys
|
||||
53 |+ if value is None:
|
||||
54 |+ value = {}
|
||||
53 55 |
|
||||
54 56 |
|
||||
55 57 | def import_module_wrong(value: dict[str, str] = {}):
|
||||
47 | import os; import sys; x = 1
|
||||
48 |
|
||||
49 |
|
||||
- def import_module_wrong(value: dict[str, str] = {}):
|
||||
50 + def import_module_wrong(value: dict[str, str] = None):
|
||||
51 | """Docstring"""
|
||||
52 | import os; import sys
|
||||
53 + if value is None:
|
||||
54 + value = {}
|
||||
55 |
|
||||
56 |
|
||||
57 | def import_module_wrong(value: dict[str, str] = {}):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:55:49
|
||||
|
|
@ -244,19 +234,18 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
56 | import os; import sys
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
52 52 | import os; import sys
|
||||
53 53 |
|
||||
54 54 |
|
||||
55 |-def import_module_wrong(value: dict[str, str] = {}):
|
||||
55 |+def import_module_wrong(value: dict[str, str] = None):
|
||||
56 56 | import os; import sys
|
||||
57 |+ if value is None:
|
||||
58 |+ value = {}
|
||||
57 59 |
|
||||
58 60 |
|
||||
59 61 | def import_module_wrong(value: dict[str, str] = {}):
|
||||
52 | import os; import sys
|
||||
53 |
|
||||
54 |
|
||||
- def import_module_wrong(value: dict[str, str] = {}):
|
||||
55 + def import_module_wrong(value: dict[str, str] = None):
|
||||
56 | import os; import sys
|
||||
57 + if value is None:
|
||||
58 + value = {}
|
||||
59 |
|
||||
60 |
|
||||
61 | def import_module_wrong(value: dict[str, str] = {}):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:59:49
|
||||
|
|
@ -266,18 +255,17 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
60 | import os; import sys; x = 1
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
56 56 | import os; import sys
|
||||
57 57 |
|
||||
58 58 |
|
||||
59 |-def import_module_wrong(value: dict[str, str] = {}):
|
||||
59 |+def import_module_wrong(value: dict[str, str] = None):
|
||||
60 |+ if value is None:
|
||||
61 |+ value = {}
|
||||
60 62 | import os; import sys; x = 1
|
||||
61 63 |
|
||||
62 64 |
|
||||
56 | import os; import sys
|
||||
57 |
|
||||
58 |
|
||||
- def import_module_wrong(value: dict[str, str] = {}):
|
||||
59 + def import_module_wrong(value: dict[str, str] = None):
|
||||
60 + if value is None:
|
||||
61 + value = {}
|
||||
62 | import os; import sys; x = 1
|
||||
63 |
|
||||
64 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:63:49
|
||||
|
|
@ -287,19 +275,18 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
64 | import os; import sys
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
60 60 | import os; import sys; x = 1
|
||||
61 61 |
|
||||
62 62 |
|
||||
63 |-def import_module_wrong(value: dict[str, str] = {}):
|
||||
63 |+def import_module_wrong(value: dict[str, str] = None):
|
||||
64 64 | import os; import sys
|
||||
65 |+ if value is None:
|
||||
66 |+ value = {}
|
||||
65 67 |
|
||||
66 68 |
|
||||
67 69 | def import_module_wrong(value: dict[str, str] = {}): import os
|
||||
60 | import os; import sys; x = 1
|
||||
61 |
|
||||
62 |
|
||||
- def import_module_wrong(value: dict[str, str] = {}):
|
||||
63 + def import_module_wrong(value: dict[str, str] = None):
|
||||
64 | import os; import sys
|
||||
65 + if value is None:
|
||||
66 + value = {}
|
||||
67 |
|
||||
68 |
|
||||
69 | def import_module_wrong(value: dict[str, str] = {}): import os
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 Do not use mutable data structures for argument defaults
|
||||
--> B006_5.py:67:49
|
||||
|
|
|
|||
|
|
@ -11,14 +11,13 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
5 | import os
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Import followed by whitespace with no newline
|
||||
2 2 | # Same as B006_2.py, but import instead of docstring
|
||||
3 3 |
|
||||
4 |-def foobar(foor, bar={}):
|
||||
5 |- import os
|
||||
4 |+def foobar(foor, bar=None):
|
||||
5 |+ import os
|
||||
6 |+ if bar is None:
|
||||
7 |+ bar = {}
|
||||
1 | # Import followed by whitespace with no newline
|
||||
2 | # Same as B006_2.py, but import instead of docstring
|
||||
3 |
|
||||
- def foobar(foor, bar={}):
|
||||
- import os
|
||||
4 + def foobar(foor, bar=None):
|
||||
5 + import os
|
||||
6 + if bar is None:
|
||||
7 + bar = {}
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -11,14 +11,13 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
5 | import os
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Import with no newline
|
||||
2 2 | # Same as B006_3.py, but import instead of docstring
|
||||
3 3 |
|
||||
4 |-def foobar(foor, bar={}):
|
||||
5 |- import os
|
||||
4 |+def foobar(foor, bar=None):
|
||||
5 |+ import os
|
||||
6 |+ if bar is None:
|
||||
7 |+ bar = {}
|
||||
1 | # Import with no newline
|
||||
2 | # Same as B006_3.py, but import instead of docstring
|
||||
3 |
|
||||
- def foobar(foor, bar={}):
|
||||
- import os
|
||||
4 + def foobar(foor, bar=None):
|
||||
5 + import os
|
||||
6 + if bar is None:
|
||||
7 + bar = {}
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -9,13 +9,12 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
2 | raise NotImplementedError("")
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-def foo(a: list = []):
|
||||
1 |+def foo(a: list = None):
|
||||
2 2 | raise NotImplementedError("")
|
||||
3 3 |
|
||||
4 4 |
|
||||
- def foo(a: list = []):
|
||||
1 + def foo(a: list = None):
|
||||
2 | raise NotImplementedError("")
|
||||
3 |
|
||||
4 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_8.py:5:19
|
||||
|
|
@ -26,16 +25,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
7 | raise NotImplementedError("and has some text in here")
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | raise NotImplementedError("")
|
||||
3 3 |
|
||||
4 4 |
|
||||
5 |-def bar(a: dict = {}):
|
||||
5 |+def bar(a: dict = None):
|
||||
6 6 | """ This one also has a docstring"""
|
||||
7 7 | raise NotImplementedError("and has some text in here")
|
||||
8 8 |
|
||||
2 | raise NotImplementedError("")
|
||||
3 |
|
||||
4 |
|
||||
- def bar(a: dict = {}):
|
||||
5 + def bar(a: dict = None):
|
||||
6 | """ This one also has a docstring"""
|
||||
7 | raise NotImplementedError("and has some text in here")
|
||||
8 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_8.py:10:19
|
||||
|
|
@ -46,19 +44,18 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
12 | raise IndexError()
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | raise NotImplementedError("and has some text in here")
|
||||
8 8 |
|
||||
9 9 |
|
||||
10 |-def baz(a: list = []):
|
||||
10 |+def baz(a: list = None):
|
||||
11 11 | """This one raises a different exception"""
|
||||
12 |+ if a is None:
|
||||
13 |+ a = []
|
||||
12 14 | raise IndexError()
|
||||
13 15 |
|
||||
14 16 |
|
||||
7 | raise NotImplementedError("and has some text in here")
|
||||
8 |
|
||||
9 |
|
||||
- def baz(a: list = []):
|
||||
10 + def baz(a: list = None):
|
||||
11 | """This one raises a different exception"""
|
||||
12 + if a is None:
|
||||
13 + a = []
|
||||
14 | raise IndexError()
|
||||
15 |
|
||||
16 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_8.py:15:19
|
||||
|
|
@ -68,16 +65,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
16 | raise NotImplementedError
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | raise IndexError()
|
||||
13 13 |
|
||||
14 14 |
|
||||
15 |-def qux(a: list = []):
|
||||
15 |+def qux(a: list = None):
|
||||
16 16 | raise NotImplementedError
|
||||
17 17 |
|
||||
18 18 |
|
||||
12 | raise IndexError()
|
||||
13 |
|
||||
14 |
|
||||
- def qux(a: list = []):
|
||||
15 + def qux(a: list = None):
|
||||
16 | raise NotImplementedError
|
||||
17 |
|
||||
18 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_8.py:19:20
|
||||
|
|
@ -87,11 +83,10 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
20 | raise NotImplemented
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
16 16 | raise NotImplementedError
|
||||
17 17 |
|
||||
18 18 |
|
||||
19 |-def quux(a: list = []):
|
||||
19 |+def quux(a: list = None):
|
||||
20 20 | raise NotImplemented
|
||||
16 | raise NotImplementedError
|
||||
17 |
|
||||
18 |
|
||||
- def quux(a: list = []):
|
||||
19 + def quux(a: list = None):
|
||||
20 | raise NotImplemented
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -9,16 +9,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
64 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
60 60 | # Flag mutable literals/comprehensions
|
||||
61 61 |
|
||||
62 62 |
|
||||
63 |-def this_is_wrong(value=[1, 2, 3]):
|
||||
63 |+def this_is_wrong(value=None):
|
||||
64 64 | ...
|
||||
65 65 |
|
||||
66 66 |
|
||||
60 | # Flag mutable literals/comprehensions
|
||||
61 |
|
||||
62 |
|
||||
- def this_is_wrong(value=[1, 2, 3]):
|
||||
63 + def this_is_wrong(value=None):
|
||||
64 | ...
|
||||
65 |
|
||||
66 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:67:30
|
||||
|
|
@ -28,16 +27,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
68 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
64 64 | ...
|
||||
65 65 |
|
||||
66 66 |
|
||||
67 |-def this_is_also_wrong(value={}):
|
||||
67 |+def this_is_also_wrong(value=None):
|
||||
68 68 | ...
|
||||
69 69 |
|
||||
70 70 |
|
||||
64 | ...
|
||||
65 |
|
||||
66 |
|
||||
- def this_is_also_wrong(value={}):
|
||||
67 + def this_is_also_wrong(value=None):
|
||||
68 | ...
|
||||
69 |
|
||||
70 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:73:52
|
||||
|
|
@ -49,16 +47,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
74 | pass
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
70 70 |
|
||||
71 71 | class Foo:
|
||||
72 72 | @staticmethod
|
||||
73 |- def this_is_also_wrong_and_more_indented(value={}):
|
||||
73 |+ def this_is_also_wrong_and_more_indented(value=None):
|
||||
74 74 | pass
|
||||
75 75 |
|
||||
76 76 |
|
||||
70 |
|
||||
71 | class Foo:
|
||||
72 | @staticmethod
|
||||
- def this_is_also_wrong_and_more_indented(value={}):
|
||||
73 + def this_is_also_wrong_and_more_indented(value=None):
|
||||
74 | pass
|
||||
75 |
|
||||
76 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:77:31
|
||||
|
|
@ -71,18 +68,17 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
80 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
74 74 | pass
|
||||
75 75 |
|
||||
76 76 |
|
||||
77 |-def multiline_arg_wrong(value={
|
||||
78 |-
|
||||
79 |-}):
|
||||
77 |+def multiline_arg_wrong(value=None):
|
||||
80 78 | ...
|
||||
81 79 |
|
||||
82 80 | def single_line_func_wrong(value = {}): ...
|
||||
74 | pass
|
||||
75 |
|
||||
76 |
|
||||
- def multiline_arg_wrong(value={
|
||||
-
|
||||
- }):
|
||||
77 + def multiline_arg_wrong(value=None):
|
||||
78 | ...
|
||||
79 |
|
||||
80 | def single_line_func_wrong(value = {}): ...
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:82:36
|
||||
|
|
@ -102,16 +98,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
86 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
82 82 | def single_line_func_wrong(value = {}): ...
|
||||
83 83 |
|
||||
84 84 |
|
||||
85 |-def and_this(value=set()):
|
||||
85 |+def and_this(value=None):
|
||||
86 86 | ...
|
||||
87 87 |
|
||||
88 88 |
|
||||
82 | def single_line_func_wrong(value = {}): ...
|
||||
83 |
|
||||
84 |
|
||||
- def and_this(value=set()):
|
||||
85 + def and_this(value=None):
|
||||
86 | ...
|
||||
87 |
|
||||
88 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:89:20
|
||||
|
|
@ -121,16 +116,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
90 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
86 86 | ...
|
||||
87 87 |
|
||||
88 88 |
|
||||
89 |-def this_too(value=collections.OrderedDict()):
|
||||
89 |+def this_too(value=None):
|
||||
90 90 | ...
|
||||
91 91 |
|
||||
92 92 |
|
||||
86 | ...
|
||||
87 |
|
||||
88 |
|
||||
- def this_too(value=collections.OrderedDict()):
|
||||
89 + def this_too(value=None):
|
||||
90 | ...
|
||||
91 |
|
||||
92 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:93:32
|
||||
|
|
@ -140,16 +134,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
94 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
90 90 | ...
|
||||
91 91 |
|
||||
92 92 |
|
||||
93 |-async def async_this_too(value=collections.defaultdict()):
|
||||
93 |+async def async_this_too(value=None):
|
||||
94 94 | ...
|
||||
95 95 |
|
||||
96 96 |
|
||||
90 | ...
|
||||
91 |
|
||||
92 |
|
||||
- async def async_this_too(value=collections.defaultdict()):
|
||||
93 + async def async_this_too(value=None):
|
||||
94 | ...
|
||||
95 |
|
||||
96 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:97:26
|
||||
|
|
@ -159,16 +152,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
98 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
94 94 | ...
|
||||
95 95 |
|
||||
96 96 |
|
||||
97 |-def dont_forget_me(value=collections.deque()):
|
||||
97 |+def dont_forget_me(value=None):
|
||||
98 98 | ...
|
||||
99 99 |
|
||||
100 100 |
|
||||
94 | ...
|
||||
95 |
|
||||
96 |
|
||||
- def dont_forget_me(value=collections.deque()):
|
||||
97 + def dont_forget_me(value=None):
|
||||
98 | ...
|
||||
99 |
|
||||
100 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:102:46
|
||||
|
|
@ -179,16 +171,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
103 | pass
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
99 99 |
|
||||
100 100 |
|
||||
101 101 | # N.B. we're also flagging the function call in the comprehension
|
||||
102 |-def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]):
|
||||
102 |+def list_comprehension_also_not_okay(default=None):
|
||||
103 103 | pass
|
||||
104 104 |
|
||||
105 105 |
|
||||
99 |
|
||||
100 |
|
||||
101 | # N.B. we're also flagging the function call in the comprehension
|
||||
- def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]):
|
||||
102 + def list_comprehension_also_not_okay(default=None):
|
||||
103 | pass
|
||||
104 |
|
||||
105 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:106:46
|
||||
|
|
@ -198,16 +189,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
107 | pass
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
103 103 | pass
|
||||
104 104 |
|
||||
105 105 |
|
||||
106 |-def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}):
|
||||
106 |+def dict_comprehension_also_not_okay(default=None):
|
||||
107 107 | pass
|
||||
108 108 |
|
||||
109 109 |
|
||||
103 | pass
|
||||
104 |
|
||||
105 |
|
||||
- def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}):
|
||||
106 + def dict_comprehension_also_not_okay(default=None):
|
||||
107 | pass
|
||||
108 |
|
||||
109 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:110:45
|
||||
|
|
@ -217,16 +207,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
111 | pass
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
107 107 | pass
|
||||
108 108 |
|
||||
109 109 |
|
||||
110 |-def set_comprehension_also_not_okay(default={i**2 for i in range(3)}):
|
||||
110 |+def set_comprehension_also_not_okay(default=None):
|
||||
111 111 | pass
|
||||
112 112 |
|
||||
113 113 |
|
||||
107 | pass
|
||||
108 |
|
||||
109 |
|
||||
- def set_comprehension_also_not_okay(default={i**2 for i in range(3)}):
|
||||
110 + def set_comprehension_also_not_okay(default=None):
|
||||
111 | pass
|
||||
112 |
|
||||
113 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:114:33
|
||||
|
|
@ -236,16 +225,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
115 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
111 111 | pass
|
||||
112 112 |
|
||||
113 113 |
|
||||
114 |-def kwonlyargs_mutable(*, value=[]):
|
||||
114 |+def kwonlyargs_mutable(*, value=None):
|
||||
115 115 | ...
|
||||
116 116 |
|
||||
117 117 |
|
||||
111 | pass
|
||||
112 |
|
||||
113 |
|
||||
- def kwonlyargs_mutable(*, value=[]):
|
||||
114 + def kwonlyargs_mutable(*, value=None):
|
||||
115 | ...
|
||||
116 |
|
||||
117 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:239:20
|
||||
|
|
@ -257,16 +245,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
240 | pass
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
236 236 |
|
||||
237 237 | # B006 and B008
|
||||
238 238 | # We should handle arbitrary nesting of these B008.
|
||||
239 |-def nested_combo(a=[float(3), dt.datetime.now()]):
|
||||
239 |+def nested_combo(a=None):
|
||||
240 240 | pass
|
||||
241 241 |
|
||||
242 242 |
|
||||
236 |
|
||||
237 | # B006 and B008
|
||||
238 | # We should handle arbitrary nesting of these B008.
|
||||
- def nested_combo(a=[float(3), dt.datetime.now()]):
|
||||
239 + def nested_combo(a=None):
|
||||
240 | pass
|
||||
241 |
|
||||
242 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:276:27
|
||||
|
|
@ -278,16 +265,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
273 273 |
|
||||
274 274 |
|
||||
275 275 | def mutable_annotations(
|
||||
276 |- a: list[int] | None = [],
|
||||
276 |+ a: list[int] | None = None,
|
||||
277 277 | b: Optional[Dict[int, int]] = {},
|
||||
278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
273 |
|
||||
274 |
|
||||
275 | def mutable_annotations(
|
||||
- a: list[int] | None = [],
|
||||
276 + a: list[int] | None = None,
|
||||
277 | b: Optional[Dict[int, int]] = {},
|
||||
278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:277:35
|
||||
|
|
@ -300,16 +286,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
274 274 |
|
||||
275 275 | def mutable_annotations(
|
||||
276 276 | a: list[int] | None = [],
|
||||
277 |- b: Optional[Dict[int, int]] = {},
|
||||
277 |+ b: Optional[Dict[int, int]] = None,
|
||||
278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
280 280 | ):
|
||||
274 |
|
||||
275 | def mutable_annotations(
|
||||
276 | a: list[int] | None = [],
|
||||
- b: Optional[Dict[int, int]] = {},
|
||||
277 + b: Optional[Dict[int, int]] = None,
|
||||
278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
280 | ):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:278:62
|
||||
|
|
@ -322,16 +307,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
280 | ):
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
275 275 | def mutable_annotations(
|
||||
276 276 | a: list[int] | None = [],
|
||||
277 277 | b: Optional[Dict[int, int]] = {},
|
||||
278 |- c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
278 |+ c: Annotated[Union[Set[str], abc.Sized], "annotation"] = None,
|
||||
279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
280 280 | ):
|
||||
281 281 | pass
|
||||
275 | def mutable_annotations(
|
||||
276 | a: list[int] | None = [],
|
||||
277 | b: Optional[Dict[int, int]] = {},
|
||||
- c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
278 + c: Annotated[Union[Set[str], abc.Sized], "annotation"] = None,
|
||||
279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
280 | ):
|
||||
281 | pass
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:279:80
|
||||
|
|
@ -344,16 +328,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
281 | pass
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
276 276 | a: list[int] | None = [],
|
||||
277 277 | b: Optional[Dict[int, int]] = {},
|
||||
278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 |- d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 |+ d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = None,
|
||||
280 280 | ):
|
||||
281 281 | pass
|
||||
282 282 |
|
||||
276 | a: list[int] | None = [],
|
||||
277 | b: Optional[Dict[int, int]] = {},
|
||||
278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
- d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
|
||||
279 + d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = None,
|
||||
280 | ):
|
||||
281 | pass
|
||||
282 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:284:52
|
||||
|
|
@ -363,16 +346,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
285 | """Docstring"""
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
281 281 | pass
|
||||
282 282 |
|
||||
283 283 |
|
||||
284 |-def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
284 |+def single_line_func_wrong(value: dict[str, str] = None):
|
||||
285 285 | """Docstring"""
|
||||
286 286 |
|
||||
287 287 |
|
||||
281 | pass
|
||||
282 |
|
||||
283 |
|
||||
- def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
284 + def single_line_func_wrong(value: dict[str, str] = None):
|
||||
285 | """Docstring"""
|
||||
286 |
|
||||
287 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:288:52
|
||||
|
|
@ -383,16 +365,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
290 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
285 285 | """Docstring"""
|
||||
286 286 |
|
||||
287 287 |
|
||||
288 |-def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
288 |+def single_line_func_wrong(value: dict[str, str] = None):
|
||||
289 289 | """Docstring"""
|
||||
290 290 | ...
|
||||
291 291 |
|
||||
285 | """Docstring"""
|
||||
286 |
|
||||
287 |
|
||||
- def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
288 + def single_line_func_wrong(value: dict[str, str] = None):
|
||||
289 | """Docstring"""
|
||||
290 | ...
|
||||
291 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:293:52
|
||||
|
|
@ -402,16 +383,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
294 | """Docstring"""; ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
290 290 | ...
|
||||
291 291 |
|
||||
292 292 |
|
||||
293 |-def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
293 |+def single_line_func_wrong(value: dict[str, str] = None):
|
||||
294 294 | """Docstring"""; ...
|
||||
295 295 |
|
||||
296 296 |
|
||||
290 | ...
|
||||
291 |
|
||||
292 |
|
||||
- def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
293 + def single_line_func_wrong(value: dict[str, str] = None):
|
||||
294 | """Docstring"""; ...
|
||||
295 |
|
||||
296 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:297:52
|
||||
|
|
@ -422,16 +402,15 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
299 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
294 294 | """Docstring"""; ...
|
||||
295 295 |
|
||||
296 296 |
|
||||
297 |-def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
297 |+def single_line_func_wrong(value: dict[str, str] = None):
|
||||
298 298 | """Docstring"""; \
|
||||
299 299 | ...
|
||||
300 300 |
|
||||
294 | """Docstring"""; ...
|
||||
295 |
|
||||
296 |
|
||||
- def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
297 + def single_line_func_wrong(value: dict[str, str] = None):
|
||||
298 | """Docstring"""; \
|
||||
299 | ...
|
||||
300 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 [*] Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:302:52
|
||||
|
|
@ -444,18 +423,17 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
305 | """Docstring"""
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
299 299 | ...
|
||||
300 300 |
|
||||
301 301 |
|
||||
302 |-def single_line_func_wrong(value: dict[str, str] = {
|
||||
303 |- # This is a comment
|
||||
304 |-}):
|
||||
302 |+def single_line_func_wrong(value: dict[str, str] = None):
|
||||
305 303 | """Docstring"""
|
||||
306 304 |
|
||||
307 305 |
|
||||
299 | ...
|
||||
300 |
|
||||
301 |
|
||||
- def single_line_func_wrong(value: dict[str, str] = {
|
||||
- # This is a comment
|
||||
- }):
|
||||
302 + def single_line_func_wrong(value: dict[str, str] = None):
|
||||
303 | """Docstring"""
|
||||
304 |
|
||||
305 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B006 Do not use mutable data structures for argument defaults
|
||||
--> B006_B008.py:308:52
|
||||
|
|
@ -475,11 +453,10 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
314 | """Docstring without newline"""
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
310 310 | """Docstring"""
|
||||
311 311 |
|
||||
312 312 |
|
||||
313 |-def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
313 |+def single_line_func_wrong(value: dict[str, str] = None):
|
||||
314 314 | """Docstring without newline"""
|
||||
310 | """Docstring"""
|
||||
311 |
|
||||
312 |
|
||||
- def single_line_func_wrong(value: dict[str, str] = {}):
|
||||
313 + def single_line_func_wrong(value: dict[str, str] = None):
|
||||
314 | """Docstring without newline"""
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -22,16 +22,15 @@ B007 [*] Loop control variable `k` not used within loop body
|
|||
19 | print(i + j)
|
||||
|
|
||||
help: Rename unused `k` to `_k`
|
||||
|
||||
ℹ Unsafe fix
|
||||
15 15 |
|
||||
16 16 | for i in range(10):
|
||||
17 17 | for j in range(10):
|
||||
18 |- for k in range(10): # k not used, i and j used transitively
|
||||
18 |+ for _k in range(10): # k not used, i and j used transitively
|
||||
19 19 | print(i + j)
|
||||
20 20 |
|
||||
21 21 |
|
||||
15 |
|
||||
16 | for i in range(10):
|
||||
17 | for j in range(10):
|
||||
- for k in range(10): # k not used, i and j used transitively
|
||||
18 + for _k in range(10): # k not used, i and j used transitively
|
||||
19 | print(i + j)
|
||||
20 |
|
||||
21 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B007 Loop control variable `i` not used within loop body
|
||||
--> B007.py:30:5
|
||||
|
|
@ -50,16 +49,15 @@ B007 [*] Loop control variable `k` not used within loop body
|
|||
31 | print(j, l)
|
||||
|
|
||||
help: Rename unused `k` to `_k`
|
||||
|
||||
ℹ Unsafe fix
|
||||
27 27 | yield i, (j, (k, l))
|
||||
28 28 |
|
||||
29 29 |
|
||||
30 |-for i, (j, (k, l)) in strange_generator(): # i, k not used
|
||||
30 |+for i, (j, (_k, l)) in strange_generator(): # i, k not used
|
||||
31 31 | print(j, l)
|
||||
32 32 |
|
||||
33 33 | FMT = "{foo} {bar}"
|
||||
27 | yield i, (j, (k, l))
|
||||
28 |
|
||||
29 |
|
||||
- for i, (j, (k, l)) in strange_generator(): # i, k not used
|
||||
30 + for i, (j, (_k, l)) in strange_generator(): # i, k not used
|
||||
31 | print(j, l)
|
||||
32 |
|
||||
33 | FMT = "{foo} {bar}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B007 Loop control variable `bar` may not be used within loop body
|
||||
--> B007.py:34:10
|
||||
|
|
@ -118,16 +116,15 @@ B007 [*] Loop control variable `bar` not used within loop body
|
|||
54 | break
|
||||
|
|
||||
help: Rename unused `bar` to `_bar`
|
||||
|
||||
ℹ Unsafe fix
|
||||
49 49 |
|
||||
50 50 | def f():
|
||||
51 51 | # Fixable.
|
||||
52 |- for foo, bar, baz in (["1", "2", "3"],):
|
||||
52 |+ for foo, _bar, baz in (["1", "2", "3"],):
|
||||
53 53 | if foo or baz:
|
||||
54 54 | break
|
||||
55 55 |
|
||||
49 |
|
||||
50 | def f():
|
||||
51 | # Fixable.
|
||||
- for foo, bar, baz in (["1", "2", "3"],):
|
||||
52 + for foo, _bar, baz in (["1", "2", "3"],):
|
||||
53 | if foo or baz:
|
||||
54 | break
|
||||
55 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B007 Loop control variable `bar` not used within loop body
|
||||
--> B007.py:59:14
|
||||
|
|
@ -152,16 +149,15 @@ B007 [*] Loop control variable `bar` not used within loop body
|
|||
70 | break
|
||||
|
|
||||
help: Rename unused `bar` to `_bar`
|
||||
|
||||
ℹ Unsafe fix
|
||||
65 65 |
|
||||
66 66 | def f():
|
||||
67 67 | # Fixable.
|
||||
68 |- for foo, bar, baz in (["1", "2", "3"],):
|
||||
68 |+ for foo, _bar, baz in (["1", "2", "3"],):
|
||||
69 69 | if foo or baz:
|
||||
70 70 | break
|
||||
71 71 |
|
||||
65 |
|
||||
66 | def f():
|
||||
67 | # Fixable.
|
||||
- for foo, bar, baz in (["1", "2", "3"],):
|
||||
68 + for foo, _bar, baz in (["1", "2", "3"],):
|
||||
69 | if foo or baz:
|
||||
70 | break
|
||||
71 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B007 Loop control variable `bar` not used within loop body
|
||||
--> B007.py:77:14
|
||||
|
|
|
|||
|
|
@ -11,16 +11,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
21 | getattr(foo, "__123abc__")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
16 16 | getattr(foo, "__123abc")
|
||||
17 17 |
|
||||
18 18 | # Invalid usage
|
||||
19 |-getattr(foo, "bar")
|
||||
19 |+foo.bar
|
||||
20 20 | getattr(foo, "_123abc")
|
||||
21 21 | getattr(foo, "__123abc__")
|
||||
22 22 | getattr(foo, "abc123")
|
||||
16 | getattr(foo, "__123abc")
|
||||
17 |
|
||||
18 | # Invalid usage
|
||||
- getattr(foo, "bar")
|
||||
19 + foo.bar
|
||||
20 | getattr(foo, "_123abc")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
22 | getattr(foo, "abc123")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:20:1
|
||||
|
|
@ -33,16 +31,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
22 | getattr(foo, "abc123")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
17 17 |
|
||||
18 18 | # Invalid usage
|
||||
19 19 | getattr(foo, "bar")
|
||||
20 |-getattr(foo, "_123abc")
|
||||
20 |+foo._123abc
|
||||
21 21 | getattr(foo, "__123abc__")
|
||||
22 22 | getattr(foo, "abc123")
|
||||
23 23 | getattr(foo, r"abc123")
|
||||
17 |
|
||||
18 | # Invalid usage
|
||||
19 | getattr(foo, "bar")
|
||||
- getattr(foo, "_123abc")
|
||||
20 + foo._123abc
|
||||
21 | getattr(foo, "__123abc__")
|
||||
22 | getattr(foo, "abc123")
|
||||
23 | getattr(foo, r"abc123")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:21:1
|
||||
|
|
@ -55,16 +51,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
23 | getattr(foo, r"abc123")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
18 18 | # Invalid usage
|
||||
19 19 | getattr(foo, "bar")
|
||||
20 20 | getattr(foo, "_123abc")
|
||||
21 |-getattr(foo, "__123abc__")
|
||||
21 |+foo.__123abc__
|
||||
22 22 | getattr(foo, "abc123")
|
||||
23 23 | getattr(foo, r"abc123")
|
||||
24 24 | _ = lambda x: getattr(x, "bar")
|
||||
18 | # Invalid usage
|
||||
19 | getattr(foo, "bar")
|
||||
20 | getattr(foo, "_123abc")
|
||||
- getattr(foo, "__123abc__")
|
||||
21 + foo.__123abc__
|
||||
22 | getattr(foo, "abc123")
|
||||
23 | getattr(foo, r"abc123")
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:22:1
|
||||
|
|
@ -77,16 +71,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
24 | _ = lambda x: getattr(x, "bar")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
19 19 | getattr(foo, "bar")
|
||||
20 20 | getattr(foo, "_123abc")
|
||||
21 21 | getattr(foo, "__123abc__")
|
||||
22 |-getattr(foo, "abc123")
|
||||
22 |+foo.abc123
|
||||
23 23 | getattr(foo, r"abc123")
|
||||
24 24 | _ = lambda x: getattr(x, "bar")
|
||||
25 25 | if getattr(x, "bar"):
|
||||
19 | getattr(foo, "bar")
|
||||
20 | getattr(foo, "_123abc")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
- getattr(foo, "abc123")
|
||||
22 + foo.abc123
|
||||
23 | getattr(foo, r"abc123")
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
25 | if getattr(x, "bar"):
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:23:1
|
||||
|
|
@ -99,16 +91,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
25 | if getattr(x, "bar"):
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
20 20 | getattr(foo, "_123abc")
|
||||
21 21 | getattr(foo, "__123abc__")
|
||||
22 22 | getattr(foo, "abc123")
|
||||
23 |-getattr(foo, r"abc123")
|
||||
23 |+foo.abc123
|
||||
24 24 | _ = lambda x: getattr(x, "bar")
|
||||
25 25 | if getattr(x, "bar"):
|
||||
26 26 | pass
|
||||
20 | getattr(foo, "_123abc")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
22 | getattr(foo, "abc123")
|
||||
- getattr(foo, r"abc123")
|
||||
23 + foo.abc123
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
25 | if getattr(x, "bar"):
|
||||
26 | pass
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:24:15
|
||||
|
|
@ -121,16 +111,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
26 | pass
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
21 21 | getattr(foo, "__123abc__")
|
||||
22 22 | getattr(foo, "abc123")
|
||||
23 23 | getattr(foo, r"abc123")
|
||||
24 |-_ = lambda x: getattr(x, "bar")
|
||||
24 |+_ = lambda x: x.bar
|
||||
25 25 | if getattr(x, "bar"):
|
||||
26 26 | pass
|
||||
27 27 | getattr(1, "real")
|
||||
21 | getattr(foo, "__123abc__")
|
||||
22 | getattr(foo, "abc123")
|
||||
23 | getattr(foo, r"abc123")
|
||||
- _ = lambda x: getattr(x, "bar")
|
||||
24 + _ = lambda x: x.bar
|
||||
25 | if getattr(x, "bar"):
|
||||
26 | pass
|
||||
27 | getattr(1, "real")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:25:4
|
||||
|
|
@ -143,16 +131,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
27 | getattr(1, "real")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
22 22 | getattr(foo, "abc123")
|
||||
23 23 | getattr(foo, r"abc123")
|
||||
24 24 | _ = lambda x: getattr(x, "bar")
|
||||
25 |-if getattr(x, "bar"):
|
||||
25 |+if x.bar:
|
||||
26 26 | pass
|
||||
27 27 | getattr(1, "real")
|
||||
28 28 | getattr(1., "real")
|
||||
22 | getattr(foo, "abc123")
|
||||
23 | getattr(foo, r"abc123")
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
- if getattr(x, "bar"):
|
||||
25 + if x.bar:
|
||||
26 | pass
|
||||
27 | getattr(1, "real")
|
||||
28 | getattr(1., "real")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:27:1
|
||||
|
|
@ -165,16 +151,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
29 | getattr(1.0, "real")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
24 24 | _ = lambda x: getattr(x, "bar")
|
||||
25 25 | if getattr(x, "bar"):
|
||||
26 26 | pass
|
||||
27 |-getattr(1, "real")
|
||||
27 |+(1).real
|
||||
28 28 | getattr(1., "real")
|
||||
29 29 | getattr(1.0, "real")
|
||||
30 30 | getattr(1j, "real")
|
||||
24 | _ = lambda x: getattr(x, "bar")
|
||||
25 | if getattr(x, "bar"):
|
||||
26 | pass
|
||||
- getattr(1, "real")
|
||||
27 + (1).real
|
||||
28 | getattr(1., "real")
|
||||
29 | getattr(1.0, "real")
|
||||
30 | getattr(1j, "real")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:28:1
|
||||
|
|
@ -187,16 +171,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
30 | getattr(1j, "real")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
25 25 | if getattr(x, "bar"):
|
||||
26 26 | pass
|
||||
27 27 | getattr(1, "real")
|
||||
28 |-getattr(1., "real")
|
||||
28 |+(1.).real
|
||||
29 29 | getattr(1.0, "real")
|
||||
30 30 | getattr(1j, "real")
|
||||
31 31 | getattr(True, "real")
|
||||
25 | if getattr(x, "bar"):
|
||||
26 | pass
|
||||
27 | getattr(1, "real")
|
||||
- getattr(1., "real")
|
||||
28 + (1.).real
|
||||
29 | getattr(1.0, "real")
|
||||
30 | getattr(1j, "real")
|
||||
31 | getattr(True, "real")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:29:1
|
||||
|
|
@ -209,16 +191,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
31 | getattr(True, "real")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
26 26 | pass
|
||||
27 27 | getattr(1, "real")
|
||||
28 28 | getattr(1., "real")
|
||||
29 |-getattr(1.0, "real")
|
||||
29 |+(1.0).real
|
||||
30 30 | getattr(1j, "real")
|
||||
31 31 | getattr(True, "real")
|
||||
32 32 | getattr(x := 1, "real")
|
||||
26 | pass
|
||||
27 | getattr(1, "real")
|
||||
28 | getattr(1., "real")
|
||||
- getattr(1.0, "real")
|
||||
29 + (1.0).real
|
||||
30 | getattr(1j, "real")
|
||||
31 | getattr(True, "real")
|
||||
32 | getattr(x := 1, "real")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:30:1
|
||||
|
|
@ -231,16 +211,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
32 | getattr(x := 1, "real")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
27 27 | getattr(1, "real")
|
||||
28 28 | getattr(1., "real")
|
||||
29 29 | getattr(1.0, "real")
|
||||
30 |-getattr(1j, "real")
|
||||
30 |+(1j).real
|
||||
31 31 | getattr(True, "real")
|
||||
32 32 | getattr(x := 1, "real")
|
||||
33 33 | getattr(x + y, "real")
|
||||
27 | getattr(1, "real")
|
||||
28 | getattr(1., "real")
|
||||
29 | getattr(1.0, "real")
|
||||
- getattr(1j, "real")
|
||||
30 + (1j).real
|
||||
31 | getattr(True, "real")
|
||||
32 | getattr(x := 1, "real")
|
||||
33 | getattr(x + y, "real")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:31:1
|
||||
|
|
@ -253,16 +231,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
33 | getattr(x + y, "real")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
28 28 | getattr(1., "real")
|
||||
29 29 | getattr(1.0, "real")
|
||||
30 30 | getattr(1j, "real")
|
||||
31 |-getattr(True, "real")
|
||||
31 |+(True).real
|
||||
32 32 | getattr(x := 1, "real")
|
||||
33 33 | getattr(x + y, "real")
|
||||
34 34 | getattr("foo"
|
||||
28 | getattr(1., "real")
|
||||
29 | getattr(1.0, "real")
|
||||
30 | getattr(1j, "real")
|
||||
- getattr(True, "real")
|
||||
31 + (True).real
|
||||
32 | getattr(x := 1, "real")
|
||||
33 | getattr(x + y, "real")
|
||||
34 | getattr("foo"
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:32:1
|
||||
|
|
@ -275,16 +251,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
34 | getattr("foo"
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
29 29 | getattr(1.0, "real")
|
||||
30 30 | getattr(1j, "real")
|
||||
31 31 | getattr(True, "real")
|
||||
32 |-getattr(x := 1, "real")
|
||||
32 |+(x := 1).real
|
||||
33 33 | getattr(x + y, "real")
|
||||
34 34 | getattr("foo"
|
||||
35 35 | "bar", "real")
|
||||
29 | getattr(1.0, "real")
|
||||
30 | getattr(1j, "real")
|
||||
31 | getattr(True, "real")
|
||||
- getattr(x := 1, "real")
|
||||
32 + (x := 1).real
|
||||
33 | getattr(x + y, "real")
|
||||
34 | getattr("foo"
|
||||
35 | "bar", "real")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:33:1
|
||||
|
|
@ -297,16 +271,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
35 | "bar", "real")
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
30 30 | getattr(1j, "real")
|
||||
31 31 | getattr(True, "real")
|
||||
32 32 | getattr(x := 1, "real")
|
||||
33 |-getattr(x + y, "real")
|
||||
33 |+(x + y).real
|
||||
34 34 | getattr("foo"
|
||||
35 35 | "bar", "real")
|
||||
36 36 |
|
||||
30 | getattr(1j, "real")
|
||||
31 | getattr(True, "real")
|
||||
32 | getattr(x := 1, "real")
|
||||
- getattr(x + y, "real")
|
||||
33 + (x + y).real
|
||||
34 | getattr("foo"
|
||||
35 | "bar", "real")
|
||||
36 |
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:34:1
|
||||
|
|
@ -318,18 +290,16 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
| |______________________^
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
31 31 | getattr(True, "real")
|
||||
32 32 | getattr(x := 1, "real")
|
||||
33 33 | getattr(x + y, "real")
|
||||
34 |-getattr("foo"
|
||||
35 |- "bar", "real")
|
||||
34 |+("foo"
|
||||
35 |+ "bar").real
|
||||
36 36 |
|
||||
37 37 |
|
||||
38 38 | # Valid setattr usage
|
||||
31 | getattr(True, "real")
|
||||
32 | getattr(x := 1, "real")
|
||||
33 | getattr(x + y, "real")
|
||||
- getattr("foo"
|
||||
- "bar", "real")
|
||||
34 + ("foo"
|
||||
35 + "bar").real
|
||||
36 |
|
||||
37 |
|
||||
38 | # Valid setattr usage
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:58:8
|
||||
|
|
@ -341,16 +311,14 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
60 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1732387247
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
55 55 | setattr(foo.bar, r"baz", None)
|
||||
56 56 |
|
||||
57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
58 |-assert getattr(func, '_rpc')is True
|
||||
58 |+assert func._rpc is True
|
||||
59 59 |
|
||||
60 60 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1732387247
|
||||
61 61 | getattr(*foo, "bar")
|
||||
55 | setattr(foo.bar, r"baz", None)
|
||||
56 |
|
||||
57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
- assert getattr(func, '_rpc')is True
|
||||
58 + assert func._rpc is True
|
||||
59 |
|
||||
60 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1732387247
|
||||
61 | getattr(*foo, "bar")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:65:1
|
||||
|
|
@ -363,18 +331,16 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
68 | import builtins
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
62 62 | setattr(*foo, "bar", None)
|
||||
63 63 |
|
||||
64 64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901
|
||||
65 |-getattr(self.
|
||||
66 |- registration.registry, '__name__')
|
||||
65 |+(self.
|
||||
66 |+ registration.registry).__name__
|
||||
67 67 |
|
||||
68 68 | import builtins
|
||||
69 69 | builtins.getattr(foo, "bar")
|
||||
62 | setattr(*foo, "bar", None)
|
||||
63 |
|
||||
64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901
|
||||
- getattr(self.
|
||||
- registration.registry, '__name__')
|
||||
65 + (self.
|
||||
66 + registration.registry).__name__
|
||||
67 |
|
||||
68 | import builtins
|
||||
69 | builtins.getattr(foo, "bar")
|
||||
|
||||
B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:69:1
|
||||
|
|
@ -386,13 +352,11 @@ B009 [*] Do not call `getattr` with a constant attribute value. It is not any sa
|
|||
71 | # Regression test for: https://github.com/astral-sh/ruff/issues/18353
|
||||
|
|
||||
help: Replace `getattr` with attribute access
|
||||
|
||||
ℹ Safe fix
|
||||
66 66 | registration.registry, '__name__')
|
||||
67 67 |
|
||||
68 68 | import builtins
|
||||
69 |-builtins.getattr(foo, "bar")
|
||||
69 |+foo.bar
|
||||
70 70 |
|
||||
71 71 | # Regression test for: https://github.com/astral-sh/ruff/issues/18353
|
||||
72 72 | setattr(foo, "__debug__", 0)
|
||||
66 | registration.registry, '__name__')
|
||||
67 |
|
||||
68 | import builtins
|
||||
- builtins.getattr(foo, "bar")
|
||||
69 + foo.bar
|
||||
70 |
|
||||
71 | # Regression test for: https://github.com/astral-sh/ruff/issues/18353
|
||||
72 | setattr(foo, "__debug__", 0)
|
||||
|
|
|
|||
|
|
@ -11,16 +11,14 @@ B010 [*] Do not call `setattr` with a constant attribute value. It is not any sa
|
|||
52 | setattr(foo, "__123abc__", None)
|
||||
|
|
||||
help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Safe fix
|
||||
47 47 | pass
|
||||
48 48 |
|
||||
49 49 | # Invalid usage
|
||||
50 |-setattr(foo, "bar", None)
|
||||
50 |+foo.bar = None
|
||||
51 51 | setattr(foo, "_123abc", None)
|
||||
52 52 | setattr(foo, "__123abc__", None)
|
||||
53 53 | setattr(foo, "abc123", None)
|
||||
47 | pass
|
||||
48 |
|
||||
49 | # Invalid usage
|
||||
- setattr(foo, "bar", None)
|
||||
50 + foo.bar = None
|
||||
51 | setattr(foo, "_123abc", None)
|
||||
52 | setattr(foo, "__123abc__", None)
|
||||
53 | setattr(foo, "abc123", None)
|
||||
|
||||
B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:51:1
|
||||
|
|
@ -33,16 +31,14 @@ B010 [*] Do not call `setattr` with a constant attribute value. It is not any sa
|
|||
53 | setattr(foo, "abc123", None)
|
||||
|
|
||||
help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Safe fix
|
||||
48 48 |
|
||||
49 49 | # Invalid usage
|
||||
50 50 | setattr(foo, "bar", None)
|
||||
51 |-setattr(foo, "_123abc", None)
|
||||
51 |+foo._123abc = None
|
||||
52 52 | setattr(foo, "__123abc__", None)
|
||||
53 53 | setattr(foo, "abc123", None)
|
||||
54 54 | setattr(foo, r"abc123", None)
|
||||
48 |
|
||||
49 | # Invalid usage
|
||||
50 | setattr(foo, "bar", None)
|
||||
- setattr(foo, "_123abc", None)
|
||||
51 + foo._123abc = None
|
||||
52 | setattr(foo, "__123abc__", None)
|
||||
53 | setattr(foo, "abc123", None)
|
||||
54 | setattr(foo, r"abc123", None)
|
||||
|
||||
B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:52:1
|
||||
|
|
@ -55,16 +51,14 @@ B010 [*] Do not call `setattr` with a constant attribute value. It is not any sa
|
|||
54 | setattr(foo, r"abc123", None)
|
||||
|
|
||||
help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Safe fix
|
||||
49 49 | # Invalid usage
|
||||
50 50 | setattr(foo, "bar", None)
|
||||
51 51 | setattr(foo, "_123abc", None)
|
||||
52 |-setattr(foo, "__123abc__", None)
|
||||
52 |+foo.__123abc__ = None
|
||||
53 53 | setattr(foo, "abc123", None)
|
||||
54 54 | setattr(foo, r"abc123", None)
|
||||
55 55 | setattr(foo.bar, r"baz", None)
|
||||
49 | # Invalid usage
|
||||
50 | setattr(foo, "bar", None)
|
||||
51 | setattr(foo, "_123abc", None)
|
||||
- setattr(foo, "__123abc__", None)
|
||||
52 + foo.__123abc__ = None
|
||||
53 | setattr(foo, "abc123", None)
|
||||
54 | setattr(foo, r"abc123", None)
|
||||
55 | setattr(foo.bar, r"baz", None)
|
||||
|
||||
B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:53:1
|
||||
|
|
@ -77,16 +71,14 @@ B010 [*] Do not call `setattr` with a constant attribute value. It is not any sa
|
|||
55 | setattr(foo.bar, r"baz", None)
|
||||
|
|
||||
help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Safe fix
|
||||
50 50 | setattr(foo, "bar", None)
|
||||
51 51 | setattr(foo, "_123abc", None)
|
||||
52 52 | setattr(foo, "__123abc__", None)
|
||||
53 |-setattr(foo, "abc123", None)
|
||||
53 |+foo.abc123 = None
|
||||
54 54 | setattr(foo, r"abc123", None)
|
||||
55 55 | setattr(foo.bar, r"baz", None)
|
||||
56 56 |
|
||||
50 | setattr(foo, "bar", None)
|
||||
51 | setattr(foo, "_123abc", None)
|
||||
52 | setattr(foo, "__123abc__", None)
|
||||
- setattr(foo, "abc123", None)
|
||||
53 + foo.abc123 = None
|
||||
54 | setattr(foo, r"abc123", None)
|
||||
55 | setattr(foo.bar, r"baz", None)
|
||||
56 |
|
||||
|
||||
B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:54:1
|
||||
|
|
@ -98,16 +90,14 @@ B010 [*] Do not call `setattr` with a constant attribute value. It is not any sa
|
|||
55 | setattr(foo.bar, r"baz", None)
|
||||
|
|
||||
help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Safe fix
|
||||
51 51 | setattr(foo, "_123abc", None)
|
||||
52 52 | setattr(foo, "__123abc__", None)
|
||||
53 53 | setattr(foo, "abc123", None)
|
||||
54 |-setattr(foo, r"abc123", None)
|
||||
54 |+foo.abc123 = None
|
||||
55 55 | setattr(foo.bar, r"baz", None)
|
||||
56 56 |
|
||||
57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
51 | setattr(foo, "_123abc", None)
|
||||
52 | setattr(foo, "__123abc__", None)
|
||||
53 | setattr(foo, "abc123", None)
|
||||
- setattr(foo, r"abc123", None)
|
||||
54 + foo.abc123 = None
|
||||
55 | setattr(foo.bar, r"baz", None)
|
||||
56 |
|
||||
57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
|
||||
B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
|
||||
--> B009_B010.py:55:1
|
||||
|
|
@ -120,13 +110,11 @@ B010 [*] Do not call `setattr` with a constant attribute value. It is not any sa
|
|||
57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
|
|
||||
help: Replace `setattr` with assignment
|
||||
|
||||
ℹ Safe fix
|
||||
52 52 | setattr(foo, "__123abc__", None)
|
||||
53 53 | setattr(foo, "abc123", None)
|
||||
54 54 | setattr(foo, r"abc123", None)
|
||||
55 |-setattr(foo.bar, r"baz", None)
|
||||
55 |+foo.bar.baz = None
|
||||
56 56 |
|
||||
57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
58 58 | assert getattr(func, '_rpc')is True
|
||||
52 | setattr(foo, "__123abc__", None)
|
||||
53 | setattr(foo, "abc123", None)
|
||||
54 | setattr(foo, r"abc123", None)
|
||||
- setattr(foo.bar, r"baz", None)
|
||||
55 + foo.bar.baz = None
|
||||
56 |
|
||||
57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885
|
||||
58 | assert getattr(func, '_rpc')is True
|
||||
|
|
|
|||
|
|
@ -11,15 +11,14 @@ B011 [*] Do not `assert False` (`python -O` removes these calls), raise `Asserti
|
|||
10 | assert False, "message"
|
||||
|
|
||||
help: Replace `assert False`
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | """
|
||||
6 6 |
|
||||
7 7 | assert 1 != 2
|
||||
8 |-assert False
|
||||
8 |+raise AssertionError()
|
||||
9 9 | assert 1 != 2, "message"
|
||||
10 10 | assert False, "message"
|
||||
5 | """
|
||||
6 |
|
||||
7 | assert 1 != 2
|
||||
- assert False
|
||||
8 + raise AssertionError()
|
||||
9 | assert 1 != 2, "message"
|
||||
10 | assert False, "message"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
|
||||
--> B011.py:10:8
|
||||
|
|
@ -30,10 +29,9 @@ B011 [*] Do not `assert False` (`python -O` removes these calls), raise `Asserti
|
|||
| ^^^^^
|
||||
|
|
||||
help: Replace `assert False`
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | assert 1 != 2
|
||||
8 8 | assert False
|
||||
9 9 | assert 1 != 2, "message"
|
||||
10 |-assert False, "message"
|
||||
10 |+raise AssertionError("message")
|
||||
7 | assert 1 != 2
|
||||
8 | assert False
|
||||
9 | assert 1 != 2, "message"
|
||||
- assert False, "message"
|
||||
10 + raise AssertionError("message")
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,16 +12,14 @@ B013 [*] A length-one tuple literal is redundant in exception handlers
|
|||
7 | except AttributeError:
|
||||
|
|
||||
help: Replace with `except ValueError`
|
||||
|
||||
ℹ Safe fix
|
||||
2 2 |
|
||||
3 3 | try:
|
||||
4 4 | pass
|
||||
5 |-except (ValueError,):
|
||||
5 |+except ValueError:
|
||||
6 6 | pass
|
||||
7 7 | except AttributeError:
|
||||
8 8 | pass
|
||||
2 |
|
||||
3 | try:
|
||||
4 | pass
|
||||
- except (ValueError,):
|
||||
5 + except ValueError:
|
||||
6 | pass
|
||||
7 | except AttributeError:
|
||||
8 | pass
|
||||
|
||||
B013 [*] A length-one tuple literal is redundant in exception handlers
|
||||
--> B013.py:13:7
|
||||
|
|
@ -33,13 +31,11 @@ B013 [*] A length-one tuple literal is redundant in exception handlers
|
|||
14 | pass
|
||||
|
|
||||
help: Replace with `except ValueError`
|
||||
|
||||
ℹ Safe fix
|
||||
10 10 | pass
|
||||
11 11 | except (*retriable_exceptions,):
|
||||
12 12 | pass
|
||||
13 |-except(ValueError,):
|
||||
13 |+except ValueError:
|
||||
14 14 | pass
|
||||
15 15 |
|
||||
16 16 | list_exceptions = [FileExistsError, FileNotFoundError]
|
||||
10 | pass
|
||||
11 | except (*retriable_exceptions,):
|
||||
12 | pass
|
||||
- except(ValueError,):
|
||||
13 + except ValueError:
|
||||
14 | pass
|
||||
15 |
|
||||
16 | list_exceptions = [FileExistsError, FileNotFoundError]
|
||||
|
|
|
|||
|
|
@ -12,16 +12,14 @@ B014 [*] Exception handler with duplicate exception: `OSError`
|
|||
19 | pass
|
||||
|
|
||||
help: De-duplicate exceptions
|
||||
|
||||
ℹ Safe fix
|
||||
14 14 |
|
||||
15 15 | try:
|
||||
16 16 | pass
|
||||
17 |-except (OSError, OSError) as err:
|
||||
17 |+except OSError as err:
|
||||
18 18 | # Duplicate exception types are useless
|
||||
19 19 | pass
|
||||
20 20 |
|
||||
14 |
|
||||
15 | try:
|
||||
16 | pass
|
||||
- except (OSError, OSError) as err:
|
||||
17 + except OSError as err:
|
||||
18 | # Duplicate exception types are useless
|
||||
19 | pass
|
||||
20 |
|
||||
|
||||
B014 [*] Exception handler with duplicate exception: `MyError`
|
||||
--> B014.py:28:8
|
||||
|
|
@ -34,16 +32,14 @@ B014 [*] Exception handler with duplicate exception: `MyError`
|
|||
30 | pass
|
||||
|
|
||||
help: De-duplicate exceptions
|
||||
|
||||
ℹ Safe fix
|
||||
25 25 |
|
||||
26 26 | try:
|
||||
27 27 | pass
|
||||
28 |-except (MyError, MyError):
|
||||
28 |+except MyError:
|
||||
29 29 | # Detect duplicate non-builtin errors
|
||||
30 30 | pass
|
||||
31 31 |
|
||||
25 |
|
||||
26 | try:
|
||||
27 | pass
|
||||
- except (MyError, MyError):
|
||||
28 + except MyError:
|
||||
29 | # Detect duplicate non-builtin errors
|
||||
30 | pass
|
||||
31 |
|
||||
|
||||
B014 [*] Exception handler with duplicate exception: `re.error`
|
||||
--> B014.py:49:8
|
||||
|
|
@ -56,16 +52,14 @@ B014 [*] Exception handler with duplicate exception: `re.error`
|
|||
51 | pass
|
||||
|
|
||||
help: De-duplicate exceptions
|
||||
|
||||
ℹ Safe fix
|
||||
46 46 |
|
||||
47 47 | try:
|
||||
48 48 | pass
|
||||
49 |-except (re.error, re.error):
|
||||
49 |+except re.error:
|
||||
50 50 | # Duplicate exception types as attributes
|
||||
51 51 | pass
|
||||
52 52 |
|
||||
46 |
|
||||
47 | try:
|
||||
48 | pass
|
||||
- except (re.error, re.error):
|
||||
49 + except re.error:
|
||||
50 | # Duplicate exception types as attributes
|
||||
51 | pass
|
||||
52 |
|
||||
|
||||
B014 [*] Exception handler with duplicate exception: `ValueError`
|
||||
--> B014.py:82:8
|
||||
|
|
@ -77,16 +71,14 @@ B014 [*] Exception handler with duplicate exception: `ValueError`
|
|||
83 | pass
|
||||
|
|
||||
help: De-duplicate exceptions
|
||||
|
||||
ℹ Safe fix
|
||||
79 79 | # Regression test for: https://github.com/astral-sh/ruff/issues/6412
|
||||
80 80 | try:
|
||||
81 81 | pass
|
||||
82 |-except (ValueError, ValueError, TypeError):
|
||||
82 |+except (ValueError, TypeError):
|
||||
83 83 | pass
|
||||
84 84 |
|
||||
85 85 |
|
||||
79 | # Regression test for: https://github.com/astral-sh/ruff/issues/6412
|
||||
80 | try:
|
||||
81 | pass
|
||||
- except (ValueError, ValueError, TypeError):
|
||||
82 + except (ValueError, TypeError):
|
||||
83 | pass
|
||||
84 |
|
||||
85 |
|
||||
|
||||
B014 [*] Exception handler with duplicate exception: `re.error`
|
||||
--> B014.py:89:7
|
||||
|
|
@ -98,11 +90,9 @@ B014 [*] Exception handler with duplicate exception: `re.error`
|
|||
90 | p
|
||||
|
|
||||
help: De-duplicate exceptions
|
||||
|
||||
ℹ Safe fix
|
||||
86 86 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739801758
|
||||
87 87 | try:
|
||||
88 88 | pas
|
||||
89 |-except(re.error, re.error):
|
||||
89 |+except re.error:
|
||||
90 90 | p
|
||||
86 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739801758
|
||||
87 | try:
|
||||
88 | pas
|
||||
- except(re.error, re.error):
|
||||
89 + except re.error:
|
||||
90 | p
|
||||
|
|
|
|||
|
|
@ -12,16 +12,15 @@ B028 [*] No explicit `stacklevel` keyword argument found
|
|||
10 | warnings.warn("test", DeprecationWarning, source=None, stacklevel=2)
|
||||
|
|
||||
help: Set `stacklevel=2`
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | B028 - on lines 8 and 9
|
||||
6 6 | """
|
||||
7 7 |
|
||||
8 |-warnings.warn("test", DeprecationWarning)
|
||||
8 |+warnings.warn("test", DeprecationWarning, stacklevel=2)
|
||||
9 9 | warnings.warn("test", DeprecationWarning, source=None)
|
||||
10 10 | warnings.warn("test", DeprecationWarning, source=None, stacklevel=2)
|
||||
11 11 | warnings.warn("test", DeprecationWarning, stacklevel=1)
|
||||
5 | B028 - on lines 8 and 9
|
||||
6 | """
|
||||
7 |
|
||||
- warnings.warn("test", DeprecationWarning)
|
||||
8 + warnings.warn("test", DeprecationWarning, stacklevel=2)
|
||||
9 | warnings.warn("test", DeprecationWarning, source=None)
|
||||
10 | warnings.warn("test", DeprecationWarning, source=None, stacklevel=2)
|
||||
11 | warnings.warn("test", DeprecationWarning, stacklevel=1)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B028 [*] No explicit `stacklevel` keyword argument found
|
||||
--> B028.py:9:1
|
||||
|
|
@ -33,16 +32,15 @@ B028 [*] No explicit `stacklevel` keyword argument found
|
|||
11 | warnings.warn("test", DeprecationWarning, stacklevel=1)
|
||||
|
|
||||
help: Set `stacklevel=2`
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 | """
|
||||
7 7 |
|
||||
8 8 | warnings.warn("test", DeprecationWarning)
|
||||
9 |-warnings.warn("test", DeprecationWarning, source=None)
|
||||
9 |+warnings.warn("test", DeprecationWarning, stacklevel=2, source=None)
|
||||
10 10 | warnings.warn("test", DeprecationWarning, source=None, stacklevel=2)
|
||||
11 11 | warnings.warn("test", DeprecationWarning, stacklevel=1)
|
||||
12 12 | warnings.warn("test", DeprecationWarning, 1)
|
||||
6 | """
|
||||
7 |
|
||||
8 | warnings.warn("test", DeprecationWarning)
|
||||
- warnings.warn("test", DeprecationWarning, source=None)
|
||||
9 + warnings.warn("test", DeprecationWarning, stacklevel=2, source=None)
|
||||
10 | warnings.warn("test", DeprecationWarning, source=None, stacklevel=2)
|
||||
11 | warnings.warn("test", DeprecationWarning, stacklevel=1)
|
||||
12 | warnings.warn("test", DeprecationWarning, 1)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B028 [*] No explicit `stacklevel` keyword argument found
|
||||
--> B028.py:22:1
|
||||
|
|
@ -55,16 +53,15 @@ B028 [*] No explicit `stacklevel` keyword argument found
|
|||
24 | DeprecationWarning,
|
||||
|
|
||||
help: Set `stacklevel=2`
|
||||
|
||||
ℹ Unsafe fix
|
||||
23 23 | "test",
|
||||
24 24 | DeprecationWarning,
|
||||
25 25 | # some comments here
|
||||
26 |- source = None # no trailing comma
|
||||
26 |+ stacklevel=2, source = None # no trailing comma
|
||||
27 27 | )
|
||||
28 28 |
|
||||
29 29 | # https://github.com/astral-sh/ruff/issues/18011
|
||||
23 | "test",
|
||||
24 | DeprecationWarning,
|
||||
25 | # some comments here
|
||||
- source = None # no trailing comma
|
||||
26 + stacklevel=2, source = None # no trailing comma
|
||||
27 | )
|
||||
28 |
|
||||
29 | # https://github.com/astral-sh/ruff/issues/18011
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
B028 [*] No explicit `stacklevel` keyword argument found
|
||||
--> B028.py:32:1
|
||||
|
|
@ -77,13 +74,12 @@ B028 [*] No explicit `stacklevel` keyword argument found
|
|||
34 | _my_prefixes = ("this","that")
|
||||
|
|
||||
help: Set `stacklevel=2`
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 | # https://github.com/astral-sh/ruff/issues/18011
|
||||
30 30 | warnings.warn("test", skip_file_prefixes=(os.path.dirname(__file__),))
|
||||
31 31 | # trigger diagnostic if `skip_file_prefixes` is present and set to the default value
|
||||
32 |-warnings.warn("test", skip_file_prefixes=())
|
||||
32 |+warnings.warn("test", stacklevel=2, skip_file_prefixes=())
|
||||
33 33 |
|
||||
34 34 | _my_prefixes = ("this","that")
|
||||
35 35 | warnings.warn("test", skip_file_prefixes = _my_prefixes)
|
||||
29 | # https://github.com/astral-sh/ruff/issues/18011
|
||||
30 | warnings.warn("test", skip_file_prefixes=(os.path.dirname(__file__),))
|
||||
31 | # trigger diagnostic if `skip_file_prefixes` is present and set to the default value
|
||||
- warnings.warn("test", skip_file_prefixes=())
|
||||
32 + warnings.warn("test", stacklevel=2, skip_file_prefixes=())
|
||||
33 |
|
||||
34 | _my_prefixes = ("this","that")
|
||||
35 | warnings.warn("test", skip_file_prefixes = _my_prefixes)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,16 +12,14 @@ B033 [*] Sets should not contain duplicate item `"value1"`
|
|||
6 | incorrect_set_multiline = {
|
||||
|
|
||||
help: Remove duplicate item
|
||||
|
||||
ℹ Safe fix
|
||||
1 1 | ###
|
||||
2 2 | # Errors.
|
||||
3 3 | ###
|
||||
4 |-incorrect_set = {"value1", 23, 5, "value1"}
|
||||
4 |+incorrect_set = {"value1", 23, 5}
|
||||
5 5 | incorrect_set = {1, 1, 2}
|
||||
6 6 | incorrect_set_multiline = {
|
||||
7 7 | "value1",
|
||||
1 | ###
|
||||
2 | # Errors.
|
||||
3 | ###
|
||||
- incorrect_set = {"value1", 23, 5, "value1"}
|
||||
4 + incorrect_set = {"value1", 23, 5}
|
||||
5 | incorrect_set = {1, 1, 2}
|
||||
6 | incorrect_set_multiline = {
|
||||
7 | "value1",
|
||||
|
||||
B033 [*] Sets should not contain duplicate item `1`
|
||||
--> B033.py:5:21
|
||||
|
|
@ -34,16 +32,14 @@ B033 [*] Sets should not contain duplicate item `1`
|
|||
7 | "value1",
|
||||
|
|
||||
help: Remove duplicate item
|
||||
|
||||
ℹ Safe fix
|
||||
2 2 | # Errors.
|
||||
3 3 | ###
|
||||
4 4 | incorrect_set = {"value1", 23, 5, "value1"}
|
||||
5 |-incorrect_set = {1, 1, 2}
|
||||
5 |+incorrect_set = {1, 2}
|
||||
6 6 | incorrect_set_multiline = {
|
||||
7 7 | "value1",
|
||||
8 8 | 23,
|
||||
2 | # Errors.
|
||||
3 | ###
|
||||
4 | incorrect_set = {"value1", 23, 5, "value1"}
|
||||
- incorrect_set = {1, 1, 2}
|
||||
5 + incorrect_set = {1, 2}
|
||||
6 | incorrect_set_multiline = {
|
||||
7 | "value1",
|
||||
8 | 23,
|
||||
|
||||
B033 [*] Sets should not contain duplicate item `"value1"`
|
||||
--> B033.py:10:5
|
||||
|
|
@ -56,15 +52,13 @@ B033 [*] Sets should not contain duplicate item `"value1"`
|
|||
12 | }
|
||||
|
|
||||
help: Remove duplicate item
|
||||
|
||||
ℹ Safe fix
|
||||
7 7 | "value1",
|
||||
8 8 | 23,
|
||||
9 9 | 5,
|
||||
10 |- "value1",
|
||||
11 10 | # B033
|
||||
12 11 | }
|
||||
13 12 | incorrect_set = {1, 1}
|
||||
7 | "value1",
|
||||
8 | 23,
|
||||
9 | 5,
|
||||
- "value1",
|
||||
10 | # B033
|
||||
11 | }
|
||||
12 | incorrect_set = {1, 1}
|
||||
|
||||
B033 [*] Sets should not contain duplicate item `1`
|
||||
--> B033.py:13:21
|
||||
|
|
@ -77,16 +71,14 @@ B033 [*] Sets should not contain duplicate item `1`
|
|||
15 | incorrect_set = {0, 1, 1,}
|
||||
|
|
||||
help: Remove duplicate item
|
||||
|
||||
ℹ Safe fix
|
||||
10 10 | "value1",
|
||||
11 11 | # B033
|
||||
12 12 | }
|
||||
13 |-incorrect_set = {1, 1}
|
||||
13 |+incorrect_set = {1}
|
||||
14 14 | incorrect_set = {1, 1,}
|
||||
15 15 | incorrect_set = {0, 1, 1,}
|
||||
16 16 | incorrect_set = {0, 1, 1}
|
||||
10 | "value1",
|
||||
11 | # B033
|
||||
12 | }
|
||||
- incorrect_set = {1, 1}
|
||||
13 + incorrect_set = {1}
|
||||
14 | incorrect_set = {1, 1,}
|
||||
15 | incorrect_set = {0, 1, 1,}
|
||||
16 | incorrect_set = {0, 1, 1}
|
||||
|
||||
B033 [*] Sets should not contain duplicate item `1`
|
||||
--> B033.py:14:21
|
||||
|
|
@ -99,16 +91,14 @@ B033 [*] Sets should not contain duplicate item `1`
|
|||
16 | incorrect_set = {0, 1, 1}
|
||||
|
|
||||
help: Remove duplicate item
|
||||
|
||||
ℹ Safe fix
|
||||
11 11 | # B033
|
||||
12 12 | }
|
||||
13 13 | incorrect_set = {1, 1}
|
||||
14 |-incorrect_set = {1, 1,}
|
||||
14 |+incorrect_set = {1,}
|
||||
15 15 | incorrect_set = {0, 1, 1,}
|
||||
16 16 | incorrect_set = {0, 1, 1}
|
||||
17 17 | incorrect_set = {
|
||||
11 | # B033
|
||||
12 | }
|
||||
13 | incorrect_set = {1, 1}
|
||||
- incorrect_set = {1, 1,}
|
||||
14 + incorrect_set = {1,}
|
||||
15 | incorrect_set = {0, 1, 1,}
|
||||
16 | incorrect_set = {0, 1, 1}
|
||||
17 | incorrect_set = {
|
||||
|
||||
B033 [*] Sets should not contain duplicate item `1`
|
||||
--> B033.py:15:24
|
||||
|
|
@ -121,16 +111,14 @@ B033 [*] Sets should not contain duplicate item `1`
|
|||
17 | incorrect_set = {
|
||||
|
|
||||
help: Remove duplicate item
|
||||
|
||||
ℹ Safe fix
|
||||
12 12 | }
|
||||
13 13 | incorrect_set = {1, 1}
|
||||
14 14 | incorrect_set = {1, 1,}
|
||||
15 |-incorrect_set = {0, 1, 1,}
|
||||
15 |+incorrect_set = {0, 1,}
|
||||
16 16 | incorrect_set = {0, 1, 1}
|
||||
17 17 | incorrect_set = {
|
||||
18 18 | 0,
|
||||
12 | }
|
||||
13 | incorrect_set = {1, 1}
|
||||
14 | incorrect_set = {1, 1,}
|
||||
- incorrect_set = {0, 1, 1,}
|
||||
15 + incorrect_set = {0, 1,}
|
||||
16 | incorrect_set = {0, 1, 1}
|
||||
17 | incorrect_set = {
|
||||
18 | 0,
|
||||
|
||||
B033 [*] Sets should not contain duplicate item `1`
|
||||
--> B033.py:16:24
|
||||
|
|
@ -143,16 +131,14 @@ B033 [*] Sets should not contain duplicate item `1`
|
|||
18 | 0,
|
||||
|
|
||||
help: Remove duplicate item
|
||||
|
||||
ℹ Safe fix
|
||||
13 13 | incorrect_set = {1, 1}
|
||||
14 14 | incorrect_set = {1, 1,}
|
||||
15 15 | incorrect_set = {0, 1, 1,}
|
||||
16 |-incorrect_set = {0, 1, 1}
|
||||
16 |+incorrect_set = {0, 1}
|
||||
17 17 | incorrect_set = {
|
||||
18 18 | 0,
|
||||
19 19 | 1,
|
||||
13 | incorrect_set = {1, 1}
|
||||
14 | incorrect_set = {1, 1,}
|
||||
15 | incorrect_set = {0, 1, 1,}
|
||||
- incorrect_set = {0, 1, 1}
|
||||
16 + incorrect_set = {0, 1}
|
||||
17 | incorrect_set = {
|
||||
18 | 0,
|
||||
19 | 1,
|
||||
|
||||
B033 [*] Sets should not contain duplicate item `1`
|
||||
--> B033.py:20:5
|
||||
|
|
@ -165,15 +151,13 @@ B033 [*] Sets should not contain duplicate item `1`
|
|||
22 | incorrect_set = {False, 1, 0}
|
||||
|
|
||||
help: Remove duplicate item
|
||||
|
||||
ℹ Safe fix
|
||||
17 17 | incorrect_set = {
|
||||
18 18 | 0,
|
||||
19 19 | 1,
|
||||
20 |- 1,
|
||||
21 20 | }
|
||||
22 21 | incorrect_set = {False, 1, 0}
|
||||
23 22 |
|
||||
17 | incorrect_set = {
|
||||
18 | 0,
|
||||
19 | 1,
|
||||
- 1,
|
||||
20 | }
|
||||
21 | incorrect_set = {False, 1, 0}
|
||||
22 |
|
||||
|
||||
B033 [*] Sets should not contain duplicate items, but `False` and `0` has the same value
|
||||
--> B033.py:22:28
|
||||
|
|
@ -186,13 +170,11 @@ B033 [*] Sets should not contain duplicate items, but `False` and `0` has the sa
|
|||
24 | ###
|
||||
|
|
||||
help: Remove duplicate item
|
||||
|
||||
ℹ Safe fix
|
||||
19 19 | 1,
|
||||
20 20 | 1,
|
||||
21 21 | }
|
||||
22 |-incorrect_set = {False, 1, 0}
|
||||
22 |+incorrect_set = {False, 1}
|
||||
23 23 |
|
||||
24 24 | ###
|
||||
25 25 | # Non-errors.
|
||||
19 | 1,
|
||||
20 | 1,
|
||||
21 | }
|
||||
- incorrect_set = {False, 1, 0}
|
||||
22 + incorrect_set = {False, 1}
|
||||
23 |
|
||||
24 | ###
|
||||
25 | # Non-errors.
|
||||
|
|
|
|||
|
|
@ -11,16 +11,14 @@ B905 [*] `zip()` without an explicit `strict=` parameter
|
|||
6 | zip("a", "b")
|
||||
|
|
||||
help: Add explicit value for parameter `strict=`
|
||||
|
||||
ℹ Safe fix
|
||||
1 1 | from itertools import count, cycle, repeat
|
||||
2 2 |
|
||||
3 3 | # Errors
|
||||
4 |-zip()
|
||||
4 |+zip(strict=False)
|
||||
5 5 | zip(range(3))
|
||||
6 6 | zip("a", "b")
|
||||
7 7 | zip("a", "b", *zip("c"))
|
||||
1 | from itertools import count, cycle, repeat
|
||||
2 |
|
||||
3 | # Errors
|
||||
- zip()
|
||||
4 + zip(strict=False)
|
||||
5 | zip(range(3))
|
||||
6 | zip("a", "b")
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
|
||||
B905 [*] `zip()` without an explicit `strict=` parameter
|
||||
--> B905.py:5:1
|
||||
|
|
@ -33,16 +31,14 @@ B905 [*] `zip()` without an explicit `strict=` parameter
|
|||
7 | zip("a", "b", *zip("c"))
|
||||
|
|
||||
help: Add explicit value for parameter `strict=`
|
||||
|
||||
ℹ Safe fix
|
||||
2 2 |
|
||||
3 3 | # Errors
|
||||
4 4 | zip()
|
||||
5 |-zip(range(3))
|
||||
5 |+zip(range(3), strict=False)
|
||||
6 6 | zip("a", "b")
|
||||
7 7 | zip("a", "b", *zip("c"))
|
||||
8 8 | zip(zip("a"), strict=False)
|
||||
2 |
|
||||
3 | # Errors
|
||||
4 | zip()
|
||||
- zip(range(3))
|
||||
5 + zip(range(3), strict=False)
|
||||
6 | zip("a", "b")
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
8 | zip(zip("a"), strict=False)
|
||||
|
||||
B905 [*] `zip()` without an explicit `strict=` parameter
|
||||
--> B905.py:6:1
|
||||
|
|
@ -55,16 +51,14 @@ B905 [*] `zip()` without an explicit `strict=` parameter
|
|||
8 | zip(zip("a"), strict=False)
|
||||
|
|
||||
help: Add explicit value for parameter `strict=`
|
||||
|
||||
ℹ Safe fix
|
||||
3 3 | # Errors
|
||||
4 4 | zip()
|
||||
5 5 | zip(range(3))
|
||||
6 |-zip("a", "b")
|
||||
6 |+zip("a", "b", strict=False)
|
||||
7 7 | zip("a", "b", *zip("c"))
|
||||
8 8 | zip(zip("a"), strict=False)
|
||||
9 9 | zip(zip("a", strict=True))
|
||||
3 | # Errors
|
||||
4 | zip()
|
||||
5 | zip(range(3))
|
||||
- zip("a", "b")
|
||||
6 + zip("a", "b", strict=False)
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
8 | zip(zip("a"), strict=False)
|
||||
9 | zip(zip("a", strict=True))
|
||||
|
||||
B905 [*] `zip()` without an explicit `strict=` parameter
|
||||
--> B905.py:7:1
|
||||
|
|
@ -77,16 +71,14 @@ B905 [*] `zip()` without an explicit `strict=` parameter
|
|||
9 | zip(zip("a", strict=True))
|
||||
|
|
||||
help: Add explicit value for parameter `strict=`
|
||||
|
||||
ℹ Safe fix
|
||||
4 4 | zip()
|
||||
5 5 | zip(range(3))
|
||||
6 6 | zip("a", "b")
|
||||
7 |-zip("a", "b", *zip("c"))
|
||||
7 |+zip("a", "b", *zip("c"), strict=False)
|
||||
8 8 | zip(zip("a"), strict=False)
|
||||
9 9 | zip(zip("a", strict=True))
|
||||
10 10 |
|
||||
4 | zip()
|
||||
5 | zip(range(3))
|
||||
6 | zip("a", "b")
|
||||
- zip("a", "b", *zip("c"))
|
||||
7 + zip("a", "b", *zip("c"), strict=False)
|
||||
8 | zip(zip("a"), strict=False)
|
||||
9 | zip(zip("a", strict=True))
|
||||
10 |
|
||||
|
||||
B905 [*] `zip()` without an explicit `strict=` parameter
|
||||
--> B905.py:7:16
|
||||
|
|
@ -99,16 +91,14 @@ B905 [*] `zip()` without an explicit `strict=` parameter
|
|||
9 | zip(zip("a", strict=True))
|
||||
|
|
||||
help: Add explicit value for parameter `strict=`
|
||||
|
||||
ℹ Safe fix
|
||||
4 4 | zip()
|
||||
5 5 | zip(range(3))
|
||||
6 6 | zip("a", "b")
|
||||
7 |-zip("a", "b", *zip("c"))
|
||||
7 |+zip("a", "b", *zip("c", strict=False))
|
||||
8 8 | zip(zip("a"), strict=False)
|
||||
9 9 | zip(zip("a", strict=True))
|
||||
10 10 |
|
||||
4 | zip()
|
||||
5 | zip(range(3))
|
||||
6 | zip("a", "b")
|
||||
- zip("a", "b", *zip("c"))
|
||||
7 + zip("a", "b", *zip("c", strict=False))
|
||||
8 | zip(zip("a"), strict=False)
|
||||
9 | zip(zip("a", strict=True))
|
||||
10 |
|
||||
|
||||
B905 [*] `zip()` without an explicit `strict=` parameter
|
||||
--> B905.py:8:5
|
||||
|
|
@ -120,16 +110,14 @@ B905 [*] `zip()` without an explicit `strict=` parameter
|
|||
9 | zip(zip("a", strict=True))
|
||||
|
|
||||
help: Add explicit value for parameter `strict=`
|
||||
|
||||
ℹ Safe fix
|
||||
5 5 | zip(range(3))
|
||||
6 6 | zip("a", "b")
|
||||
7 7 | zip("a", "b", *zip("c"))
|
||||
8 |-zip(zip("a"), strict=False)
|
||||
8 |+zip(zip("a", strict=False), strict=False)
|
||||
9 9 | zip(zip("a", strict=True))
|
||||
10 10 |
|
||||
11 11 | # OK
|
||||
5 | zip(range(3))
|
||||
6 | zip("a", "b")
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
- zip(zip("a"), strict=False)
|
||||
8 + zip(zip("a", strict=False), strict=False)
|
||||
9 | zip(zip("a", strict=True))
|
||||
10 |
|
||||
11 | # OK
|
||||
|
||||
B905 [*] `zip()` without an explicit `strict=` parameter
|
||||
--> B905.py:9:1
|
||||
|
|
@ -142,16 +130,14 @@ B905 [*] `zip()` without an explicit `strict=` parameter
|
|||
11 | # OK
|
||||
|
|
||||
help: Add explicit value for parameter `strict=`
|
||||
|
||||
ℹ Safe fix
|
||||
6 6 | zip("a", "b")
|
||||
7 7 | zip("a", "b", *zip("c"))
|
||||
8 8 | zip(zip("a"), strict=False)
|
||||
9 |-zip(zip("a", strict=True))
|
||||
9 |+zip(zip("a", strict=True), strict=False)
|
||||
10 10 |
|
||||
11 11 | # OK
|
||||
12 12 | zip(range(3), strict=True)
|
||||
6 | zip("a", "b")
|
||||
7 | zip("a", "b", *zip("c"))
|
||||
8 | zip(zip("a"), strict=False)
|
||||
- zip(zip("a", strict=True))
|
||||
9 + zip(zip("a", strict=True), strict=False)
|
||||
10 |
|
||||
11 | # OK
|
||||
12 | zip(range(3), strict=True)
|
||||
|
||||
B905 [*] `zip()` without an explicit `strict=` parameter
|
||||
--> B905.py:24:1
|
||||
|
|
@ -162,16 +148,14 @@ B905 [*] `zip()` without an explicit `strict=` parameter
|
|||
25 | zip([1, 2, 3], repeat(1, times=4))
|
||||
|
|
||||
help: Add explicit value for parameter `strict=`
|
||||
|
||||
ℹ Safe fix
|
||||
21 21 | zip([1, 2, 3], repeat(1, times=None))
|
||||
22 22 |
|
||||
23 23 | # Errors (limited iterators).
|
||||
24 |-zip([1, 2, 3], repeat(1, 1))
|
||||
24 |+zip([1, 2, 3], repeat(1, 1), strict=False)
|
||||
25 25 | zip([1, 2, 3], repeat(1, times=4))
|
||||
26 26 |
|
||||
27 27 | import builtins
|
||||
21 | zip([1, 2, 3], repeat(1, times=None))
|
||||
22 |
|
||||
23 | # Errors (limited iterators).
|
||||
- zip([1, 2, 3], repeat(1, 1))
|
||||
24 + zip([1, 2, 3], repeat(1, 1), strict=False)
|
||||
25 | zip([1, 2, 3], repeat(1, times=4))
|
||||
26 |
|
||||
27 | import builtins
|
||||
|
||||
B905 [*] `zip()` without an explicit `strict=` parameter
|
||||
--> B905.py:25:1
|
||||
|
|
@ -184,16 +168,14 @@ B905 [*] `zip()` without an explicit `strict=` parameter
|
|||
27 | import builtins
|
||||
|
|
||||
help: Add explicit value for parameter `strict=`
|
||||
|
||||
ℹ Safe fix
|
||||
22 22 |
|
||||
23 23 | # Errors (limited iterators).
|
||||
24 24 | zip([1, 2, 3], repeat(1, 1))
|
||||
25 |-zip([1, 2, 3], repeat(1, times=4))
|
||||
25 |+zip([1, 2, 3], repeat(1, times=4), strict=False)
|
||||
26 26 |
|
||||
27 27 | import builtins
|
||||
28 28 | # Still an error even though it uses the qualified name
|
||||
22 |
|
||||
23 | # Errors (limited iterators).
|
||||
24 | zip([1, 2, 3], repeat(1, 1))
|
||||
- zip([1, 2, 3], repeat(1, times=4))
|
||||
25 + zip([1, 2, 3], repeat(1, times=4), strict=False)
|
||||
26 |
|
||||
27 | import builtins
|
||||
28 | # Still an error even though it uses the qualified name
|
||||
|
||||
B905 [*] `zip()` without an explicit `strict=` parameter
|
||||
--> B905.py:29:1
|
||||
|
|
@ -204,10 +186,8 @@ B905 [*] `zip()` without an explicit `strict=` parameter
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Add explicit value for parameter `strict=`
|
||||
|
||||
ℹ Safe fix
|
||||
26 26 |
|
||||
27 27 | import builtins
|
||||
28 28 | # Still an error even though it uses the qualified name
|
||||
29 |-builtins.zip([1, 2, 3])
|
||||
29 |+builtins.zip([1, 2, 3], strict=False)
|
||||
26 |
|
||||
27 | import builtins
|
||||
28 | # Still an error even though it uses the qualified name
|
||||
- builtins.zip([1, 2, 3])
|
||||
29 + builtins.zip([1, 2, 3], strict=False)
|
||||
|
|
|
|||
|
|
@ -9,11 +9,10 @@ B006 [*] Do not use mutable data structures for argument defaults
|
|||
18 | ...
|
||||
|
|
||||
help: Replace with `None`; initialize within function
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 | ...
|
||||
15 15 |
|
||||
16 16 |
|
||||
17 |-def error_due_to_missing_import(foo: ImmutableTypeA = []):
|
||||
17 |+def error_due_to_missing_import(foo: ImmutableTypeA = None):
|
||||
18 18 | ...
|
||||
14 | ...
|
||||
15 |
|
||||
16 |
|
||||
- def error_due_to_missing_import(foo: ImmutableTypeA = []):
|
||||
17 + def error_due_to_missing_import(foo: ImmutableTypeA = None):
|
||||
18 | ...
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -20,16 +20,14 @@ COM812 [*] Trailing comma missing
|
|||
657 | def f[
|
||||
|
|
||||
help: Add trailing comma
|
||||
|
||||
ℹ Safe fix
|
||||
652 652 | }"""
|
||||
653 653 |
|
||||
654 654 | type X[
|
||||
655 |- T
|
||||
655 |+ T,
|
||||
656 656 | ] = T
|
||||
657 657 | def f[
|
||||
658 658 | T
|
||||
652 | }"""
|
||||
653 |
|
||||
654 | type X[
|
||||
- T
|
||||
655 + T,
|
||||
656 | ] = T
|
||||
657 | def f[
|
||||
658 | T
|
||||
|
||||
|
||||
COM812 [*] Trailing comma missing
|
||||
|
|
@ -43,16 +41,14 @@ COM812 [*] Trailing comma missing
|
|||
660 | class C[
|
||||
|
|
||||
help: Add trailing comma
|
||||
|
||||
ℹ Safe fix
|
||||
655 655 | T
|
||||
656 656 | ] = T
|
||||
657 657 | def f[
|
||||
658 |- T
|
||||
658 |+ T,
|
||||
659 659 | ](): pass
|
||||
660 660 | class C[
|
||||
661 661 | T
|
||||
655 | T
|
||||
656 | ] = T
|
||||
657 | def f[
|
||||
- T
|
||||
658 + T,
|
||||
659 | ](): pass
|
||||
660 | class C[
|
||||
661 | T
|
||||
|
||||
|
||||
COM812 [*] Trailing comma missing
|
||||
|
|
@ -65,16 +61,14 @@ COM812 [*] Trailing comma missing
|
|||
662 | ]: pass
|
||||
|
|
||||
help: Add trailing comma
|
||||
|
||||
ℹ Safe fix
|
||||
658 658 | T
|
||||
659 659 | ](): pass
|
||||
660 660 | class C[
|
||||
661 |- T
|
||||
661 |+ T,
|
||||
662 662 | ]: pass
|
||||
663 663 |
|
||||
664 664 | type X[T,] = T
|
||||
658 | T
|
||||
659 | ](): pass
|
||||
660 | class C[
|
||||
- T
|
||||
661 + T,
|
||||
662 | ]: pass
|
||||
663 |
|
||||
664 | type X[T,] = T
|
||||
|
||||
|
||||
COM819 [*] Trailing comma prohibited
|
||||
|
|
@ -88,15 +82,13 @@ COM819 [*] Trailing comma prohibited
|
|||
666 | class C[T,]: pass
|
||||
|
|
||||
help: Remove trailing comma
|
||||
|
||||
ℹ Safe fix
|
||||
661 661 | T
|
||||
662 662 | ]: pass
|
||||
663 663 |
|
||||
664 |-type X[T,] = T
|
||||
664 |+type X[T] = T
|
||||
665 665 | def f[T,](): pass
|
||||
666 666 | class C[T,]: pass
|
||||
661 | T
|
||||
662 | ]: pass
|
||||
663 |
|
||||
- type X[T,] = T
|
||||
664 + type X[T] = T
|
||||
665 | def f[T,](): pass
|
||||
666 | class C[T,]: pass
|
||||
|
||||
|
||||
COM819 [*] Trailing comma prohibited
|
||||
|
|
@ -108,14 +100,12 @@ COM819 [*] Trailing comma prohibited
|
|||
666 | class C[T,]: pass
|
||||
|
|
||||
help: Remove trailing comma
|
||||
|
||||
ℹ Safe fix
|
||||
662 662 | ]: pass
|
||||
663 663 |
|
||||
664 664 | type X[T,] = T
|
||||
665 |-def f[T,](): pass
|
||||
665 |+def f[T](): pass
|
||||
666 666 | class C[T,]: pass
|
||||
662 | ]: pass
|
||||
663 |
|
||||
664 | type X[T,] = T
|
||||
- def f[T,](): pass
|
||||
665 + def f[T](): pass
|
||||
666 | class C[T,]: pass
|
||||
|
||||
|
||||
COM819 [*] Trailing comma prohibited
|
||||
|
|
@ -127,10 +117,8 @@ COM819 [*] Trailing comma prohibited
|
|||
| ^
|
||||
|
|
||||
help: Remove trailing comma
|
||||
|
||||
ℹ Safe fix
|
||||
663 663 |
|
||||
664 664 | type X[T,] = T
|
||||
665 665 | def f[T,](): pass
|
||||
666 |-class C[T,]: pass
|
||||
666 |+class C[T]: pass
|
||||
663 |
|
||||
664 | type X[T,] = T
|
||||
665 | def f[T,](): pass
|
||||
- class C[T,]: pass
|
||||
666 + class C[T]: pass
|
||||
|
|
|
|||
|
|
@ -11,14 +11,13 @@ C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
|||
4 | 2 * x + 1 for x in range(3)
|
||||
|
|
||||
help: Rewrite as a list comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Cannot combine with C416. Should use list comprehension here.
|
||||
2 |-even_nums = list(2 * x for x in range(3))
|
||||
2 |+even_nums = [2 * x for x in range(3)]
|
||||
3 3 | odd_nums = list(
|
||||
4 4 | 2 * x + 1 for x in range(3)
|
||||
5 5 | )
|
||||
1 | # Cannot combine with C416. Should use list comprehension here.
|
||||
- even_nums = list(2 * x for x in range(3))
|
||||
2 + even_nums = [2 * x for x in range(3)]
|
||||
3 | odd_nums = list(
|
||||
4 | 2 * x + 1 for x in range(3)
|
||||
5 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
||||
--> C400.py:3:12
|
||||
|
|
@ -32,18 +31,17 @@ C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
|||
| |_^
|
||||
|
|
||||
help: Rewrite as a list comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Cannot combine with C416. Should use list comprehension here.
|
||||
2 2 | even_nums = list(2 * x for x in range(3))
|
||||
3 |-odd_nums = list(
|
||||
3 |+odd_nums = [
|
||||
4 4 | 2 * x + 1 for x in range(3)
|
||||
5 |-)
|
||||
5 |+]
|
||||
6 6 |
|
||||
7 7 |
|
||||
8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3))
|
||||
1 | # Cannot combine with C416. Should use list comprehension here.
|
||||
2 | even_nums = list(2 * x for x in range(3))
|
||||
- odd_nums = list(
|
||||
3 + odd_nums = [
|
||||
4 | 2 * x + 1 for x in range(3)
|
||||
- )
|
||||
5 + ]
|
||||
6 |
|
||||
7 |
|
||||
8 | # Short-circuit case, combine with C416 and should produce x = list(range(3))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C400 [*] Unnecessary generator (rewrite using `list()`)
|
||||
--> C400.py:9:5
|
||||
|
|
@ -55,16 +53,15 @@ C400 [*] Unnecessary generator (rewrite using `list()`)
|
|||
11 | x for x in range(3)
|
||||
|
|
||||
help: Rewrite using `list()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 |
|
||||
7 7 |
|
||||
8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3))
|
||||
9 |-x = list(x for x in range(3))
|
||||
9 |+x = list(range(3))
|
||||
10 10 | x = list(
|
||||
11 11 | x for x in range(3)
|
||||
12 12 | )
|
||||
6 |
|
||||
7 |
|
||||
8 | # Short-circuit case, combine with C416 and should produce x = list(range(3))
|
||||
- x = list(x for x in range(3))
|
||||
9 + x = list(range(3))
|
||||
10 | x = list(
|
||||
11 | x for x in range(3)
|
||||
12 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C400 [*] Unnecessary generator (rewrite using `list()`)
|
||||
--> C400.py:10:5
|
||||
|
|
@ -80,18 +77,17 @@ C400 [*] Unnecessary generator (rewrite using `list()`)
|
|||
14 | # Strip parentheses from inner generators.
|
||||
|
|
||||
help: Rewrite using `list()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 |
|
||||
8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3))
|
||||
9 9 | x = list(x for x in range(3))
|
||||
10 |-x = list(
|
||||
11 |- x for x in range(3)
|
||||
12 |-)
|
||||
10 |+x = list(range(3))
|
||||
13 11 |
|
||||
14 12 | # Strip parentheses from inner generators.
|
||||
15 13 | list((2 * x for x in range(3)))
|
||||
7 |
|
||||
8 | # Short-circuit case, combine with C416 and should produce x = list(range(3))
|
||||
9 | x = list(x for x in range(3))
|
||||
- x = list(
|
||||
- x for x in range(3)
|
||||
- )
|
||||
10 + x = list(range(3))
|
||||
11 |
|
||||
12 | # Strip parentheses from inner generators.
|
||||
13 | list((2 * x for x in range(3)))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
||||
--> C400.py:15:1
|
||||
|
|
@ -103,16 +99,15 @@ C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
|||
17 | list((((2 * x for x in range(3)))))
|
||||
|
|
||||
help: Rewrite as a list comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | )
|
||||
13 13 |
|
||||
14 14 | # Strip parentheses from inner generators.
|
||||
15 |-list((2 * x for x in range(3)))
|
||||
15 |+[2 * x for x in range(3)]
|
||||
16 16 | list(((2 * x for x in range(3))))
|
||||
17 17 | list((((2 * x for x in range(3)))))
|
||||
18 18 |
|
||||
12 | )
|
||||
13 |
|
||||
14 | # Strip parentheses from inner generators.
|
||||
- list((2 * x for x in range(3)))
|
||||
15 + [2 * x for x in range(3)]
|
||||
16 | list(((2 * x for x in range(3))))
|
||||
17 | list((((2 * x for x in range(3)))))
|
||||
18 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
||||
--> C400.py:16:1
|
||||
|
|
@ -124,16 +119,15 @@ C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
|||
17 | list((((2 * x for x in range(3)))))
|
||||
|
|
||||
help: Rewrite as a list comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 |
|
||||
14 14 | # Strip parentheses from inner generators.
|
||||
15 15 | list((2 * x for x in range(3)))
|
||||
16 |-list(((2 * x for x in range(3))))
|
||||
16 |+[2 * x for x in range(3)]
|
||||
17 17 | list((((2 * x for x in range(3)))))
|
||||
18 18 |
|
||||
19 19 | # Account for trailing comma in fix
|
||||
13 |
|
||||
14 | # Strip parentheses from inner generators.
|
||||
15 | list((2 * x for x in range(3)))
|
||||
- list(((2 * x for x in range(3))))
|
||||
16 + [2 * x for x in range(3)]
|
||||
17 | list((((2 * x for x in range(3)))))
|
||||
18 |
|
||||
19 | # Account for trailing comma in fix
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
||||
--> C400.py:17:1
|
||||
|
|
@ -146,16 +140,15 @@ C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
|||
19 | # Account for trailing comma in fix
|
||||
|
|
||||
help: Rewrite as a list comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 | # Strip parentheses from inner generators.
|
||||
15 15 | list((2 * x for x in range(3)))
|
||||
16 16 | list(((2 * x for x in range(3))))
|
||||
17 |-list((((2 * x for x in range(3)))))
|
||||
17 |+[2 * x for x in range(3)]
|
||||
18 18 |
|
||||
19 19 | # Account for trailing comma in fix
|
||||
20 20 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
14 | # Strip parentheses from inner generators.
|
||||
15 | list((2 * x for x in range(3)))
|
||||
16 | list(((2 * x for x in range(3))))
|
||||
- list((((2 * x for x in range(3)))))
|
||||
17 + [2 * x for x in range(3)]
|
||||
18 |
|
||||
19 | # Account for trailing comma in fix
|
||||
20 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
||||
--> C400.py:21:1
|
||||
|
|
@ -168,16 +161,15 @@ C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
|||
23 | (0 for _ in [])
|
||||
|
|
||||
help: Rewrite as a list comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
18 18 |
|
||||
19 19 | # Account for trailing comma in fix
|
||||
20 20 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
21 |-list((0 for _ in []),)
|
||||
21 |+[0 for _ in []]
|
||||
22 22 | list(
|
||||
23 23 | (0 for _ in [])
|
||||
24 24 | # some comments
|
||||
18 |
|
||||
19 | # Account for trailing comma in fix
|
||||
20 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
- list((0 for _ in []),)
|
||||
21 + [0 for _ in []]
|
||||
22 | list(
|
||||
23 | (0 for _ in [])
|
||||
24 | # some comments
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
||||
--> C400.py:22:1
|
||||
|
|
@ -193,20 +185,19 @@ C400 [*] Unnecessary generator (rewrite as a list comprehension)
|
|||
| |__^
|
||||
|
|
||||
help: Rewrite as a list comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
19 19 | # Account for trailing comma in fix
|
||||
20 20 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
21 21 | list((0 for _ in []),)
|
||||
22 |-list(
|
||||
23 |- (0 for _ in [])
|
||||
22 |+[
|
||||
23 |+ 0 for _ in []
|
||||
24 24 | # some comments
|
||||
25 |- ,
|
||||
26 |- # some more
|
||||
27 |- )
|
||||
25 |+ ]
|
||||
28 26 |
|
||||
29 27 |
|
||||
30 28 | # Not built-in list.
|
||||
19 | # Account for trailing comma in fix
|
||||
20 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
21 | list((0 for _ in []),)
|
||||
- list(
|
||||
- (0 for _ in [])
|
||||
22 + [
|
||||
23 + 0 for _ in []
|
||||
24 | # some comments
|
||||
- ,
|
||||
- # some more
|
||||
- )
|
||||
25 + ]
|
||||
26 |
|
||||
27 |
|
||||
28 | # Not built-in list.
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -11,14 +11,13 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
4 | 2 * x + 1 for x in range(3)
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Cannot combine with C416. Should use set comprehension here.
|
||||
2 |-even_nums = set(2 * x for x in range(3))
|
||||
2 |+even_nums = {2 * x for x in range(3)}
|
||||
3 3 | odd_nums = set(
|
||||
4 4 | 2 * x + 1 for x in range(3)
|
||||
5 5 | )
|
||||
1 | # Cannot combine with C416. Should use set comprehension here.
|
||||
- even_nums = set(2 * x for x in range(3))
|
||||
2 + even_nums = {2 * x for x in range(3)}
|
||||
3 | odd_nums = set(
|
||||
4 | 2 * x + 1 for x in range(3)
|
||||
5 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:3:12
|
||||
|
|
@ -33,18 +32,17 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
6 | small_nums = f"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Cannot combine with C416. Should use set comprehension here.
|
||||
2 2 | even_nums = set(2 * x for x in range(3))
|
||||
3 |-odd_nums = set(
|
||||
3 |+odd_nums = {
|
||||
4 4 | 2 * x + 1 for x in range(3)
|
||||
5 |-)
|
||||
5 |+}
|
||||
6 6 | small_nums = f"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
7 7 |
|
||||
8 8 | def f(x):
|
||||
1 | # Cannot combine with C416. Should use set comprehension here.
|
||||
2 | even_nums = set(2 * x for x in range(3))
|
||||
- odd_nums = set(
|
||||
3 + odd_nums = {
|
||||
4 | 2 * x + 1 for x in range(3)
|
||||
- )
|
||||
5 + }
|
||||
6 | small_nums = f"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
7 |
|
||||
8 | def f(x):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:6:17
|
||||
|
|
@ -57,16 +55,15 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
8 | def f(x):
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | odd_nums = set(
|
||||
4 4 | 2 * x + 1 for x in range(3)
|
||||
5 5 | )
|
||||
6 |-small_nums = f"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
6 |+small_nums = f"{ {a if a < 6 else 0 for a in range(3)} }"
|
||||
7 7 |
|
||||
8 8 | def f(x):
|
||||
9 9 | return x
|
||||
3 | odd_nums = set(
|
||||
4 | 2 * x + 1 for x in range(3)
|
||||
5 | )
|
||||
- small_nums = f"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
6 + small_nums = f"{ {a if a < 6 else 0 for a in range(3)} }"
|
||||
7 |
|
||||
8 | def f(x):
|
||||
9 | return x
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:11:16
|
||||
|
|
@ -78,16 +75,15 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
12 | print(f"Hello { set(f(a) for a in 'abc') } World")
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | def f(x):
|
||||
9 9 | return x
|
||||
10 10 |
|
||||
11 |-print(f"Hello {set(f(a) for a in 'abc')} World")
|
||||
11 |+print(f"Hello { {f(a) for a in 'abc'} } World")
|
||||
12 12 | print(f"Hello { set(f(a) for a in 'abc') } World")
|
||||
13 13 |
|
||||
14 14 |
|
||||
8 | def f(x):
|
||||
9 | return x
|
||||
10 |
|
||||
- print(f"Hello {set(f(a) for a in 'abc')} World")
|
||||
11 + print(f"Hello { {f(a) for a in 'abc'} } World")
|
||||
12 | print(f"Hello { set(f(a) for a in 'abc') } World")
|
||||
13 |
|
||||
14 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:12:17
|
||||
|
|
@ -97,16 +93,15 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | return x
|
||||
10 10 |
|
||||
11 11 | print(f"Hello {set(f(a) for a in 'abc')} World")
|
||||
12 |-print(f"Hello { set(f(a) for a in 'abc') } World")
|
||||
12 |+print(f"Hello { {f(a) for a in 'abc'} } World")
|
||||
13 13 |
|
||||
14 14 |
|
||||
15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3))
|
||||
9 | return x
|
||||
10 |
|
||||
11 | print(f"Hello {set(f(a) for a in 'abc')} World")
|
||||
- print(f"Hello { set(f(a) for a in 'abc') } World")
|
||||
12 + print(f"Hello { {f(a) for a in 'abc'} } World")
|
||||
13 |
|
||||
14 |
|
||||
15 | # Short-circuit case, combine with C416 and should produce x = set(range(3))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:16:5
|
||||
|
|
@ -118,16 +113,15 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
18 | x for x in range(3)
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 |
|
||||
14 14 |
|
||||
15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3))
|
||||
16 |-x = set(x for x in range(3))
|
||||
16 |+x = set(range(3))
|
||||
17 17 | x = set(
|
||||
18 18 | x for x in range(3)
|
||||
19 19 | )
|
||||
13 |
|
||||
14 |
|
||||
15 | # Short-circuit case, combine with C416 and should produce x = set(range(3))
|
||||
- x = set(x for x in range(3))
|
||||
16 + x = set(range(3))
|
||||
17 | x = set(
|
||||
18 | x for x in range(3)
|
||||
19 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:17:5
|
||||
|
|
@ -143,18 +137,17 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 |
|
||||
15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3))
|
||||
16 16 | x = set(x for x in range(3))
|
||||
17 |-x = set(
|
||||
18 |- x for x in range(3)
|
||||
19 |-)
|
||||
17 |+x = set(range(3))
|
||||
20 18 | print(f"Hello {set(a for a in range(3))} World")
|
||||
21 19 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
22 20 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
14 |
|
||||
15 | # Short-circuit case, combine with C416 and should produce x = set(range(3))
|
||||
16 | x = set(x for x in range(3))
|
||||
- x = set(
|
||||
- x for x in range(3)
|
||||
- )
|
||||
17 + x = set(range(3))
|
||||
18 | print(f"Hello {set(a for a in range(3))} World")
|
||||
19 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
20 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:20:16
|
||||
|
|
@ -167,16 +160,15 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 | x = set(
|
||||
18 18 | x for x in range(3)
|
||||
19 19 | )
|
||||
20 |-print(f"Hello {set(a for a in range(3))} World")
|
||||
20 |+print(f"Hello {set(range(3))} World")
|
||||
21 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
22 22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
23 23 |
|
||||
17 | x = set(
|
||||
18 | x for x in range(3)
|
||||
19 | )
|
||||
- print(f"Hello {set(a for a in range(3))} World")
|
||||
20 + print(f"Hello {set(range(3))} World")
|
||||
21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
23 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:21:10
|
||||
|
|
@ -188,16 +180,15 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
18 18 | x for x in range(3)
|
||||
19 19 | )
|
||||
20 20 | print(f"Hello {set(a for a in range(3))} World")
|
||||
21 |-print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
21 |+print(f"{set('abc') - set(a for a in 'ab')}")
|
||||
22 22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
23 23 |
|
||||
24 24 | # Strip parentheses from inner generators.
|
||||
18 | x for x in range(3)
|
||||
19 | )
|
||||
20 | print(f"Hello {set(a for a in range(3))} World")
|
||||
- print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
21 + print(f"{set('abc') - set(a for a in 'ab')}")
|
||||
22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
23 |
|
||||
24 | # Strip parentheses from inner generators.
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:21:34
|
||||
|
|
@ -209,16 +200,15 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
18 18 | x for x in range(3)
|
||||
19 19 | )
|
||||
20 20 | print(f"Hello {set(a for a in range(3))} World")
|
||||
21 |-print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
21 |+print(f"{set(a for a in 'abc') - set('ab')}")
|
||||
22 22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
23 23 |
|
||||
24 24 | # Strip parentheses from inner generators.
|
||||
18 | x for x in range(3)
|
||||
19 | )
|
||||
20 | print(f"Hello {set(a for a in range(3))} World")
|
||||
- print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
21 + print(f"{set(a for a in 'abc') - set('ab')}")
|
||||
22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
23 |
|
||||
24 | # Strip parentheses from inner generators.
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:22:11
|
||||
|
|
@ -231,16 +221,15 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
24 | # Strip parentheses from inner generators.
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
19 19 | )
|
||||
20 20 | print(f"Hello {set(a for a in range(3))} World")
|
||||
21 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
22 |-print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
22 |+print(f"{ set('abc') - set(a for a in 'ab') }")
|
||||
23 23 |
|
||||
24 24 | # Strip parentheses from inner generators.
|
||||
25 25 | set((2 * x for x in range(3)))
|
||||
19 | )
|
||||
20 | print(f"Hello {set(a for a in range(3))} World")
|
||||
21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
- print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
22 + print(f"{ set('abc') - set(a for a in 'ab') }")
|
||||
23 |
|
||||
24 | # Strip parentheses from inner generators.
|
||||
25 | set((2 * x for x in range(3)))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:22:35
|
||||
|
|
@ -253,16 +242,15 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
24 | # Strip parentheses from inner generators.
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
19 19 | )
|
||||
20 20 | print(f"Hello {set(a for a in range(3))} World")
|
||||
21 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
22 |-print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
22 |+print(f"{ set(a for a in 'abc') - set('ab') }")
|
||||
23 23 |
|
||||
24 24 | # Strip parentheses from inner generators.
|
||||
25 25 | set((2 * x for x in range(3)))
|
||||
19 | )
|
||||
20 | print(f"Hello {set(a for a in range(3))} World")
|
||||
21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
- print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
22 + print(f"{ set(a for a in 'abc') - set('ab') }")
|
||||
23 |
|
||||
24 | # Strip parentheses from inner generators.
|
||||
25 | set((2 * x for x in range(3)))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:25:1
|
||||
|
|
@ -274,16 +262,15 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
27 | set((((2 * x for x in range(3)))))
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
23 23 |
|
||||
24 24 | # Strip parentheses from inner generators.
|
||||
25 |-set((2 * x for x in range(3)))
|
||||
25 |+{2 * x for x in range(3)}
|
||||
26 26 | set(((2 * x for x in range(3))))
|
||||
27 27 | set((((2 * x for x in range(3)))))
|
||||
28 28 |
|
||||
22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
23 |
|
||||
24 | # Strip parentheses from inner generators.
|
||||
- set((2 * x for x in range(3)))
|
||||
25 + {2 * x for x in range(3)}
|
||||
26 | set(((2 * x for x in range(3))))
|
||||
27 | set((((2 * x for x in range(3)))))
|
||||
28 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:26:1
|
||||
|
|
@ -295,16 +282,15 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
27 | set((((2 * x for x in range(3)))))
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
23 23 |
|
||||
24 24 | # Strip parentheses from inner generators.
|
||||
25 25 | set((2 * x for x in range(3)))
|
||||
26 |-set(((2 * x for x in range(3))))
|
||||
26 |+{2 * x for x in range(3)}
|
||||
27 27 | set((((2 * x for x in range(3)))))
|
||||
28 28 |
|
||||
29 29 | # Account for trailing comma in fix
|
||||
23 |
|
||||
24 | # Strip parentheses from inner generators.
|
||||
25 | set((2 * x for x in range(3)))
|
||||
- set(((2 * x for x in range(3))))
|
||||
26 + {2 * x for x in range(3)}
|
||||
27 | set((((2 * x for x in range(3)))))
|
||||
28 |
|
||||
29 | # Account for trailing comma in fix
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:27:1
|
||||
|
|
@ -317,16 +303,15 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
29 | # Account for trailing comma in fix
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
24 24 | # Strip parentheses from inner generators.
|
||||
25 25 | set((2 * x for x in range(3)))
|
||||
26 26 | set(((2 * x for x in range(3))))
|
||||
27 |-set((((2 * x for x in range(3)))))
|
||||
27 |+{2 * x for x in range(3)}
|
||||
28 28 |
|
||||
29 29 | # Account for trailing comma in fix
|
||||
30 30 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
24 | # Strip parentheses from inner generators.
|
||||
25 | set((2 * x for x in range(3)))
|
||||
26 | set(((2 * x for x in range(3))))
|
||||
- set((((2 * x for x in range(3)))))
|
||||
27 + {2 * x for x in range(3)}
|
||||
28 |
|
||||
29 | # Account for trailing comma in fix
|
||||
30 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:31:1
|
||||
|
|
@ -339,16 +324,15 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
33 | (0 for _ in [])
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
28 28 |
|
||||
29 29 | # Account for trailing comma in fix
|
||||
30 30 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
31 |-set((0 for _ in []),)
|
||||
31 |+{0 for _ in []}
|
||||
32 32 | set(
|
||||
33 33 | (0 for _ in [])
|
||||
34 34 | # some comments
|
||||
28 |
|
||||
29 | # Account for trailing comma in fix
|
||||
30 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
- set((0 for _ in []),)
|
||||
31 + {0 for _ in []}
|
||||
32 | set(
|
||||
33 | (0 for _ in [])
|
||||
34 | # some comments
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:32:1
|
||||
|
|
@ -366,23 +350,22 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
39 | # t-strings
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 | # Account for trailing comma in fix
|
||||
30 30 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
31 31 | set((0 for _ in []),)
|
||||
32 |-set(
|
||||
33 |- (0 for _ in [])
|
||||
32 |+{
|
||||
33 |+ 0 for _ in []
|
||||
34 34 | # some comments
|
||||
35 |- ,
|
||||
36 |- # some more
|
||||
37 |-)
|
||||
35 |+ }
|
||||
38 36 |
|
||||
39 37 | # t-strings
|
||||
40 38 | print(t"Hello {set(f(a) for a in 'abc')} World")
|
||||
29 | # Account for trailing comma in fix
|
||||
30 | # See https://github.com/astral-sh/ruff/issues/15852
|
||||
31 | set((0 for _ in []),)
|
||||
- set(
|
||||
- (0 for _ in [])
|
||||
32 + {
|
||||
33 + 0 for _ in []
|
||||
34 | # some comments
|
||||
- ,
|
||||
- # some more
|
||||
- )
|
||||
35 + }
|
||||
36 |
|
||||
37 | # t-strings
|
||||
38 | print(t"Hello {set(f(a) for a in 'abc')} World")
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:40:16
|
||||
|
|
@ -394,16 +377,15 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
37 37 | )
|
||||
38 38 |
|
||||
39 39 | # t-strings
|
||||
40 |-print(t"Hello {set(f(a) for a in 'abc')} World")
|
||||
40 |+print(t"Hello { {f(a) for a in 'abc'} } World")
|
||||
41 41 | print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
42 42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
37 | )
|
||||
38 |
|
||||
39 | # t-strings
|
||||
- print(t"Hello {set(f(a) for a in 'abc')} World")
|
||||
40 + print(t"Hello { {f(a) for a in 'abc'} } World")
|
||||
41 | print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:41:17
|
||||
|
|
@ -416,16 +398,15 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
38 38 |
|
||||
39 39 | # t-strings
|
||||
40 40 | print(t"Hello {set(f(a) for a in 'abc')} World")
|
||||
41 |-print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
41 |+print(t"Hello { {f(a) for a in 'abc'} } World")
|
||||
42 42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
44 44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
38 |
|
||||
39 | # t-strings
|
||||
40 | print(t"Hello {set(f(a) for a in 'abc')} World")
|
||||
- print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
41 + print(t"Hello { {f(a) for a in 'abc'} } World")
|
||||
42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
||||
--> C401.py:42:17
|
||||
|
|
@ -438,16 +419,15 @@ C401 [*] Unnecessary generator (rewrite as a set comprehension)
|
|||
44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
39 39 | # t-strings
|
||||
40 40 | print(t"Hello {set(f(a) for a in 'abc')} World")
|
||||
41 41 | print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
42 |-small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
42 |+small_nums = t"{ {a if a < 6 else 0 for a in range(3)} }"
|
||||
43 43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
44 44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
45 45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
39 | # t-strings
|
||||
40 | print(t"Hello {set(f(a) for a in 'abc')} World")
|
||||
41 | print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
- small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
42 + small_nums = t"{ {a if a < 6 else 0 for a in range(3)} }"
|
||||
43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:43:16
|
||||
|
|
@ -460,16 +440,15 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
40 40 | print(t"Hello {set(f(a) for a in 'abc')} World")
|
||||
41 41 | print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
42 42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 |-print(t"Hello {set(a for a in range(3))} World")
|
||||
43 |+print(t"Hello {set(range(3))} World")
|
||||
44 44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
45 45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
46 46 |
|
||||
40 | print(t"Hello {set(f(a) for a in 'abc')} World")
|
||||
41 | print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
- print(t"Hello {set(a for a in range(3))} World")
|
||||
43 + print(t"Hello {set(range(3))} World")
|
||||
44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
46 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:44:10
|
||||
|
|
@ -481,16 +460,15 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
41 41 | print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
42 42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
44 |-print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
44 |+print(t"{set('abc') - set(a for a in 'ab')}")
|
||||
45 45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
46 46 |
|
||||
47 47 |
|
||||
41 | print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
- print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
44 + print(t"{set('abc') - set(a for a in 'ab')}")
|
||||
45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
46 |
|
||||
47 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:44:34
|
||||
|
|
@ -502,16 +480,15 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
41 41 | print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
42 42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
44 |-print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
44 |+print(t"{set(a for a in 'abc') - set('ab')}")
|
||||
45 45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
46 46 |
|
||||
47 47 |
|
||||
41 | print(t"Hello { set(f(a) for a in 'abc') } World")
|
||||
42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
- print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
44 + print(t"{set(a for a in 'abc') - set('ab')}")
|
||||
45 | print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
46 |
|
||||
47 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:45:11
|
||||
|
|
@ -522,16 +499,15 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
42 42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
44 44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
45 |-print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
45 |+print(t"{ set('abc') - set(a for a in 'ab') }")
|
||||
46 46 |
|
||||
47 47 |
|
||||
48 48 | # Not built-in set.
|
||||
42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
- print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
45 + print(t"{ set('abc') - set(a for a in 'ab') }")
|
||||
46 |
|
||||
47 |
|
||||
48 | # Not built-in set.
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C401 [*] Unnecessary generator (rewrite using `set()`)
|
||||
--> C401.py:45:35
|
||||
|
|
@ -542,13 +518,12 @@ C401 [*] Unnecessary generator (rewrite using `set()`)
|
|||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
42 42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
44 44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
45 |-print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
45 |+print(t"{ set(a for a in 'abc') - set('ab') }")
|
||||
46 46 |
|
||||
47 47 |
|
||||
48 48 | # Not built-in set.
|
||||
42 | small_nums = t"{set(a if a < 6 else 0 for a in range(3))}"
|
||||
43 | print(t"Hello {set(a for a in range(3))} World")
|
||||
44 | print(t"{set(a for a in 'abc') - set(a for a in 'ab')}")
|
||||
- print(t"{ set(a for a in 'abc') - set(a for a in 'ab') }")
|
||||
45 + print(t"{ set(a for a in 'abc') - set('ab') }")
|
||||
46 |
|
||||
47 |
|
||||
48 | # Not built-in set.
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
3 | (x, x) for x in range(3)
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-dict((x, x) for x in range(3))
|
||||
1 |+{x: x for x in range(3)}
|
||||
2 2 | dict(
|
||||
3 3 | (x, x) for x in range(3)
|
||||
4 4 | )
|
||||
- dict((x, x) for x in range(3))
|
||||
1 + {x: x for x in range(3)}
|
||||
2 | dict(
|
||||
3 | (x, x) for x in range(3)
|
||||
4 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:2:1
|
||||
|
|
@ -30,18 +29,17 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
6 | y = f'{dict((x, x) for x in range(3))}'
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | dict((x, x) for x in range(3))
|
||||
2 |-dict(
|
||||
3 |- (x, x) for x in range(3)
|
||||
4 |-)
|
||||
2 |+{
|
||||
3 |+ x: x for x in range(3)
|
||||
4 |+}
|
||||
5 5 | dict(((x, x) for x in range(3)), z=3)
|
||||
6 6 | y = f'{dict((x, x) for x in range(3))}'
|
||||
7 7 | print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
1 | dict((x, x) for x in range(3))
|
||||
- dict(
|
||||
- (x, x) for x in range(3)
|
||||
- )
|
||||
2 + {
|
||||
3 + x: x for x in range(3)
|
||||
4 + }
|
||||
5 | dict(((x, x) for x in range(3)), z=3)
|
||||
6 | y = f'{dict((x, x) for x in range(3))}'
|
||||
7 | print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:6:8
|
||||
|
|
@ -54,16 +52,15 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | (x, x) for x in range(3)
|
||||
4 4 | )
|
||||
5 5 | dict(((x, x) for x in range(3)), z=3)
|
||||
6 |-y = f'{dict((x, x) for x in range(3))}'
|
||||
6 |+y = f'{ {x: x for x in range(3)} }'
|
||||
7 7 | print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
9 9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
3 | (x, x) for x in range(3)
|
||||
4 | )
|
||||
5 | dict(((x, x) for x in range(3)), z=3)
|
||||
- y = f'{dict((x, x) for x in range(3))}'
|
||||
6 + y = f'{ {x: x for x in range(3)} }'
|
||||
7 | print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:7:16
|
||||
|
|
@ -76,16 +73,15 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | )
|
||||
5 5 | dict(((x, x) for x in range(3)), z=3)
|
||||
6 6 | y = f'{dict((x, x) for x in range(3))}'
|
||||
7 |-print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
7 |+print(f'Hello { {x: x for x in range(3)} } World')
|
||||
8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
9 9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
10 10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
4 | )
|
||||
5 | dict(((x, x) for x in range(3)), z=3)
|
||||
6 | y = f'{dict((x, x) for x in range(3))}'
|
||||
- print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
7 + print(f'Hello { {x: x for x in range(3)} } World')
|
||||
8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:8:16
|
||||
|
|
@ -98,16 +94,15 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | dict(((x, x) for x in range(3)), z=3)
|
||||
6 6 | y = f'{dict((x, x) for x in range(3))}'
|
||||
7 7 | print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
8 |-print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
8 |+print(f"Hello { {x: x for x in 'abc'} } World")
|
||||
9 9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
10 10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 11 |
|
||||
5 | dict(((x, x) for x in range(3)), z=3)
|
||||
6 | y = f'{dict((x, x) for x in range(3))}'
|
||||
7 | print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
- print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
8 + print(f"Hello { {x: x for x in 'abc'} } World")
|
||||
9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:9:16
|
||||
|
|
@ -119,16 +114,15 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 | y = f'{dict((x, x) for x in range(3))}'
|
||||
7 7 | print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
9 |-print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
9 |+print(f'Hello { {x: x for x in "abc"} } World')
|
||||
10 10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 11 |
|
||||
12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
6 | y = f'{dict((x, x) for x in range(3))}'
|
||||
7 | print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
- print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
9 + print(f'Hello { {x: x for x in "abc"} } World')
|
||||
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 |
|
||||
12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:10:16
|
||||
|
|
@ -141,16 +135,15 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
9 9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
10 |-print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
10 |+print(f'Hello { {x: x for x in "abc"} } World')
|
||||
11 11 |
|
||||
12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
7 | print(f'Hello {dict((x, x) for x in range(3))} World')
|
||||
8 | print(f"Hello {dict((x, x) for x in 'abc')} World")
|
||||
9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
- print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
10 + print(f'Hello { {x: x for x in "abc"} } World')
|
||||
11 |
|
||||
12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:12:4
|
||||
|
|
@ -162,16 +155,15 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
10 10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 11 |
|
||||
12 |-f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
12 |+f'{ {x: x for x in range(3)} | dict((x, x) for x in range(3))}'
|
||||
13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
14 14 |
|
||||
15 15 | def f(x):
|
||||
9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 |
|
||||
- f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
12 + f'{ {x: x for x in range(3)} | dict((x, x) for x in range(3))}'
|
||||
13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
14 |
|
||||
15 | def f(x):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:12:37
|
||||
|
|
@ -183,16 +175,15 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
10 10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 11 |
|
||||
12 |-f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
12 |+f'{dict((x, x) for x in range(3)) | {x: x for x in range(3)} }'
|
||||
13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
14 14 |
|
||||
15 15 | def f(x):
|
||||
9 | print(f'Hello {dict((x, x) for x in "abc")} World')
|
||||
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 |
|
||||
- f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
12 + f'{dict((x, x) for x in range(3)) | {x: x for x in range(3)} }'
|
||||
13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
14 |
|
||||
15 | def f(x):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:13:5
|
||||
|
|
@ -204,16 +195,15 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
15 | def f(x):
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
10 10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 11 |
|
||||
12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
13 |-f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
13 |+f'{ {x: x for x in range(3)} | dict((x, x) for x in range(3)) }'
|
||||
14 14 |
|
||||
15 15 | def f(x):
|
||||
16 16 | return x
|
||||
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 |
|
||||
12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
- f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
13 + f'{ {x: x for x in range(3)} | dict((x, x) for x in range(3)) }'
|
||||
14 |
|
||||
15 | def f(x):
|
||||
16 | return x
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:13:38
|
||||
|
|
@ -225,16 +215,15 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
15 | def f(x):
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
10 10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 11 |
|
||||
12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
13 |-f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
13 |+f'{ dict((x, x) for x in range(3)) | {x: x for x in range(3)} }'
|
||||
14 14 |
|
||||
15 15 | def f(x):
|
||||
16 16 | return x
|
||||
10 | print(f'Hello {dict((x,x) for x in "abc")} World')
|
||||
11 |
|
||||
12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}'
|
||||
- f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }'
|
||||
13 + f'{ dict((x, x) for x in range(3)) | {x: x for x in range(3)} }'
|
||||
14 |
|
||||
15 | def f(x):
|
||||
16 | return x
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:18:16
|
||||
|
|
@ -247,16 +236,15 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
15 15 | def f(x):
|
||||
16 16 | return x
|
||||
17 17 |
|
||||
18 |-print(f'Hello {dict((x,f(x)) for x in "abc")} World')
|
||||
18 |+print(f'Hello { {x: f(x) for x in "abc"} } World')
|
||||
19 19 |
|
||||
20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086
|
||||
21 21 | dict((k,v)for k,v in d.iteritems() if k in only_args)
|
||||
15 | def f(x):
|
||||
16 | return x
|
||||
17 |
|
||||
- print(f'Hello {dict((x,f(x)) for x in "abc")} World')
|
||||
18 + print(f'Hello { {x: f(x) for x in "abc"} } World')
|
||||
19 |
|
||||
20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086
|
||||
21 | dict((k,v)for k,v in d.iteritems() if k in only_args)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
||||
--> C402.py:21:1
|
||||
|
|
@ -268,13 +256,12 @@ C402 [*] Unnecessary generator (rewrite as a dict comprehension)
|
|||
23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458940
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
18 18 | print(f'Hello {dict((x,f(x)) for x in "abc")} World')
|
||||
19 19 |
|
||||
20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086
|
||||
21 |-dict((k,v)for k,v in d.iteritems() if k in only_args)
|
||||
21 |+{k: v for k,v in d.iteritems() if k in only_args}
|
||||
22 22 |
|
||||
23 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458940
|
||||
24 24 | dict((*v, k) for k, v in enumerate(calendar.month_abbr))
|
||||
18 | print(f'Hello {dict((x,f(x)) for x in "abc")} World')
|
||||
19 |
|
||||
20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086
|
||||
- dict((k,v)for k,v in d.iteritems() if k in only_args)
|
||||
21 + {k: v for k,v in d.iteritems() if k in only_args}
|
||||
22 |
|
||||
23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458940
|
||||
24 | dict((*v, k) for k, v in enumerate(calendar.month_abbr))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
3 | [x for x in range(3)]
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-s = set([x for x in range(3)])
|
||||
1 |+s = {x for x in range(3)}
|
||||
2 2 | s = set(
|
||||
3 3 | [x for x in range(3)]
|
||||
4 4 | )
|
||||
- s = set([x for x in range(3)])
|
||||
1 + s = {x for x in range(3)}
|
||||
2 | s = set(
|
||||
3 | [x for x in range(3)]
|
||||
4 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:2:5
|
||||
|
|
@ -31,18 +30,17 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
6 | s = f"{set([x for x in 'ab'])}"
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | s = set([x for x in range(3)])
|
||||
2 |-s = set(
|
||||
3 |- [x for x in range(3)]
|
||||
4 |-)
|
||||
2 |+s = {
|
||||
3 |+ x for x in range(3)
|
||||
4 |+}
|
||||
5 5 |
|
||||
6 6 | s = f"{set([x for x in 'ab'])}"
|
||||
7 7 | s = f'{set([x for x in "ab"])}'
|
||||
1 | s = set([x for x in range(3)])
|
||||
- s = set(
|
||||
- [x for x in range(3)]
|
||||
- )
|
||||
2 + s = {
|
||||
3 + x for x in range(3)
|
||||
4 + }
|
||||
5 |
|
||||
6 | s = f"{set([x for x in 'ab'])}"
|
||||
7 | s = f'{set([x for x in "ab"])}'
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:6:8
|
||||
|
|
@ -54,16 +52,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
7 | s = f'{set([x for x in "ab"])}'
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | [x for x in range(3)]
|
||||
4 4 | )
|
||||
5 5 |
|
||||
6 |-s = f"{set([x for x in 'ab'])}"
|
||||
6 |+s = f"{ {x for x in 'ab'} }"
|
||||
7 7 | s = f'{set([x for x in "ab"])}'
|
||||
8 8 |
|
||||
9 9 | def f(x):
|
||||
3 | [x for x in range(3)]
|
||||
4 | )
|
||||
5 |
|
||||
- s = f"{set([x for x in 'ab'])}"
|
||||
6 + s = f"{ {x for x in 'ab'} }"
|
||||
7 | s = f'{set([x for x in "ab"])}'
|
||||
8 |
|
||||
9 | def f(x):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:7:8
|
||||
|
|
@ -75,16 +72,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
9 | def f(x):
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | )
|
||||
5 5 |
|
||||
6 6 | s = f"{set([x for x in 'ab'])}"
|
||||
7 |-s = f'{set([x for x in "ab"])}'
|
||||
7 |+s = f'{ {x for x in "ab"} }'
|
||||
8 8 |
|
||||
9 9 | def f(x):
|
||||
10 10 | return x
|
||||
4 | )
|
||||
5 |
|
||||
6 | s = f"{set([x for x in 'ab'])}"
|
||||
- s = f'{set([x for x in "ab"])}'
|
||||
7 + s = f'{ {x for x in "ab"} }'
|
||||
8 |
|
||||
9 | def f(x):
|
||||
10 | return x
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:12:8
|
||||
|
|
@ -97,16 +93,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | def f(x):
|
||||
10 10 | return x
|
||||
11 11 |
|
||||
12 |-s = f"{set([f(x) for x in 'ab'])}"
|
||||
12 |+s = f"{ {f(x) for x in 'ab'} }"
|
||||
13 13 |
|
||||
14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
9 | def f(x):
|
||||
10 | return x
|
||||
11 |
|
||||
- s = f"{set([f(x) for x in 'ab'])}"
|
||||
12 + s = f"{ {f(x) for x in 'ab'} }"
|
||||
13 |
|
||||
14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:14:9
|
||||
|
|
@ -118,16 +113,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
11 11 |
|
||||
12 12 | s = f"{set([f(x) for x in 'ab'])}"
|
||||
13 13 |
|
||||
14 |-s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
14 |+s = f"{ {x for x in 'ab'} | set([x for x in 'ab']) }"
|
||||
15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
16 16 |
|
||||
17 17 | s = set( # comment
|
||||
11 |
|
||||
12 | s = f"{set([f(x) for x in 'ab'])}"
|
||||
13 |
|
||||
- s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
14 + s = f"{ {x for x in 'ab'} | set([x for x in 'ab']) }"
|
||||
15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
16 |
|
||||
17 | s = set( # comment
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:14:34
|
||||
|
|
@ -139,16 +133,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
11 11 |
|
||||
12 12 | s = f"{set([f(x) for x in 'ab'])}"
|
||||
13 13 |
|
||||
14 |-s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
14 |+s = f"{ set([x for x in 'ab']) | {x for x in 'ab'} }"
|
||||
15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
16 16 |
|
||||
17 17 | s = set( # comment
|
||||
11 |
|
||||
12 | s = f"{set([f(x) for x in 'ab'])}"
|
||||
13 |
|
||||
- s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
14 + s = f"{ set([x for x in 'ab']) | {x for x in 'ab'} }"
|
||||
15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
16 |
|
||||
17 | s = set( # comment
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:15:8
|
||||
|
|
@ -160,16 +153,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
17 | s = set( # comment
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | s = f"{set([f(x) for x in 'ab'])}"
|
||||
13 13 |
|
||||
14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
15 |-s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
15 |+s = f"{ {x for x in 'ab'} | set([x for x in 'ab'])}"
|
||||
16 16 |
|
||||
17 17 | s = set( # comment
|
||||
18 18 | [x for x in range(3)]
|
||||
12 | s = f"{set([f(x) for x in 'ab'])}"
|
||||
13 |
|
||||
14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
- s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
15 + s = f"{ {x for x in 'ab'} | set([x for x in 'ab'])}"
|
||||
16 |
|
||||
17 | s = set( # comment
|
||||
18 | [x for x in range(3)]
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:15:33
|
||||
|
|
@ -181,16 +173,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
17 | s = set( # comment
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | s = f"{set([f(x) for x in 'ab'])}"
|
||||
13 13 |
|
||||
14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
15 |-s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
15 |+s = f"{set([x for x in 'ab']) | {x for x in 'ab'} }"
|
||||
16 16 |
|
||||
17 17 | s = set( # comment
|
||||
18 18 | [x for x in range(3)]
|
||||
12 | s = f"{set([f(x) for x in 'ab'])}"
|
||||
13 |
|
||||
14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
- s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
15 + s = f"{set([x for x in 'ab']) | {x for x in 'ab'} }"
|
||||
16 |
|
||||
17 | s = set( # comment
|
||||
18 | [x for x in range(3)]
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:17:5
|
||||
|
|
@ -206,20 +197,19 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
21 | s = set([ # comment
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
16 16 |
|
||||
17 |-s = set( # comment
|
||||
18 |- [x for x in range(3)]
|
||||
19 |-)
|
||||
17 |+s = { # comment
|
||||
18 |+ x for x in range(3)
|
||||
19 |+}
|
||||
20 20 |
|
||||
21 21 | s = set([ # comment
|
||||
22 22 | x for x in range(3)
|
||||
14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
16 |
|
||||
- s = set( # comment
|
||||
- [x for x in range(3)]
|
||||
- )
|
||||
17 + s = { # comment
|
||||
18 + x for x in range(3)
|
||||
19 + }
|
||||
20 |
|
||||
21 | s = set([ # comment
|
||||
22 | x for x in range(3)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:21:5
|
||||
|
|
@ -235,19 +225,18 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
25 | s = set(([x for x in range(3)]))
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
18 18 | [x for x in range(3)]
|
||||
19 19 | )
|
||||
20 20 |
|
||||
21 |-s = set([ # comment
|
||||
21 |+s = { # comment
|
||||
22 22 | x for x in range(3)
|
||||
23 |-])
|
||||
23 |+}
|
||||
24 24 |
|
||||
25 25 | s = set(([x for x in range(3)]))
|
||||
26 26 |
|
||||
18 | [x for x in range(3)]
|
||||
19 | )
|
||||
20 |
|
||||
- s = set([ # comment
|
||||
21 + s = { # comment
|
||||
22 | x for x in range(3)
|
||||
- ])
|
||||
23 + }
|
||||
24 |
|
||||
25 | s = set(([x for x in range(3)]))
|
||||
26 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:25:5
|
||||
|
|
@ -260,16 +249,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
27 | s = set(((([x for x in range(3)]))))
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 | x for x in range(3)
|
||||
23 23 | ])
|
||||
24 24 |
|
||||
25 |-s = set(([x for x in range(3)]))
|
||||
25 |+s = {x for x in range(3)}
|
||||
26 26 |
|
||||
27 27 | s = set(((([x for x in range(3)]))))
|
||||
28 28 |
|
||||
22 | x for x in range(3)
|
||||
23 | ])
|
||||
24 |
|
||||
- s = set(([x for x in range(3)]))
|
||||
25 + s = {x for x in range(3)}
|
||||
26 |
|
||||
27 | s = set(((([x for x in range(3)]))))
|
||||
28 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:27:5
|
||||
|
|
@ -282,16 +270,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
29 | s = set( # outer set comment
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
24 24 |
|
||||
25 25 | s = set(([x for x in range(3)]))
|
||||
26 26 |
|
||||
27 |-s = set(((([x for x in range(3)]))))
|
||||
27 |+s = {x for x in range(3)}
|
||||
28 28 |
|
||||
29 29 | s = set( # outer set comment
|
||||
30 30 | ( # inner paren comment - not preserved
|
||||
24 |
|
||||
25 | s = set(([x for x in range(3)]))
|
||||
26 |
|
||||
- s = set(((([x for x in range(3)]))))
|
||||
27 + s = {x for x in range(3)}
|
||||
28 |
|
||||
29 | s = set( # outer set comment
|
||||
30 | ( # inner paren comment - not preserved
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:29:5
|
||||
|
|
@ -310,23 +297,22 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
36 | # Test trailing comma case
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
26 26 |
|
||||
27 27 | s = set(((([x for x in range(3)]))))
|
||||
28 28 |
|
||||
29 |-s = set( # outer set comment
|
||||
30 |-( # inner paren comment - not preserved
|
||||
31 |-((
|
||||
32 |-[ # comprehension comment
|
||||
33 |- x for x in range(3)]
|
||||
34 |- ))))
|
||||
29 |+s = { # outer set comment
|
||||
30 |+ # comprehension comment
|
||||
31 |+ x for x in range(3)}
|
||||
35 32 |
|
||||
36 33 | # Test trailing comma case
|
||||
37 34 | s = set([x for x in range(3)],)
|
||||
26 |
|
||||
27 | s = set(((([x for x in range(3)]))))
|
||||
28 |
|
||||
- s = set( # outer set comment
|
||||
- ( # inner paren comment - not preserved
|
||||
- ((
|
||||
- [ # comprehension comment
|
||||
- x for x in range(3)]
|
||||
- ))))
|
||||
29 + s = { # outer set comment
|
||||
30 + # comprehension comment
|
||||
31 + x for x in range(3)}
|
||||
32 |
|
||||
33 | # Test trailing comma case
|
||||
34 | s = set([x for x in range(3)],)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:37:5
|
||||
|
|
@ -338,16 +324,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
39 | s = t"{set([x for x in 'ab'])}"
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
34 34 | ))))
|
||||
35 35 |
|
||||
36 36 | # Test trailing comma case
|
||||
37 |-s = set([x for x in range(3)],)
|
||||
37 |+s = {x for x in range(3)}
|
||||
38 38 |
|
||||
39 39 | s = t"{set([x for x in 'ab'])}"
|
||||
40 40 | s = t'{set([x for x in "ab"])}'
|
||||
34 | ))))
|
||||
35 |
|
||||
36 | # Test trailing comma case
|
||||
- s = set([x for x in range(3)],)
|
||||
37 + s = {x for x in range(3)}
|
||||
38 |
|
||||
39 | s = t"{set([x for x in 'ab'])}"
|
||||
40 | s = t'{set([x for x in "ab"])}'
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:39:8
|
||||
|
|
@ -359,16 +344,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
40 | s = t'{set([x for x in "ab"])}'
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
36 36 | # Test trailing comma case
|
||||
37 37 | s = set([x for x in range(3)],)
|
||||
38 38 |
|
||||
39 |-s = t"{set([x for x in 'ab'])}"
|
||||
39 |+s = t"{ {x for x in 'ab'} }"
|
||||
40 40 | s = t'{set([x for x in "ab"])}'
|
||||
41 41 |
|
||||
42 42 | def f(x):
|
||||
36 | # Test trailing comma case
|
||||
37 | s = set([x for x in range(3)],)
|
||||
38 |
|
||||
- s = t"{set([x for x in 'ab'])}"
|
||||
39 + s = t"{ {x for x in 'ab'} }"
|
||||
40 | s = t'{set([x for x in "ab"])}'
|
||||
41 |
|
||||
42 | def f(x):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:40:8
|
||||
|
|
@ -380,16 +364,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
42 | def f(x):
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
37 37 | s = set([x for x in range(3)],)
|
||||
38 38 |
|
||||
39 39 | s = t"{set([x for x in 'ab'])}"
|
||||
40 |-s = t'{set([x for x in "ab"])}'
|
||||
40 |+s = t'{ {x for x in "ab"} }'
|
||||
41 41 |
|
||||
42 42 | def f(x):
|
||||
43 43 | return x
|
||||
37 | s = set([x for x in range(3)],)
|
||||
38 |
|
||||
39 | s = t"{set([x for x in 'ab'])}"
|
||||
- s = t'{set([x for x in "ab"])}'
|
||||
40 + s = t'{ {x for x in "ab"} }'
|
||||
41 |
|
||||
42 | def f(x):
|
||||
43 | return x
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:45:8
|
||||
|
|
@ -402,16 +385,15 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
47 | s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
42 42 | def f(x):
|
||||
43 43 | return x
|
||||
44 44 |
|
||||
45 |-s = t"{set([f(x) for x in 'ab'])}"
|
||||
45 |+s = t"{ {f(x) for x in 'ab'} }"
|
||||
46 46 |
|
||||
47 47 | s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
48 48 | s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
42 | def f(x):
|
||||
43 | return x
|
||||
44 |
|
||||
- s = t"{set([f(x) for x in 'ab'])}"
|
||||
45 + s = t"{ {f(x) for x in 'ab'} }"
|
||||
46 |
|
||||
47 | s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
48 | s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:47:9
|
||||
|
|
@ -423,15 +405,14 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
48 | s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
44 44 |
|
||||
45 45 | s = t"{set([f(x) for x in 'ab'])}"
|
||||
46 46 |
|
||||
47 |-s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
47 |+s = t"{ {x for x in 'ab'} | set([x for x in 'ab']) }"
|
||||
48 48 | s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
49 49 |
|
||||
44 |
|
||||
45 | s = t"{set([f(x) for x in 'ab'])}"
|
||||
46 |
|
||||
- s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
47 + s = t"{ {x for x in 'ab'} | set([x for x in 'ab']) }"
|
||||
48 | s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
49 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:47:34
|
||||
|
|
@ -443,15 +424,14 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
48 | s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
44 44 |
|
||||
45 45 | s = t"{set([f(x) for x in 'ab'])}"
|
||||
46 46 |
|
||||
47 |-s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
47 |+s = t"{ set([x for x in 'ab']) | {x for x in 'ab'} }"
|
||||
48 48 | s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
49 49 |
|
||||
44 |
|
||||
45 | s = t"{set([f(x) for x in 'ab'])}"
|
||||
46 |
|
||||
- s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
47 + s = t"{ set([x for x in 'ab']) | {x for x in 'ab'} }"
|
||||
48 | s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
49 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:48:8
|
||||
|
|
@ -461,14 +441,13 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
45 45 | s = t"{set([f(x) for x in 'ab'])}"
|
||||
46 46 |
|
||||
47 47 | s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
48 |-s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
48 |+s = t"{ {x for x in 'ab'} | set([x for x in 'ab'])}"
|
||||
49 49 |
|
||||
45 | s = t"{set([f(x) for x in 'ab'])}"
|
||||
46 |
|
||||
47 | s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
- s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
48 + s = t"{ {x for x in 'ab'} | set([x for x in 'ab'])}"
|
||||
49 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
||||
--> C403.py:48:33
|
||||
|
|
@ -478,11 +457,10 @@ C403 [*] Unnecessary list comprehension (rewrite as a set comprehension)
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Rewrite as a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
45 45 | s = t"{set([f(x) for x in 'ab'])}"
|
||||
46 46 |
|
||||
47 47 | s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
48 |-s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
48 |+s = t"{set([x for x in 'ab']) | {x for x in 'ab'} }"
|
||||
49 49 |
|
||||
45 | s = t"{set([f(x) for x in 'ab'])}"
|
||||
46 |
|
||||
47 | s = t"{ set([x for x in 'ab']) | set([x for x in 'ab']) }"
|
||||
- s = t"{set([x for x in 'ab']) | set([x for x in 'ab'])}"
|
||||
48 + s = t"{set([x for x in 'ab']) | {x for x in 'ab'} }"
|
||||
49 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -9,13 +9,12 @@ C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
|||
2 | dict([(i, i) for i in range(3)], z=4)
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-dict([(i, i) for i in range(3)])
|
||||
1 |+{i: i for i in range(3)}
|
||||
2 2 | dict([(i, i) for i in range(3)], z=4)
|
||||
3 3 |
|
||||
4 4 | def f(x):
|
||||
- dict([(i, i) for i in range(3)])
|
||||
1 + {i: i for i in range(3)}
|
||||
2 | dict([(i, i) for i in range(3)], z=4)
|
||||
3 |
|
||||
4 | def f(x):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
||||
--> C404.py:7:4
|
||||
|
|
@ -28,16 +27,15 @@ C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
|||
9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | def f(x):
|
||||
5 5 | return x
|
||||
6 6 |
|
||||
7 |-f'{dict([(s,s) for s in "ab"])}'
|
||||
7 |+f'{ {s: s for s in "ab"} }'
|
||||
8 8 | f"{dict([(s,s) for s in 'ab'])}"
|
||||
9 9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
10 10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
4 | def f(x):
|
||||
5 | return x
|
||||
6 |
|
||||
- f'{dict([(s,s) for s in "ab"])}'
|
||||
7 + f'{ {s: s for s in "ab"} }'
|
||||
8 | f"{dict([(s,s) for s in 'ab'])}"
|
||||
9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
||||
--> C404.py:8:4
|
||||
|
|
@ -49,16 +47,15 @@ C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
|||
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | return x
|
||||
6 6 |
|
||||
7 7 | f'{dict([(s,s) for s in "ab"])}'
|
||||
8 |-f"{dict([(s,s) for s in 'ab'])}"
|
||||
8 |+f"{ {s: s for s in 'ab'} }"
|
||||
9 9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
10 10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 11 |
|
||||
5 | return x
|
||||
6 |
|
||||
7 | f'{dict([(s,s) for s in "ab"])}'
|
||||
- f"{dict([(s,s) for s in 'ab'])}"
|
||||
8 + f"{ {s: s for s in 'ab'} }"
|
||||
9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
||||
--> C404.py:9:4
|
||||
|
|
@ -70,16 +67,15 @@ C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
|||
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 |
|
||||
7 7 | f'{dict([(s,s) for s in "ab"])}'
|
||||
8 8 | f"{dict([(s,s) for s in 'ab'])}"
|
||||
9 |-f"{dict([(s, s) for s in 'ab'])}"
|
||||
9 |+f"{ {s: s for s in 'ab'} }"
|
||||
10 10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 11 |
|
||||
12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
6 |
|
||||
7 | f'{dict([(s,s) for s in "ab"])}'
|
||||
8 | f"{dict([(s,s) for s in 'ab'])}"
|
||||
- f"{dict([(s, s) for s in 'ab'])}"
|
||||
9 + f"{ {s: s for s in 'ab'} }"
|
||||
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 |
|
||||
12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
||||
--> C404.py:10:4
|
||||
|
|
@ -92,16 +88,15 @@ C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
|||
12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | f'{dict([(s,s) for s in "ab"])}'
|
||||
8 8 | f"{dict([(s,s) for s in 'ab'])}"
|
||||
9 9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
10 |-f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
10 |+f"{ {s: f(s) for s in 'ab'} }"
|
||||
11 11 |
|
||||
12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
7 | f'{dict([(s,s) for s in "ab"])}'
|
||||
8 | f"{dict([(s,s) for s in 'ab'])}"
|
||||
9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
- f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
10 + f"{ {s: f(s) for s in 'ab'} }"
|
||||
11 |
|
||||
12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
||||
--> C404.py:12:4
|
||||
|
|
@ -113,16 +108,15 @@ C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
|||
13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
10 10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 11 |
|
||||
12 |-f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
12 |+f'{ {s: s for s in "ab"} | dict([(s,s) for s in "ab"])}'
|
||||
13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
14 14 |
|
||||
15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 |
|
||||
- f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
12 + f'{ {s: s for s in "ab"} | dict([(s,s) for s in "ab"])}'
|
||||
13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
14 |
|
||||
15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
||||
--> C404.py:12:34
|
||||
|
|
@ -134,16 +128,15 @@ C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
|||
13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
10 10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 11 |
|
||||
12 |-f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
12 |+f'{dict([(s,s) for s in "ab"]) | {s: s for s in "ab"} }'
|
||||
13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
14 14 |
|
||||
15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
9 | f"{dict([(s, s) for s in 'ab'])}"
|
||||
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 |
|
||||
- f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
12 + f'{dict([(s,s) for s in "ab"]) | {s: s for s in "ab"} }'
|
||||
13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
14 |
|
||||
15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
||||
--> C404.py:13:5
|
||||
|
|
@ -155,16 +148,15 @@ C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
|||
15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
10 10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 11 |
|
||||
12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
13 |-f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
13 |+f'{ {s: s for s in "ab"} | dict([(s,s) for s in "ab"]) }'
|
||||
14 14 |
|
||||
15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]]))
|
||||
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 |
|
||||
12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
- f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
13 + f'{ {s: s for s in "ab"} | dict([(s,s) for s in "ab"]) }'
|
||||
14 |
|
||||
15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]]))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
||||
--> C404.py:13:35
|
||||
|
|
@ -176,16 +168,15 @@ C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
|||
15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
10 10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 11 |
|
||||
12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
13 |-f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
13 |+f'{ dict([(s,s) for s in "ab"]) | {s: s for s in "ab"} }'
|
||||
14 14 |
|
||||
15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]]))
|
||||
10 | f"{dict([(s,f(s)) for s in 'ab'])}"
|
||||
11 |
|
||||
12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}'
|
||||
- f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
13 + f'{ dict([(s,s) for s in "ab"]) | {s: s for s in "ab"} }'
|
||||
14 |
|
||||
15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]]))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
||||
--> C404.py:16:14
|
||||
|
|
@ -195,10 +186,9 @@ C404 [*] Unnecessary list comprehension (rewrite as a dict comprehension)
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Rewrite as a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
14 14 |
|
||||
15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
16 |-saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]]))
|
||||
16 |+saved.append({k: v for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]})
|
||||
13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }'
|
||||
14 |
|
||||
15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087
|
||||
- saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]]))
|
||||
16 + saved.append({k: v for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]})
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
3 | set([])
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-set([1, 2])
|
||||
1 |+{1, 2}
|
||||
2 2 | set((1, 2))
|
||||
3 3 | set([])
|
||||
4 4 | set(())
|
||||
- set([1, 2])
|
||||
1 + {1, 2}
|
||||
2 | set((1, 2))
|
||||
3 | set([])
|
||||
4 | set(())
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary tuple literal (rewrite as a set literal)
|
||||
--> C405.py:2:1
|
||||
|
|
@ -28,14 +27,13 @@ C405 [*] Unnecessary tuple literal (rewrite as a set literal)
|
|||
4 | set(())
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | set([1, 2])
|
||||
2 |-set((1, 2))
|
||||
2 |+{1, 2}
|
||||
3 3 | set([])
|
||||
4 4 | set(())
|
||||
5 5 | set()
|
||||
1 | set([1, 2])
|
||||
- set((1, 2))
|
||||
2 + {1, 2}
|
||||
3 | set([])
|
||||
4 | set(())
|
||||
5 | set()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:3:1
|
||||
|
|
@ -48,15 +46,14 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
5 | set()
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | set([1, 2])
|
||||
2 2 | set((1, 2))
|
||||
3 |-set([])
|
||||
3 |+set()
|
||||
4 4 | set(())
|
||||
5 5 | set()
|
||||
6 6 | set((1,))
|
||||
1 | set([1, 2])
|
||||
2 | set((1, 2))
|
||||
- set([])
|
||||
3 + set()
|
||||
4 | set(())
|
||||
5 | set()
|
||||
6 | set((1,))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary tuple literal (rewrite as a set literal)
|
||||
--> C405.py:4:1
|
||||
|
|
@ -69,17 +66,16 @@ C405 [*] Unnecessary tuple literal (rewrite as a set literal)
|
|||
6 | set((1,))
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | set([1, 2])
|
||||
2 2 | set((1, 2))
|
||||
3 3 | set([])
|
||||
4 |-set(())
|
||||
5 4 | set()
|
||||
5 |+set()
|
||||
6 6 | set((1,))
|
||||
7 7 | set((
|
||||
8 8 | 1,
|
||||
1 | set([1, 2])
|
||||
2 | set((1, 2))
|
||||
3 | set([])
|
||||
- set(())
|
||||
4 | set()
|
||||
5 + set()
|
||||
6 | set((1,))
|
||||
7 | set((
|
||||
8 | 1,
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary tuple literal (rewrite as a set literal)
|
||||
--> C405.py:6:1
|
||||
|
|
@ -92,16 +88,15 @@ C405 [*] Unnecessary tuple literal (rewrite as a set literal)
|
|||
8 | 1,
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | set([])
|
||||
4 4 | set(())
|
||||
5 5 | set()
|
||||
6 |-set((1,))
|
||||
6 |+{1}
|
||||
7 7 | set((
|
||||
8 8 | 1,
|
||||
9 9 | ))
|
||||
3 | set([])
|
||||
4 | set(())
|
||||
5 | set()
|
||||
- set((1,))
|
||||
6 + {1}
|
||||
7 | set((
|
||||
8 | 1,
|
||||
9 | ))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary tuple literal (rewrite as a set literal)
|
||||
--> C405.py:7:1
|
||||
|
|
@ -116,19 +111,18 @@ C405 [*] Unnecessary tuple literal (rewrite as a set literal)
|
|||
11 | 1,
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | set(())
|
||||
5 5 | set()
|
||||
6 6 | set((1,))
|
||||
7 |-set((
|
||||
7 |+{
|
||||
8 8 | 1,
|
||||
9 |-))
|
||||
9 |+}
|
||||
10 10 | set([
|
||||
11 11 | 1,
|
||||
12 12 | ])
|
||||
4 | set(())
|
||||
5 | set()
|
||||
6 | set((1,))
|
||||
- set((
|
||||
7 + {
|
||||
8 | 1,
|
||||
- ))
|
||||
9 + }
|
||||
10 | set([
|
||||
11 | 1,
|
||||
12 | ])
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:10:1
|
||||
|
|
@ -143,19 +137,18 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
14 | (1,)
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | set((
|
||||
8 8 | 1,
|
||||
9 9 | ))
|
||||
10 |-set([
|
||||
10 |+{
|
||||
11 11 | 1,
|
||||
12 |-])
|
||||
12 |+}
|
||||
13 13 | set(
|
||||
14 14 | (1,)
|
||||
15 15 | )
|
||||
7 | set((
|
||||
8 | 1,
|
||||
9 | ))
|
||||
- set([
|
||||
10 + {
|
||||
11 | 1,
|
||||
- ])
|
||||
12 + }
|
||||
13 | set(
|
||||
14 | (1,)
|
||||
15 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary tuple literal (rewrite as a set literal)
|
||||
--> C405.py:13:1
|
||||
|
|
@ -170,18 +163,17 @@ C405 [*] Unnecessary tuple literal (rewrite as a set literal)
|
|||
17 | [1,]
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
10 10 | set([
|
||||
11 11 | 1,
|
||||
12 12 | ])
|
||||
13 |-set(
|
||||
14 |- (1,)
|
||||
15 |-)
|
||||
13 |+{1}
|
||||
16 14 | set(
|
||||
17 15 | [1,]
|
||||
18 16 | )
|
||||
10 | set([
|
||||
11 | 1,
|
||||
12 | ])
|
||||
- set(
|
||||
- (1,)
|
||||
- )
|
||||
13 + {1}
|
||||
14 | set(
|
||||
15 | [1,]
|
||||
16 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:16:1
|
||||
|
|
@ -196,18 +188,17 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
20 | f"{set(['a', 'b'])}"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 | set(
|
||||
14 14 | (1,)
|
||||
15 15 | )
|
||||
16 |-set(
|
||||
17 |- [1,]
|
||||
18 |-)
|
||||
16 |+{1,}
|
||||
19 17 | f"{set([1,2,3])}"
|
||||
20 18 | f"{set(['a', 'b'])}"
|
||||
21 19 | f'{set(["a", "b"])}'
|
||||
13 | set(
|
||||
14 | (1,)
|
||||
15 | )
|
||||
- set(
|
||||
- [1,]
|
||||
- )
|
||||
16 + {1,}
|
||||
17 | f"{set([1,2,3])}"
|
||||
18 | f"{set(['a', 'b'])}"
|
||||
19 | f'{set(["a", "b"])}'
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:19:4
|
||||
|
|
@ -220,16 +211,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
21 | f'{set(["a", "b"])}'
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
16 16 | set(
|
||||
17 17 | [1,]
|
||||
18 18 | )
|
||||
19 |-f"{set([1,2,3])}"
|
||||
19 |+f"{ {1,2,3} }"
|
||||
20 20 | f"{set(['a', 'b'])}"
|
||||
21 21 | f'{set(["a", "b"])}'
|
||||
22 22 |
|
||||
16 | set(
|
||||
17 | [1,]
|
||||
18 | )
|
||||
- f"{set([1,2,3])}"
|
||||
19 + f"{ {1,2,3} }"
|
||||
20 | f"{set(['a', 'b'])}"
|
||||
21 | f'{set(["a", "b"])}'
|
||||
22 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:20:4
|
||||
|
|
@ -241,16 +231,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
21 | f'{set(["a", "b"])}'
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 | [1,]
|
||||
18 18 | )
|
||||
19 19 | f"{set([1,2,3])}"
|
||||
20 |-f"{set(['a', 'b'])}"
|
||||
20 |+f"{ {'a', 'b'} }"
|
||||
21 21 | f'{set(["a", "b"])}'
|
||||
22 22 |
|
||||
23 23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
17 | [1,]
|
||||
18 | )
|
||||
19 | f"{set([1,2,3])}"
|
||||
- f"{set(['a', 'b'])}"
|
||||
20 + f"{ {'a', 'b'} }"
|
||||
21 | f'{set(["a", "b"])}'
|
||||
22 |
|
||||
23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:21:4
|
||||
|
|
@ -263,16 +252,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
18 18 | )
|
||||
19 19 | f"{set([1,2,3])}"
|
||||
20 20 | f"{set(['a', 'b'])}"
|
||||
21 |-f'{set(["a", "b"])}'
|
||||
21 |+f'{ {"a", "b"} }'
|
||||
22 22 |
|
||||
23 23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
18 | )
|
||||
19 | f"{set([1,2,3])}"
|
||||
20 | f"{set(['a', 'b'])}"
|
||||
- f'{set(["a", "b"])}'
|
||||
21 + f'{ {"a", "b"} }'
|
||||
22 |
|
||||
23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:23:4
|
||||
|
|
@ -285,16 +273,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
20 20 | f"{set(['a', 'b'])}"
|
||||
21 21 | f'{set(["a", "b"])}'
|
||||
22 22 |
|
||||
23 |-f"{set(['a', 'b']) - set(['a'])}"
|
||||
23 |+f"{ {'a', 'b'} - set(['a'])}"
|
||||
24 24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
20 | f"{set(['a', 'b'])}"
|
||||
21 | f'{set(["a", "b"])}'
|
||||
22 |
|
||||
- f"{set(['a', 'b']) - set(['a'])}"
|
||||
23 + f"{ {'a', 'b'} - set(['a'])}"
|
||||
24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:23:22
|
||||
|
|
@ -307,16 +294,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
20 20 | f"{set(['a', 'b'])}"
|
||||
21 21 | f'{set(["a", "b"])}'
|
||||
22 22 |
|
||||
23 |-f"{set(['a', 'b']) - set(['a'])}"
|
||||
23 |+f"{set(['a', 'b']) - {'a'} }"
|
||||
24 24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
20 | f"{set(['a', 'b'])}"
|
||||
21 | f'{set(["a", "b"])}'
|
||||
22 |
|
||||
- f"{set(['a', 'b']) - set(['a'])}"
|
||||
23 + f"{set(['a', 'b']) - {'a'} }"
|
||||
24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:24:5
|
||||
|
|
@ -328,16 +314,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
21 21 | f'{set(["a", "b"])}'
|
||||
22 22 |
|
||||
23 23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 |-f"{ set(['a', 'b']) - set(['a']) }"
|
||||
24 |+f"{ {'a', 'b'} - set(['a']) }"
|
||||
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 27 |
|
||||
21 | f'{set(["a", "b"])}'
|
||||
22 |
|
||||
23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
- f"{ set(['a', 'b']) - set(['a']) }"
|
||||
24 + f"{ {'a', 'b'} - set(['a']) }"
|
||||
25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:24:23
|
||||
|
|
@ -349,16 +334,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
21 21 | f'{set(["a", "b"])}'
|
||||
22 22 |
|
||||
23 23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 |-f"{ set(['a', 'b']) - set(['a']) }"
|
||||
24 |+f"{ set(['a', 'b']) - {'a'} }"
|
||||
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 27 |
|
||||
21 | f'{set(["a", "b"])}'
|
||||
22 |
|
||||
23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
- f"{ set(['a', 'b']) - set(['a']) }"
|
||||
24 + f"{ set(['a', 'b']) - {'a'} }"
|
||||
25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:25:6
|
||||
|
|
@ -370,16 +354,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 |
|
||||
23 23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
25 |-f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
25 |+f"a { {'a', 'b'} - set(['a'])} b"
|
||||
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 27 |
|
||||
28 28 | t"{set([1,2,3])}"
|
||||
22 |
|
||||
23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
- f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
25 + f"a { {'a', 'b'} - set(['a'])} b"
|
||||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 |
|
||||
28 | t"{set([1,2,3])}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:25:24
|
||||
|
|
@ -391,16 +374,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 |
|
||||
23 23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
25 |-f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
25 |+f"a {set(['a', 'b']) - {'a'} } b"
|
||||
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 27 |
|
||||
28 28 | t"{set([1,2,3])}"
|
||||
22 |
|
||||
23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
- f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
25 + f"a {set(['a', 'b']) - {'a'} } b"
|
||||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 |
|
||||
28 | t"{set([1,2,3])}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:26:7
|
||||
|
|
@ -413,16 +395,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
28 | t"{set([1,2,3])}"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
23 23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 |-f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
26 |+f"a { {'a', 'b'} - set(['a']) } b"
|
||||
27 27 |
|
||||
28 28 | t"{set([1,2,3])}"
|
||||
29 29 | t"{set(['a', 'b'])}"
|
||||
23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
- f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
26 + f"a { {'a', 'b'} - set(['a']) } b"
|
||||
27 |
|
||||
28 | t"{set([1,2,3])}"
|
||||
29 | t"{set(['a', 'b'])}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:26:25
|
||||
|
|
@ -435,16 +416,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
28 | t"{set([1,2,3])}"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
23 23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 |-f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
26 |+f"a { set(['a', 'b']) - {'a'} } b"
|
||||
27 27 |
|
||||
28 28 | t"{set([1,2,3])}"
|
||||
29 29 | t"{set(['a', 'b'])}"
|
||||
23 | f"{set(['a', 'b']) - set(['a'])}"
|
||||
24 | f"{ set(['a', 'b']) - set(['a']) }"
|
||||
25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
- f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
26 + f"a { set(['a', 'b']) - {'a'} } b"
|
||||
27 |
|
||||
28 | t"{set([1,2,3])}"
|
||||
29 | t"{set(['a', 'b'])}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:28:4
|
||||
|
|
@ -457,16 +437,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
30 | t'{set(["a", "b"])}'
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
25 25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 27 |
|
||||
28 |-t"{set([1,2,3])}"
|
||||
28 |+t"{ {1,2,3} }"
|
||||
29 29 | t"{set(['a', 'b'])}"
|
||||
30 30 | t'{set(["a", "b"])}'
|
||||
31 31 |
|
||||
25 | f"a {set(['a', 'b']) - set(['a'])} b"
|
||||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 |
|
||||
- t"{set([1,2,3])}"
|
||||
28 + t"{ {1,2,3} }"
|
||||
29 | t"{set(['a', 'b'])}"
|
||||
30 | t'{set(["a", "b"])}'
|
||||
31 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:29:4
|
||||
|
|
@ -477,16 +456,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
30 | t'{set(["a", "b"])}'
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
26 26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 27 |
|
||||
28 28 | t"{set([1,2,3])}"
|
||||
29 |-t"{set(['a', 'b'])}"
|
||||
29 |+t"{ {'a', 'b'} }"
|
||||
30 30 | t'{set(["a", "b"])}'
|
||||
31 31 |
|
||||
32 32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
26 | f"a { set(['a', 'b']) - set(['a']) } b"
|
||||
27 |
|
||||
28 | t"{set([1,2,3])}"
|
||||
- t"{set(['a', 'b'])}"
|
||||
29 + t"{ {'a', 'b'} }"
|
||||
30 | t'{set(["a", "b"])}'
|
||||
31 |
|
||||
32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:30:4
|
||||
|
|
@ -499,16 +477,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
27 27 |
|
||||
28 28 | t"{set([1,2,3])}"
|
||||
29 29 | t"{set(['a', 'b'])}"
|
||||
30 |-t'{set(["a", "b"])}'
|
||||
30 |+t'{ {"a", "b"} }'
|
||||
31 31 |
|
||||
32 32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
27 |
|
||||
28 | t"{set([1,2,3])}"
|
||||
29 | t"{set(['a', 'b'])}"
|
||||
- t'{set(["a", "b"])}'
|
||||
30 + t'{ {"a", "b"} }'
|
||||
31 |
|
||||
32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:32:4
|
||||
|
|
@ -521,16 +498,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 | t"{set(['a', 'b'])}"
|
||||
30 30 | t'{set(["a", "b"])}'
|
||||
31 31 |
|
||||
32 |-t"{set(['a', 'b']) - set(['a'])}"
|
||||
32 |+t"{ {'a', 'b'} - set(['a'])}"
|
||||
33 33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
34 34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
35 35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
29 | t"{set(['a', 'b'])}"
|
||||
30 | t'{set(["a", "b"])}'
|
||||
31 |
|
||||
- t"{set(['a', 'b']) - set(['a'])}"
|
||||
32 + t"{ {'a', 'b'} - set(['a'])}"
|
||||
33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:32:22
|
||||
|
|
@ -543,16 +519,15 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 | t"{set(['a', 'b'])}"
|
||||
30 30 | t'{set(["a", "b"])}'
|
||||
31 31 |
|
||||
32 |-t"{set(['a', 'b']) - set(['a'])}"
|
||||
32 |+t"{set(['a', 'b']) - {'a'} }"
|
||||
33 33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
34 34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
35 35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
29 | t"{set(['a', 'b'])}"
|
||||
30 | t'{set(["a", "b"])}'
|
||||
31 |
|
||||
- t"{set(['a', 'b']) - set(['a'])}"
|
||||
32 + t"{set(['a', 'b']) - {'a'} }"
|
||||
33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:33:5
|
||||
|
|
@ -564,15 +539,14 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
30 30 | t'{set(["a", "b"])}'
|
||||
31 31 |
|
||||
32 32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 |-t"{ set(['a', 'b']) - set(['a']) }"
|
||||
33 |+t"{ {'a', 'b'} - set(['a']) }"
|
||||
34 34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
35 35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
30 | t'{set(["a", "b"])}'
|
||||
31 |
|
||||
32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
- t"{ set(['a', 'b']) - set(['a']) }"
|
||||
33 + t"{ {'a', 'b'} - set(['a']) }"
|
||||
34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:33:23
|
||||
|
|
@ -584,15 +558,14 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
30 30 | t'{set(["a", "b"])}'
|
||||
31 31 |
|
||||
32 32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 |-t"{ set(['a', 'b']) - set(['a']) }"
|
||||
33 |+t"{ set(['a', 'b']) - {'a'} }"
|
||||
34 34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
35 35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
30 | t'{set(["a", "b"])}'
|
||||
31 |
|
||||
32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
- t"{ set(['a', 'b']) - set(['a']) }"
|
||||
33 + t"{ set(['a', 'b']) - {'a'} }"
|
||||
34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:34:6
|
||||
|
|
@ -604,14 +577,13 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
31 31 |
|
||||
32 32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
34 |-t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
34 |+t"a { {'a', 'b'} - set(['a'])} b"
|
||||
35 35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
31 |
|
||||
32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
- t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
34 + t"a { {'a', 'b'} - set(['a'])} b"
|
||||
35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:34:24
|
||||
|
|
@ -623,14 +595,13 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
31 31 |
|
||||
32 32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
34 |-t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
34 |+t"a {set(['a', 'b']) - {'a'} } b"
|
||||
35 35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
31 |
|
||||
32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
- t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
34 + t"a {set(['a', 'b']) - {'a'} } b"
|
||||
35 | t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:35:7
|
||||
|
|
@ -641,13 +612,12 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
32 32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
34 34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
35 |-t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
35 |+t"a { {'a', 'b'} - set(['a']) } b"
|
||||
32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
- t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
35 + t"a { {'a', 'b'} - set(['a']) } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C405 [*] Unnecessary list literal (rewrite as a set literal)
|
||||
--> C405.py:35:25
|
||||
|
|
@ -658,10 +628,9 @@ C405 [*] Unnecessary list literal (rewrite as a set literal)
|
|||
| ^^^^^^^^^^
|
||||
|
|
||||
help: Rewrite as a set literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
32 32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
34 34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
35 |-t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
35 |+t"a { set(['a', 'b']) - {'a'} } b"
|
||||
32 | t"{set(['a', 'b']) - set(['a'])}"
|
||||
33 | t"{ set(['a', 'b']) - set(['a']) }"
|
||||
34 | t"a {set(['a', 'b']) - set(['a'])} b"
|
||||
- t"a { set(['a', 'b']) - set(['a']) } b"
|
||||
35 + t"a { set(['a', 'b']) - {'a'} } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C406 [*] Unnecessary list literal (rewrite as a dict literal)
|
|||
3 | d3 = dict([])
|
||||
|
|
||||
help: Rewrite as a dict literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-d1 = dict([(1, 2)])
|
||||
1 |+d1 = {1: 2}
|
||||
2 2 | d2 = dict(((1, 2),))
|
||||
3 3 | d3 = dict([])
|
||||
4 4 | d4 = dict(())
|
||||
- d1 = dict([(1, 2)])
|
||||
1 + d1 = {1: 2}
|
||||
2 | d2 = dict(((1, 2),))
|
||||
3 | d3 = dict([])
|
||||
4 | d4 = dict(())
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C406 [*] Unnecessary tuple literal (rewrite as a dict literal)
|
||||
--> C406.py:2:6
|
||||
|
|
@ -28,14 +27,13 @@ C406 [*] Unnecessary tuple literal (rewrite as a dict literal)
|
|||
4 | d4 = dict(())
|
||||
|
|
||||
help: Rewrite as a dict literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | d1 = dict([(1, 2)])
|
||||
2 |-d2 = dict(((1, 2),))
|
||||
2 |+d2 = {1: 2,}
|
||||
3 3 | d3 = dict([])
|
||||
4 4 | d4 = dict(())
|
||||
5 5 | d5 = dict()
|
||||
1 | d1 = dict([(1, 2)])
|
||||
- d2 = dict(((1, 2),))
|
||||
2 + d2 = {1: 2,}
|
||||
3 | d3 = dict([])
|
||||
4 | d4 = dict(())
|
||||
5 | d5 = dict()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C406 [*] Unnecessary list literal (rewrite as a dict literal)
|
||||
--> C406.py:3:6
|
||||
|
|
@ -48,14 +46,13 @@ C406 [*] Unnecessary list literal (rewrite as a dict literal)
|
|||
5 | d5 = dict()
|
||||
|
|
||||
help: Rewrite as a dict literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | d1 = dict([(1, 2)])
|
||||
2 2 | d2 = dict(((1, 2),))
|
||||
3 |-d3 = dict([])
|
||||
3 |+d3 = {}
|
||||
4 4 | d4 = dict(())
|
||||
5 5 | d5 = dict()
|
||||
1 | d1 = dict([(1, 2)])
|
||||
2 | d2 = dict(((1, 2),))
|
||||
- d3 = dict([])
|
||||
3 + d3 = {}
|
||||
4 | d4 = dict(())
|
||||
5 | d5 = dict()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C406 [*] Unnecessary tuple literal (rewrite as a dict literal)
|
||||
--> C406.py:4:6
|
||||
|
|
@ -67,11 +64,10 @@ C406 [*] Unnecessary tuple literal (rewrite as a dict literal)
|
|||
5 | d5 = dict()
|
||||
|
|
||||
help: Rewrite as a dict literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | d1 = dict([(1, 2)])
|
||||
2 2 | d2 = dict(((1, 2),))
|
||||
3 3 | d3 = dict([])
|
||||
4 |-d4 = dict(())
|
||||
4 |+d4 = {}
|
||||
5 5 | d5 = dict()
|
||||
1 | d1 = dict([(1, 2)])
|
||||
2 | d2 = dict(((1, 2),))
|
||||
3 | d3 = dict([])
|
||||
- d4 = dict(())
|
||||
4 + d4 = {}
|
||||
5 | d5 = dict()
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C408 [*] Unnecessary `tuple()` call (rewrite as a literal)
|
|||
3 | d1 = dict()
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-t = tuple()
|
||||
1 |+t = ()
|
||||
2 2 | l = list()
|
||||
3 3 | d1 = dict()
|
||||
4 4 | d2 = dict(a=1)
|
||||
- t = tuple()
|
||||
1 + t = ()
|
||||
2 | l = list()
|
||||
3 | d1 = dict()
|
||||
4 | d2 = dict(a=1)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `list()` call (rewrite as a literal)
|
||||
--> C408.py:2:5
|
||||
|
|
@ -28,14 +27,13 @@ C408 [*] Unnecessary `list()` call (rewrite as a literal)
|
|||
4 | d2 = dict(a=1)
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t = tuple()
|
||||
2 |-l = list()
|
||||
2 |+l = []
|
||||
3 3 | d1 = dict()
|
||||
4 4 | d2 = dict(a=1)
|
||||
5 5 | d3 = dict(**d2)
|
||||
1 | t = tuple()
|
||||
- l = list()
|
||||
2 + l = []
|
||||
3 | d1 = dict()
|
||||
4 | d2 = dict(a=1)
|
||||
5 | d3 = dict(**d2)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:3:6
|
||||
|
|
@ -48,15 +46,14 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
5 | d3 = dict(**d2)
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t = tuple()
|
||||
2 2 | l = list()
|
||||
3 |-d1 = dict()
|
||||
3 |+d1 = {}
|
||||
4 4 | d2 = dict(a=1)
|
||||
5 5 | d3 = dict(**d2)
|
||||
6 6 |
|
||||
1 | t = tuple()
|
||||
2 | l = list()
|
||||
- d1 = dict()
|
||||
3 + d1 = {}
|
||||
4 | d2 = dict(a=1)
|
||||
5 | d3 = dict(**d2)
|
||||
6 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:4:6
|
||||
|
|
@ -68,16 +65,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
5 | d3 = dict(**d2)
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t = tuple()
|
||||
2 2 | l = list()
|
||||
3 3 | d1 = dict()
|
||||
4 |-d2 = dict(a=1)
|
||||
4 |+d2 = {"a": 1}
|
||||
5 5 | d3 = dict(**d2)
|
||||
6 6 |
|
||||
7 7 |
|
||||
1 | t = tuple()
|
||||
2 | l = list()
|
||||
3 | d1 = dict()
|
||||
- d2 = dict(a=1)
|
||||
4 + d2 = {"a": 1}
|
||||
5 | d3 = dict(**d2)
|
||||
6 |
|
||||
7 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:14:4
|
||||
|
|
@ -90,16 +86,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
16 | f"{dict()}"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
11 11 |
|
||||
12 12 | a = list()
|
||||
13 13 |
|
||||
14 |-f"{dict(x='y')}"
|
||||
14 |+f"{ {'x': 'y'} }"
|
||||
15 15 | f'{dict(x="y")}'
|
||||
16 16 | f"{dict()}"
|
||||
17 17 | f"a {dict()} b"
|
||||
11 |
|
||||
12 | a = list()
|
||||
13 |
|
||||
- f"{dict(x='y')}"
|
||||
14 + f"{ {'x': 'y'} }"
|
||||
15 | f'{dict(x="y")}'
|
||||
16 | f"{dict()}"
|
||||
17 | f"a {dict()} b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:15:4
|
||||
|
|
@ -111,16 +106,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
17 | f"a {dict()} b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | a = list()
|
||||
13 13 |
|
||||
14 14 | f"{dict(x='y')}"
|
||||
15 |-f'{dict(x="y")}'
|
||||
15 |+f'{ {"x": "y"} }'
|
||||
16 16 | f"{dict()}"
|
||||
17 17 | f"a {dict()} b"
|
||||
18 18 |
|
||||
12 | a = list()
|
||||
13 |
|
||||
14 | f"{dict(x='y')}"
|
||||
- f'{dict(x="y")}'
|
||||
15 + f'{ {"x": "y"} }'
|
||||
16 | f"{dict()}"
|
||||
17 | f"a {dict()} b"
|
||||
18 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:16:4
|
||||
|
|
@ -132,16 +126,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
17 | f"a {dict()} b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 |
|
||||
14 14 | f"{dict(x='y')}"
|
||||
15 15 | f'{dict(x="y")}'
|
||||
16 |-f"{dict()}"
|
||||
16 |+f"{ {} }"
|
||||
17 17 | f"a {dict()} b"
|
||||
18 18 |
|
||||
19 19 | f"{dict(x='y') | dict(y='z')}"
|
||||
13 |
|
||||
14 | f"{dict(x='y')}"
|
||||
15 | f'{dict(x="y")}'
|
||||
- f"{dict()}"
|
||||
16 + f"{ {} }"
|
||||
17 | f"a {dict()} b"
|
||||
18 |
|
||||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:17:6
|
||||
|
|
@ -154,16 +147,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 | f"{dict(x='y')}"
|
||||
15 15 | f'{dict(x="y")}'
|
||||
16 16 | f"{dict()}"
|
||||
17 |-f"a {dict()} b"
|
||||
17 |+f"a { {} } b"
|
||||
18 18 |
|
||||
19 19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
14 | f"{dict(x='y')}"
|
||||
15 | f'{dict(x="y")}'
|
||||
16 | f"{dict()}"
|
||||
- f"a {dict()} b"
|
||||
17 + f"a { {} } b"
|
||||
18 |
|
||||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:19:4
|
||||
|
|
@ -176,16 +168,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
16 16 | f"{dict()}"
|
||||
17 17 | f"a {dict()} b"
|
||||
18 18 |
|
||||
19 |-f"{dict(x='y') | dict(y='z')}"
|
||||
19 |+f"{ {'x': 'y'} | dict(y='z')}"
|
||||
20 20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
21 21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
16 | f"{dict()}"
|
||||
17 | f"a {dict()} b"
|
||||
18 |
|
||||
- f"{dict(x='y') | dict(y='z')}"
|
||||
19 + f"{ {'x': 'y'} | dict(y='z')}"
|
||||
20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:19:18
|
||||
|
|
@ -198,16 +189,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
16 16 | f"{dict()}"
|
||||
17 17 | f"a {dict()} b"
|
||||
18 18 |
|
||||
19 |-f"{dict(x='y') | dict(y='z')}"
|
||||
19 |+f"{dict(x='y') | {'y': 'z'} }"
|
||||
20 20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
21 21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
16 | f"{dict()}"
|
||||
17 | f"a {dict()} b"
|
||||
18 |
|
||||
- f"{dict(x='y') | dict(y='z')}"
|
||||
19 + f"{dict(x='y') | {'y': 'z'} }"
|
||||
20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:20:5
|
||||
|
|
@ -219,16 +209,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 | f"a {dict()} b"
|
||||
18 18 |
|
||||
19 19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 |-f"{ dict(x='y') | dict(y='z') }"
|
||||
20 |+f"{ {'x': 'y'} | dict(y='z') }"
|
||||
21 21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 23 |
|
||||
17 | f"a {dict()} b"
|
||||
18 |
|
||||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
- f"{ dict(x='y') | dict(y='z') }"
|
||||
20 + f"{ {'x': 'y'} | dict(y='z') }"
|
||||
21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:20:19
|
||||
|
|
@ -240,16 +229,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 | f"a {dict()} b"
|
||||
18 18 |
|
||||
19 19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 |-f"{ dict(x='y') | dict(y='z') }"
|
||||
20 |+f"{ dict(x='y') | {'y': 'z'} }"
|
||||
21 21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 23 |
|
||||
17 | f"a {dict()} b"
|
||||
18 |
|
||||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
- f"{ dict(x='y') | dict(y='z') }"
|
||||
20 + f"{ dict(x='y') | {'y': 'z'} }"
|
||||
21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:21:6
|
||||
|
|
@ -261,16 +249,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
18 18 |
|
||||
19 19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
21 |-f"a {dict(x='y') | dict(y='z')} b"
|
||||
21 |+f"a { {'x': 'y'} | dict(y='z')} b"
|
||||
22 22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 23 |
|
||||
24 24 | dict(
|
||||
18 |
|
||||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
- f"a {dict(x='y') | dict(y='z')} b"
|
||||
21 + f"a { {'x': 'y'} | dict(y='z')} b"
|
||||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 |
|
||||
24 | dict(
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:21:20
|
||||
|
|
@ -282,16 +269,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
18 18 |
|
||||
19 19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
21 |-f"a {dict(x='y') | dict(y='z')} b"
|
||||
21 |+f"a {dict(x='y') | {'y': 'z'} } b"
|
||||
22 22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 23 |
|
||||
24 24 | dict(
|
||||
18 |
|
||||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
- f"a {dict(x='y') | dict(y='z')} b"
|
||||
21 + f"a {dict(x='y') | {'y': 'z'} } b"
|
||||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 |
|
||||
24 | dict(
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:22:7
|
||||
|
|
@ -304,16 +290,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
24 | dict(
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
19 19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
21 21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 |-f"a { dict(x='y') | dict(y='z') } b"
|
||||
22 |+f"a { {'x': 'y'} | dict(y='z') } b"
|
||||
23 23 |
|
||||
24 24 | dict(
|
||||
25 25 | # comment
|
||||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
- f"a { dict(x='y') | dict(y='z') } b"
|
||||
22 + f"a { {'x': 'y'} | dict(y='z') } b"
|
||||
23 |
|
||||
24 | dict(
|
||||
25 | # comment
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:22:21
|
||||
|
|
@ -326,16 +311,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
24 | dict(
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
19 19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
21 21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 |-f"a { dict(x='y') | dict(y='z') } b"
|
||||
22 |+f"a { dict(x='y') | {'y': 'z'} } b"
|
||||
23 23 |
|
||||
24 24 | dict(
|
||||
25 25 | # comment
|
||||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
- f"a { dict(x='y') | dict(y='z') } b"
|
||||
22 + f"a { dict(x='y') | {'y': 'z'} } b"
|
||||
23 |
|
||||
24 | dict(
|
||||
25 | # comment
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:24:1
|
||||
|
|
@ -350,19 +334,18 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
28 | tuple( # comment
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
21 21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 23 |
|
||||
24 |-dict(
|
||||
24 |+{
|
||||
25 25 | # comment
|
||||
26 |-)
|
||||
26 |+}
|
||||
27 27 |
|
||||
28 28 | tuple( # comment
|
||||
29 29 | )
|
||||
21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 |
|
||||
- dict(
|
||||
24 + {
|
||||
25 | # comment
|
||||
- )
|
||||
26 + }
|
||||
27 |
|
||||
28 | tuple( # comment
|
||||
29 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `tuple()` call (rewrite as a literal)
|
||||
--> C408.py:28:1
|
||||
|
|
@ -376,16 +359,15 @@ C408 [*] Unnecessary `tuple()` call (rewrite as a literal)
|
|||
31 | t"{dict(x='y')}"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
25 25 | # comment
|
||||
26 26 | )
|
||||
27 27 |
|
||||
28 |-tuple( # comment
|
||||
28 |+( # comment
|
||||
29 29 | )
|
||||
30 30 |
|
||||
31 31 | t"{dict(x='y')}"
|
||||
25 | # comment
|
||||
26 | )
|
||||
27 |
|
||||
- tuple( # comment
|
||||
28 + ( # comment
|
||||
29 | )
|
||||
30 |
|
||||
31 | t"{dict(x='y')}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:31:4
|
||||
|
|
@ -398,16 +380,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
33 | t"{dict()}"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
28 28 | tuple( # comment
|
||||
29 29 | )
|
||||
30 30 |
|
||||
31 |-t"{dict(x='y')}"
|
||||
31 |+t"{ {'x': 'y'} }"
|
||||
32 32 | t'{dict(x="y")}'
|
||||
33 33 | t"{dict()}"
|
||||
34 34 | t"a {dict()} b"
|
||||
28 | tuple( # comment
|
||||
29 | )
|
||||
30 |
|
||||
- t"{dict(x='y')}"
|
||||
31 + t"{ {'x': 'y'} }"
|
||||
32 | t'{dict(x="y")}'
|
||||
33 | t"{dict()}"
|
||||
34 | t"a {dict()} b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:32:4
|
||||
|
|
@ -419,16 +400,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
34 | t"a {dict()} b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 | )
|
||||
30 30 |
|
||||
31 31 | t"{dict(x='y')}"
|
||||
32 |-t'{dict(x="y")}'
|
||||
32 |+t'{ {"x": "y"} }'
|
||||
33 33 | t"{dict()}"
|
||||
34 34 | t"a {dict()} b"
|
||||
35 35 |
|
||||
29 | )
|
||||
30 |
|
||||
31 | t"{dict(x='y')}"
|
||||
- t'{dict(x="y")}'
|
||||
32 + t'{ {"x": "y"} }'
|
||||
33 | t"{dict()}"
|
||||
34 | t"a {dict()} b"
|
||||
35 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:33:4
|
||||
|
|
@ -440,16 +420,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
34 | t"a {dict()} b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
30 30 |
|
||||
31 31 | t"{dict(x='y')}"
|
||||
32 32 | t'{dict(x="y")}'
|
||||
33 |-t"{dict()}"
|
||||
33 |+t"{ {} }"
|
||||
34 34 | t"a {dict()} b"
|
||||
35 35 |
|
||||
36 36 | t"{dict(x='y') | dict(y='z')}"
|
||||
30 |
|
||||
31 | t"{dict(x='y')}"
|
||||
32 | t'{dict(x="y")}'
|
||||
- t"{dict()}"
|
||||
33 + t"{ {} }"
|
||||
34 | t"a {dict()} b"
|
||||
35 |
|
||||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:34:6
|
||||
|
|
@ -462,16 +441,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
31 31 | t"{dict(x='y')}"
|
||||
32 32 | t'{dict(x="y")}'
|
||||
33 33 | t"{dict()}"
|
||||
34 |-t"a {dict()} b"
|
||||
34 |+t"a { {} } b"
|
||||
35 35 |
|
||||
36 36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
31 | t"{dict(x='y')}"
|
||||
32 | t'{dict(x="y")}'
|
||||
33 | t"{dict()}"
|
||||
- t"a {dict()} b"
|
||||
34 + t"a { {} } b"
|
||||
35 |
|
||||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:36:4
|
||||
|
|
@ -484,16 +462,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
33 33 | t"{dict()}"
|
||||
34 34 | t"a {dict()} b"
|
||||
35 35 |
|
||||
36 |-t"{dict(x='y') | dict(y='z')}"
|
||||
36 |+t"{ {'x': 'y'} | dict(y='z')}"
|
||||
37 37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
38 38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
39 39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
33 | t"{dict()}"
|
||||
34 | t"a {dict()} b"
|
||||
35 |
|
||||
- t"{dict(x='y') | dict(y='z')}"
|
||||
36 + t"{ {'x': 'y'} | dict(y='z')}"
|
||||
37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:36:18
|
||||
|
|
@ -506,16 +483,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
33 33 | t"{dict()}"
|
||||
34 34 | t"a {dict()} b"
|
||||
35 35 |
|
||||
36 |-t"{dict(x='y') | dict(y='z')}"
|
||||
36 |+t"{dict(x='y') | {'y': 'z'} }"
|
||||
37 37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
38 38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
39 39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
33 | t"{dict()}"
|
||||
34 | t"a {dict()} b"
|
||||
35 |
|
||||
- t"{dict(x='y') | dict(y='z')}"
|
||||
36 + t"{dict(x='y') | {'y': 'z'} }"
|
||||
37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:37:5
|
||||
|
|
@ -527,15 +503,14 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
34 34 | t"a {dict()} b"
|
||||
35 35 |
|
||||
36 36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 |-t"{ dict(x='y') | dict(y='z') }"
|
||||
37 |+t"{ {'x': 'y'} | dict(y='z') }"
|
||||
38 38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
39 39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
34 | t"a {dict()} b"
|
||||
35 |
|
||||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
- t"{ dict(x='y') | dict(y='z') }"
|
||||
37 + t"{ {'x': 'y'} | dict(y='z') }"
|
||||
38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:37:19
|
||||
|
|
@ -547,15 +522,14 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
34 34 | t"a {dict()} b"
|
||||
35 35 |
|
||||
36 36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 |-t"{ dict(x='y') | dict(y='z') }"
|
||||
37 |+t"{ dict(x='y') | {'y': 'z'} }"
|
||||
38 38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
39 39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
34 | t"a {dict()} b"
|
||||
35 |
|
||||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
- t"{ dict(x='y') | dict(y='z') }"
|
||||
37 + t"{ dict(x='y') | {'y': 'z'} }"
|
||||
38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:38:6
|
||||
|
|
@ -567,14 +541,13 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
35 35 |
|
||||
36 36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
38 |-t"a {dict(x='y') | dict(y='z')} b"
|
||||
38 |+t"a { {'x': 'y'} | dict(y='z')} b"
|
||||
39 39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
35 |
|
||||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
- t"a {dict(x='y') | dict(y='z')} b"
|
||||
38 + t"a { {'x': 'y'} | dict(y='z')} b"
|
||||
39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:38:20
|
||||
|
|
@ -586,14 +559,13 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
35 35 |
|
||||
36 36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
38 |-t"a {dict(x='y') | dict(y='z')} b"
|
||||
38 |+t"a {dict(x='y') | {'y': 'z'} } b"
|
||||
39 39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
35 |
|
||||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
- t"a {dict(x='y') | dict(y='z')} b"
|
||||
38 + t"a {dict(x='y') | {'y': 'z'} } b"
|
||||
39 | t"a { dict(x='y') | dict(y='z') } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:39:7
|
||||
|
|
@ -604,13 +576,12 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
| ^^^^^^^^^^^
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
36 36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
38 38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
39 |-t"a { dict(x='y') | dict(y='z') } b"
|
||||
39 |+t"a { {'x': 'y'} | dict(y='z') } b"
|
||||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
- t"a { dict(x='y') | dict(y='z') } b"
|
||||
39 + t"a { {'x': 'y'} | dict(y='z') } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:39:21
|
||||
|
|
@ -621,10 +592,9 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
| ^^^^^^^^^^^
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
36 36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
38 38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
39 |-t"a { dict(x='y') | dict(y='z') } b"
|
||||
39 |+t"a { dict(x='y') | {'y': 'z'} } b"
|
||||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
38 | t"a {dict(x='y') | dict(y='z')} b"
|
||||
- t"a { dict(x='y') | dict(y='z') } b"
|
||||
39 + t"a { dict(x='y') | {'y': 'z'} } b"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C408 [*] Unnecessary `tuple()` call (rewrite as a literal)
|
|||
3 | d1 = dict()
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-t = tuple()
|
||||
1 |+t = ()
|
||||
2 2 | l = list()
|
||||
3 3 | d1 = dict()
|
||||
4 4 | d2 = dict(a=1)
|
||||
- t = tuple()
|
||||
1 + t = ()
|
||||
2 | l = list()
|
||||
3 | d1 = dict()
|
||||
4 | d2 = dict(a=1)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `list()` call (rewrite as a literal)
|
||||
--> C408.py:2:5
|
||||
|
|
@ -28,14 +27,13 @@ C408 [*] Unnecessary `list()` call (rewrite as a literal)
|
|||
4 | d2 = dict(a=1)
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t = tuple()
|
||||
2 |-l = list()
|
||||
2 |+l = []
|
||||
3 3 | d1 = dict()
|
||||
4 4 | d2 = dict(a=1)
|
||||
5 5 | d3 = dict(**d2)
|
||||
1 | t = tuple()
|
||||
- l = list()
|
||||
2 + l = []
|
||||
3 | d1 = dict()
|
||||
4 | d2 = dict(a=1)
|
||||
5 | d3 = dict(**d2)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:3:6
|
||||
|
|
@ -48,15 +46,14 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
5 | d3 = dict(**d2)
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t = tuple()
|
||||
2 2 | l = list()
|
||||
3 |-d1 = dict()
|
||||
3 |+d1 = {}
|
||||
4 4 | d2 = dict(a=1)
|
||||
5 5 | d3 = dict(**d2)
|
||||
6 6 |
|
||||
1 | t = tuple()
|
||||
2 | l = list()
|
||||
- d1 = dict()
|
||||
3 + d1 = {}
|
||||
4 | d2 = dict(a=1)
|
||||
5 | d3 = dict(**d2)
|
||||
6 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:16:4
|
||||
|
|
@ -68,16 +65,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
17 | f"a {dict()} b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 |
|
||||
14 14 | f"{dict(x='y')}"
|
||||
15 15 | f'{dict(x="y")}'
|
||||
16 |-f"{dict()}"
|
||||
16 |+f"{ {} }"
|
||||
17 17 | f"a {dict()} b"
|
||||
18 18 |
|
||||
19 19 | f"{dict(x='y') | dict(y='z')}"
|
||||
13 |
|
||||
14 | f"{dict(x='y')}"
|
||||
15 | f'{dict(x="y")}'
|
||||
- f"{dict()}"
|
||||
16 + f"{ {} }"
|
||||
17 | f"a {dict()} b"
|
||||
18 |
|
||||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:17:6
|
||||
|
|
@ -90,16 +86,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 | f"{dict(x='y')}"
|
||||
15 15 | f'{dict(x="y")}'
|
||||
16 16 | f"{dict()}"
|
||||
17 |-f"a {dict()} b"
|
||||
17 |+f"a { {} } b"
|
||||
18 18 |
|
||||
19 19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
14 | f"{dict(x='y')}"
|
||||
15 | f'{dict(x="y")}'
|
||||
16 | f"{dict()}"
|
||||
- f"a {dict()} b"
|
||||
17 + f"a { {} } b"
|
||||
18 |
|
||||
19 | f"{dict(x='y') | dict(y='z')}"
|
||||
20 | f"{ dict(x='y') | dict(y='z') }"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:24:1
|
||||
|
|
@ -114,19 +109,18 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
28 | tuple( # comment
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
21 21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 23 |
|
||||
24 |-dict(
|
||||
24 |+{
|
||||
25 25 | # comment
|
||||
26 |-)
|
||||
26 |+}
|
||||
27 27 |
|
||||
28 28 | tuple( # comment
|
||||
29 29 | )
|
||||
21 | f"a {dict(x='y') | dict(y='z')} b"
|
||||
22 | f"a { dict(x='y') | dict(y='z') } b"
|
||||
23 |
|
||||
- dict(
|
||||
24 + {
|
||||
25 | # comment
|
||||
- )
|
||||
26 + }
|
||||
27 |
|
||||
28 | tuple( # comment
|
||||
29 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `tuple()` call (rewrite as a literal)
|
||||
--> C408.py:28:1
|
||||
|
|
@ -140,16 +134,15 @@ C408 [*] Unnecessary `tuple()` call (rewrite as a literal)
|
|||
31 | t"{dict(x='y')}"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
25 25 | # comment
|
||||
26 26 | )
|
||||
27 27 |
|
||||
28 |-tuple( # comment
|
||||
28 |+( # comment
|
||||
29 29 | )
|
||||
30 30 |
|
||||
31 31 | t"{dict(x='y')}"
|
||||
25 | # comment
|
||||
26 | )
|
||||
27 |
|
||||
- tuple( # comment
|
||||
28 + ( # comment
|
||||
29 | )
|
||||
30 |
|
||||
31 | t"{dict(x='y')}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:33:4
|
||||
|
|
@ -161,16 +154,15 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
34 | t"a {dict()} b"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
30 30 |
|
||||
31 31 | t"{dict(x='y')}"
|
||||
32 32 | t'{dict(x="y")}'
|
||||
33 |-t"{dict()}"
|
||||
33 |+t"{ {} }"
|
||||
34 34 | t"a {dict()} b"
|
||||
35 35 |
|
||||
36 36 | t"{dict(x='y') | dict(y='z')}"
|
||||
30 |
|
||||
31 | t"{dict(x='y')}"
|
||||
32 | t'{dict(x="y")}'
|
||||
- t"{dict()}"
|
||||
33 + t"{ {} }"
|
||||
34 | t"a {dict()} b"
|
||||
35 |
|
||||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
||||
--> C408.py:34:6
|
||||
|
|
@ -183,13 +175,12 @@ C408 [*] Unnecessary `dict()` call (rewrite as a literal)
|
|||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
|
|
||||
help: Rewrite as a literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
31 31 | t"{dict(x='y')}"
|
||||
32 32 | t'{dict(x="y")}'
|
||||
33 33 | t"{dict()}"
|
||||
34 |-t"a {dict()} b"
|
||||
34 |+t"a { {} } b"
|
||||
35 35 |
|
||||
36 36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
31 | t"{dict(x='y')}"
|
||||
32 | t'{dict(x="y")}'
|
||||
33 | t"{dict()}"
|
||||
- t"a {dict()} b"
|
||||
34 + t"a { {} } b"
|
||||
35 |
|
||||
36 | t"{dict(x='y') | dict(y='z')}"
|
||||
37 | t"{ dict(x='y') | dict(y='z') }"
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
3 | t3 = tuple((1, 2))
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-t1 = tuple([])
|
||||
1 |+t1 = ()
|
||||
2 2 | t2 = tuple([1, 2])
|
||||
3 3 | t3 = tuple((1, 2))
|
||||
4 4 | t4 = tuple([
|
||||
- t1 = tuple([])
|
||||
1 + t1 = ()
|
||||
2 | t2 = tuple([1, 2])
|
||||
3 | t3 = tuple((1, 2))
|
||||
4 | t4 = tuple([
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:2:6
|
||||
|
|
@ -28,14 +27,13 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
4 | t4 = tuple([
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t1 = tuple([])
|
||||
2 |-t2 = tuple([1, 2])
|
||||
2 |+t2 = (1, 2)
|
||||
3 3 | t3 = tuple((1, 2))
|
||||
4 4 | t4 = tuple([
|
||||
5 5 | 1,
|
||||
1 | t1 = tuple([])
|
||||
- t2 = tuple([1, 2])
|
||||
2 + t2 = (1, 2)
|
||||
3 | t3 = tuple((1, 2))
|
||||
4 | t4 = tuple([
|
||||
5 | 1,
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to `tuple()`)
|
||||
--> C409.py:3:6
|
||||
|
|
@ -48,15 +46,14 @@ C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to
|
|||
5 | 1,
|
||||
|
|
||||
help: Remove the outer call to `tuple()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t1 = tuple([])
|
||||
2 2 | t2 = tuple([1, 2])
|
||||
3 |-t3 = tuple((1, 2))
|
||||
3 |+t3 = (1, 2)
|
||||
4 4 | t4 = tuple([
|
||||
5 5 | 1,
|
||||
6 6 | 2
|
||||
1 | t1 = tuple([])
|
||||
2 | t2 = tuple([1, 2])
|
||||
- t3 = tuple((1, 2))
|
||||
3 + t3 = (1, 2)
|
||||
4 | t4 = tuple([
|
||||
5 | 1,
|
||||
6 | 2
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:4:6
|
||||
|
|
@ -73,20 +70,19 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
9 | (1, 2)
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t1 = tuple([])
|
||||
2 2 | t2 = tuple([1, 2])
|
||||
3 3 | t3 = tuple((1, 2))
|
||||
4 |-t4 = tuple([
|
||||
4 |+t4 = (
|
||||
5 5 | 1,
|
||||
6 6 | 2
|
||||
7 |-])
|
||||
7 |+)
|
||||
8 8 | t5 = tuple(
|
||||
9 9 | (1, 2)
|
||||
10 10 | )
|
||||
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 change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to `tuple()`)
|
||||
--> C409.py:8:6
|
||||
|
|
@ -102,18 +98,17 @@ C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to
|
|||
12 | tuple( # comment
|
||||
|
|
||||
help: Remove the outer call to `tuple()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | 1,
|
||||
6 6 | 2
|
||||
7 7 | ])
|
||||
8 |-t5 = tuple(
|
||||
9 |- (1, 2)
|
||||
10 |-)
|
||||
8 |+t5 = (1, 2)
|
||||
11 9 |
|
||||
12 10 | tuple( # comment
|
||||
13 11 | [1, 2]
|
||||
5 | 1,
|
||||
6 | 2
|
||||
7 | ])
|
||||
- t5 = tuple(
|
||||
- (1, 2)
|
||||
- )
|
||||
8 + t5 = (1, 2)
|
||||
9 |
|
||||
10 | tuple( # comment
|
||||
11 | [1, 2]
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:12:1
|
||||
|
|
@ -128,18 +123,17 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
16 | tuple([ # comment
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | (1, 2)
|
||||
10 10 | )
|
||||
11 11 |
|
||||
12 |-tuple( # comment
|
||||
13 |- [1, 2]
|
||||
14 |-)
|
||||
12 |+(1, 2)
|
||||
15 13 |
|
||||
16 14 | tuple([ # comment
|
||||
17 15 | 1, 2
|
||||
9 | (1, 2)
|
||||
10 | )
|
||||
11 |
|
||||
- tuple( # comment
|
||||
- [1, 2]
|
||||
- )
|
||||
12 + (1, 2)
|
||||
13 |
|
||||
14 | tuple([ # comment
|
||||
15 | 1, 2
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:16:1
|
||||
|
|
@ -154,19 +148,18 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
20 | tuple((
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 | [1, 2]
|
||||
14 14 | )
|
||||
15 15 |
|
||||
16 |-tuple([ # comment
|
||||
16 |+( # comment
|
||||
17 17 | 1, 2
|
||||
18 |-])
|
||||
18 |+)
|
||||
19 19 |
|
||||
20 20 | tuple((
|
||||
21 21 | 1,
|
||||
13 | [1, 2]
|
||||
14 | )
|
||||
15 |
|
||||
- tuple([ # comment
|
||||
16 + ( # comment
|
||||
17 | 1, 2
|
||||
- ])
|
||||
18 + )
|
||||
19 |
|
||||
20 | tuple((
|
||||
21 | 1,
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to `tuple()`)
|
||||
--> C409.py:20:1
|
||||
|
|
@ -181,19 +174,18 @@ C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to
|
|||
24 | t6 = tuple([1])
|
||||
|
|
||||
help: Remove the outer call to `tuple()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 | 1, 2
|
||||
18 18 | ])
|
||||
19 19 |
|
||||
20 |-tuple((
|
||||
20 |+(
|
||||
21 21 | 1,
|
||||
22 |-))
|
||||
22 |+)
|
||||
23 23 |
|
||||
24 24 | t6 = tuple([1])
|
||||
25 25 | t7 = tuple((1,))
|
||||
17 | 1, 2
|
||||
18 | ])
|
||||
19 |
|
||||
- tuple((
|
||||
20 + (
|
||||
21 | 1,
|
||||
- ))
|
||||
22 + )
|
||||
23 |
|
||||
24 | t6 = tuple([1])
|
||||
25 | t7 = tuple((1,))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:24:6
|
||||
|
|
@ -206,16 +198,15 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
26 | t8 = tuple([1,])
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
21 21 | 1,
|
||||
22 22 | ))
|
||||
23 23 |
|
||||
24 |-t6 = tuple([1])
|
||||
24 |+t6 = (1,)
|
||||
25 25 | t7 = tuple((1,))
|
||||
26 26 | t8 = tuple([1,])
|
||||
27 27 |
|
||||
21 | 1,
|
||||
22 | ))
|
||||
23 |
|
||||
- t6 = tuple([1])
|
||||
24 + t6 = (1,)
|
||||
25 | t7 = tuple((1,))
|
||||
26 | t8 = tuple([1,])
|
||||
27 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to `tuple()`)
|
||||
--> C409.py:25:6
|
||||
|
|
@ -226,16 +217,15 @@ C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to
|
|||
26 | t8 = tuple([1,])
|
||||
|
|
||||
help: Remove the outer call to `tuple()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 | ))
|
||||
23 23 |
|
||||
24 24 | t6 = tuple([1])
|
||||
25 |-t7 = tuple((1,))
|
||||
25 |+t7 = (1,)
|
||||
26 26 | t8 = tuple([1,])
|
||||
27 27 |
|
||||
28 28 | tuple([x for x in range(5)])
|
||||
22 | ))
|
||||
23 |
|
||||
24 | t6 = tuple([1])
|
||||
- t7 = tuple((1,))
|
||||
25 + t7 = (1,)
|
||||
26 | t8 = tuple([1,])
|
||||
27 |
|
||||
28 | tuple([x for x in range(5)])
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:26:6
|
||||
|
|
@ -248,13 +238,12 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
28 | tuple([x for x in range(5)])
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
23 23 |
|
||||
24 24 | t6 = tuple([1])
|
||||
25 25 | t7 = tuple((1,))
|
||||
26 |-t8 = tuple([1,])
|
||||
26 |+t8 = (1,)
|
||||
27 27 |
|
||||
28 28 | tuple([x for x in range(5)])
|
||||
29 29 | tuple({x for x in range(10)})
|
||||
23 |
|
||||
24 | t6 = tuple([1])
|
||||
25 | t7 = tuple((1,))
|
||||
- t8 = tuple([1,])
|
||||
26 + t8 = (1,)
|
||||
27 |
|
||||
28 | tuple([x for x in range(5)])
|
||||
29 | tuple({x for x in range(10)})
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C410 [*] Unnecessary list literal passed to `list()` (remove the outer call to `
|
|||
3 | l3 = list([])
|
||||
|
|
||||
help: Remove outer `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-l1 = list([1, 2])
|
||||
1 |+l1 = [1, 2]
|
||||
2 2 | l2 = list((1, 2))
|
||||
3 3 | l3 = list([])
|
||||
4 4 | l4 = list(())
|
||||
- l1 = list([1, 2])
|
||||
1 + l1 = [1, 2]
|
||||
2 | l2 = list((1, 2))
|
||||
3 | l3 = list([])
|
||||
4 | l4 = list(())
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C410 [*] Unnecessary tuple literal passed to `list()` (rewrite as a single list literal)
|
||||
--> C410.py:2:6
|
||||
|
|
@ -28,14 +27,13 @@ C410 [*] Unnecessary tuple literal passed to `list()` (rewrite as a single list
|
|||
4 | l4 = list(())
|
||||
|
|
||||
help: Rewrite as a single list literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | l1 = list([1, 2])
|
||||
2 |-l2 = list((1, 2))
|
||||
2 |+l2 = [1, 2]
|
||||
3 3 | l3 = list([])
|
||||
4 4 | l4 = list(())
|
||||
5 5 |
|
||||
1 | l1 = list([1, 2])
|
||||
- l2 = list((1, 2))
|
||||
2 + l2 = [1, 2]
|
||||
3 | l3 = list([])
|
||||
4 | l4 = list(())
|
||||
5 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C410 [*] Unnecessary list literal passed to `list()` (remove the outer call to `list()`)
|
||||
--> C410.py:3:6
|
||||
|
|
@ -47,15 +45,14 @@ C410 [*] Unnecessary list literal passed to `list()` (remove the outer call to `
|
|||
4 | l4 = list(())
|
||||
|
|
||||
help: Remove outer `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | l1 = list([1, 2])
|
||||
2 2 | l2 = list((1, 2))
|
||||
3 |-l3 = list([])
|
||||
3 |+l3 = []
|
||||
4 4 | l4 = list(())
|
||||
5 5 |
|
||||
6 6 |
|
||||
1 | l1 = list([1, 2])
|
||||
2 | l2 = list((1, 2))
|
||||
- l3 = list([])
|
||||
3 + l3 = []
|
||||
4 | l4 = list(())
|
||||
5 |
|
||||
6 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C410 [*] Unnecessary tuple literal passed to `list()` (rewrite as a single list literal)
|
||||
--> C410.py:4:6
|
||||
|
|
@ -66,16 +63,15 @@ C410 [*] Unnecessary tuple literal passed to `list()` (rewrite as a single list
|
|||
| ^^^^^^^^
|
||||
|
|
||||
help: Rewrite as a single list literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | l1 = list([1, 2])
|
||||
2 2 | l2 = list((1, 2))
|
||||
3 3 | l3 = list([])
|
||||
4 |-l4 = list(())
|
||||
4 |+l4 = []
|
||||
5 5 |
|
||||
6 6 |
|
||||
7 7 | list( # comment
|
||||
1 | l1 = list([1, 2])
|
||||
2 | l2 = list((1, 2))
|
||||
3 | l3 = list([])
|
||||
- l4 = list(())
|
||||
4 + l4 = []
|
||||
5 |
|
||||
6 |
|
||||
7 | list( # comment
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C410 [*] Unnecessary list literal passed to `list()` (remove the outer call to `list()`)
|
||||
--> C410.py:7:1
|
||||
|
|
@ -88,18 +84,17 @@ C410 [*] Unnecessary list literal passed to `list()` (remove the outer call to `
|
|||
11 | list([ # comment
|
||||
|
|
||||
help: Remove outer `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | l4 = list(())
|
||||
5 5 |
|
||||
6 6 |
|
||||
7 |-list( # comment
|
||||
8 |- [1, 2]
|
||||
9 |-)
|
||||
7 |+[1, 2]
|
||||
10 8 |
|
||||
11 9 | list([ # comment
|
||||
12 10 | 1, 2
|
||||
4 | l4 = list(())
|
||||
5 |
|
||||
6 |
|
||||
- list( # comment
|
||||
- [1, 2]
|
||||
- )
|
||||
7 + [1, 2]
|
||||
8 |
|
||||
9 | list([ # comment
|
||||
10 | 1, 2
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C410 [*] Unnecessary list literal passed to `list()` (remove the outer call to `list()`)
|
||||
--> C410.py:11:1
|
||||
|
|
@ -114,16 +109,15 @@ C410 [*] Unnecessary list literal passed to `list()` (remove the outer call to `
|
|||
15 | # Skip when too many positional arguments
|
||||
|
|
||||
help: Remove outer `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | [1, 2]
|
||||
9 9 | )
|
||||
10 10 |
|
||||
11 |-list([ # comment
|
||||
11 |+[ # comment
|
||||
12 12 | 1, 2
|
||||
13 |-])
|
||||
13 |+]
|
||||
14 14 |
|
||||
15 15 | # Skip when too many positional arguments
|
||||
16 16 | # See https://github.com/astral-sh/ruff/issues/15810
|
||||
8 | [1, 2]
|
||||
9 | )
|
||||
10 |
|
||||
- list([ # comment
|
||||
11 + [ # comment
|
||||
12 | 1, 2
|
||||
- ])
|
||||
13 + ]
|
||||
14 |
|
||||
15 | # Skip when too many positional arguments
|
||||
16 | # See https://github.com/astral-sh/ruff/issues/15810
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -11,11 +11,10 @@ C411 [*] Unnecessary `list()` call (remove the outer call to `list()`)
|
|||
4 | # Skip when too many positional arguments
|
||||
|
|
||||
help: Remove outer `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | x = [1, 2, 3]
|
||||
2 |-list([i for i in x])
|
||||
2 |+[i for i in x]
|
||||
3 3 |
|
||||
4 4 | # Skip when too many positional arguments
|
||||
5 5 | # or keyword argument present.
|
||||
1 | x = [1, 2, 3]
|
||||
- list([i for i in x])
|
||||
2 + [i for i in x]
|
||||
3 |
|
||||
4 | # Skip when too many positional arguments
|
||||
5 | # or keyword argument present.
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,15 +12,13 @@ C413 [*] Unnecessary `list()` call around `sorted()`
|
|||
5 | reversed(sorted(x, key=lambda e: e))
|
||||
|
|
||||
help: Remove unnecessary `list()` call
|
||||
|
||||
ℹ Safe fix
|
||||
1 1 | x = [2, 3, 1]
|
||||
2 2 | list(x)
|
||||
3 |-list(sorted(x))
|
||||
3 |+sorted(x)
|
||||
4 4 | reversed(sorted(x))
|
||||
5 5 | reversed(sorted(x, key=lambda e: e))
|
||||
6 6 | reversed(sorted(x, reverse=True))
|
||||
1 | x = [2, 3, 1]
|
||||
2 | list(x)
|
||||
- list(sorted(x))
|
||||
3 + sorted(x)
|
||||
4 | reversed(sorted(x))
|
||||
5 | reversed(sorted(x, key=lambda e: e))
|
||||
6 | reversed(sorted(x, reverse=True))
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:4:1
|
||||
|
|
@ -33,16 +31,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
6 | reversed(sorted(x, reverse=True))
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | x = [2, 3, 1]
|
||||
2 2 | list(x)
|
||||
3 3 | list(sorted(x))
|
||||
4 |-reversed(sorted(x))
|
||||
4 |+sorted(x, reverse=True)
|
||||
5 5 | reversed(sorted(x, key=lambda e: e))
|
||||
6 6 | reversed(sorted(x, reverse=True))
|
||||
7 7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
1 | x = [2, 3, 1]
|
||||
2 | list(x)
|
||||
3 | list(sorted(x))
|
||||
- reversed(sorted(x))
|
||||
4 + sorted(x, reverse=True)
|
||||
5 | reversed(sorted(x, key=lambda e: e))
|
||||
6 | reversed(sorted(x, reverse=True))
|
||||
7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:5:1
|
||||
|
|
@ -55,16 +52,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | list(x)
|
||||
3 3 | list(sorted(x))
|
||||
4 4 | reversed(sorted(x))
|
||||
5 |-reversed(sorted(x, key=lambda e: e))
|
||||
5 |+sorted(x, key=lambda e: e, reverse=True)
|
||||
6 6 | reversed(sorted(x, reverse=True))
|
||||
7 7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
8 8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
2 | list(x)
|
||||
3 | list(sorted(x))
|
||||
4 | reversed(sorted(x))
|
||||
- reversed(sorted(x, key=lambda e: e))
|
||||
5 + sorted(x, key=lambda e: e, reverse=True)
|
||||
6 | reversed(sorted(x, reverse=True))
|
||||
7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:6:1
|
||||
|
|
@ -77,16 +73,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | list(sorted(x))
|
||||
4 4 | reversed(sorted(x))
|
||||
5 5 | reversed(sorted(x, key=lambda e: e))
|
||||
6 |-reversed(sorted(x, reverse=True))
|
||||
6 |+sorted(x, reverse=False)
|
||||
7 7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
8 8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
9 9 | reversed(sorted(x, reverse=False))
|
||||
3 | list(sorted(x))
|
||||
4 | reversed(sorted(x))
|
||||
5 | reversed(sorted(x, key=lambda e: e))
|
||||
- reversed(sorted(x, reverse=True))
|
||||
6 + sorted(x, reverse=False)
|
||||
7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
9 | reversed(sorted(x, reverse=False))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:7:1
|
||||
|
|
@ -99,16 +94,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
9 | reversed(sorted(x, reverse=False))
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | reversed(sorted(x))
|
||||
5 5 | reversed(sorted(x, key=lambda e: e))
|
||||
6 6 | reversed(sorted(x, reverse=True))
|
||||
7 |-reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
7 |+sorted(x, key=lambda e: e, reverse=False)
|
||||
8 8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
9 9 | reversed(sorted(x, reverse=False))
|
||||
10 10 | reversed(sorted(x, reverse=x))
|
||||
4 | reversed(sorted(x))
|
||||
5 | reversed(sorted(x, key=lambda e: e))
|
||||
6 | reversed(sorted(x, reverse=True))
|
||||
- reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
7 + sorted(x, key=lambda e: e, reverse=False)
|
||||
8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
9 | reversed(sorted(x, reverse=False))
|
||||
10 | reversed(sorted(x, reverse=x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:8:1
|
||||
|
|
@ -121,16 +115,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
10 | reversed(sorted(x, reverse=x))
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | reversed(sorted(x, key=lambda e: e))
|
||||
6 6 | reversed(sorted(x, reverse=True))
|
||||
7 7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
8 |-reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
8 |+sorted(x, reverse=False, key=lambda e: e)
|
||||
9 9 | reversed(sorted(x, reverse=False))
|
||||
10 10 | reversed(sorted(x, reverse=x))
|
||||
11 11 | reversed(sorted(x, reverse=not x))
|
||||
5 | reversed(sorted(x, key=lambda e: e))
|
||||
6 | reversed(sorted(x, reverse=True))
|
||||
7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
- reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
8 + sorted(x, reverse=False, key=lambda e: e)
|
||||
9 | reversed(sorted(x, reverse=False))
|
||||
10 | reversed(sorted(x, reverse=x))
|
||||
11 | reversed(sorted(x, reverse=not x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:9:1
|
||||
|
|
@ -143,16 +136,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
11 | reversed(sorted(x, reverse=not x))
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 | reversed(sorted(x, reverse=True))
|
||||
7 7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
8 8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
9 |-reversed(sorted(x, reverse=False))
|
||||
9 |+sorted(x, reverse=True)
|
||||
10 10 | reversed(sorted(x, reverse=x))
|
||||
11 11 | reversed(sorted(x, reverse=not x))
|
||||
12 12 |
|
||||
6 | reversed(sorted(x, reverse=True))
|
||||
7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
- reversed(sorted(x, reverse=False))
|
||||
9 + sorted(x, reverse=True)
|
||||
10 | reversed(sorted(x, reverse=x))
|
||||
11 | reversed(sorted(x, reverse=not x))
|
||||
12 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:10:1
|
||||
|
|
@ -164,16 +156,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
11 | reversed(sorted(x, reverse=not x))
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
8 8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
9 9 | reversed(sorted(x, reverse=False))
|
||||
10 |-reversed(sorted(x, reverse=x))
|
||||
10 |+sorted(x, reverse=not x)
|
||||
11 11 | reversed(sorted(x, reverse=not x))
|
||||
12 12 |
|
||||
13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
|
||||
7 | reversed(sorted(x, key=lambda e: e, reverse=True))
|
||||
8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
9 | reversed(sorted(x, reverse=False))
|
||||
- reversed(sorted(x, reverse=x))
|
||||
10 + sorted(x, reverse=not x)
|
||||
11 | reversed(sorted(x, reverse=not x))
|
||||
12 |
|
||||
13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:11:1
|
||||
|
|
@ -186,16 +177,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
9 9 | reversed(sorted(x, reverse=False))
|
||||
10 10 | reversed(sorted(x, reverse=x))
|
||||
11 |-reversed(sorted(x, reverse=not x))
|
||||
11 |+sorted(x, reverse=x)
|
||||
12 12 |
|
||||
13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
|
||||
14 14 | reversed(sorted(i for i in range(42)))
|
||||
8 | reversed(sorted(x, reverse=True, key=lambda e: e))
|
||||
9 | reversed(sorted(x, reverse=False))
|
||||
10 | reversed(sorted(x, reverse=x))
|
||||
- reversed(sorted(x, reverse=not x))
|
||||
11 + sorted(x, reverse=x)
|
||||
12 |
|
||||
13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
|
||||
14 | reversed(sorted(i for i in range(42)))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:14:1
|
||||
|
|
@ -206,16 +196,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
15 | reversed(sorted((i for i in range(42)), reverse=True))
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
11 11 | reversed(sorted(x, reverse=not x))
|
||||
12 12 |
|
||||
13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
|
||||
14 |-reversed(sorted(i for i in range(42)))
|
||||
14 |+sorted((i for i in range(42)), reverse=True)
|
||||
15 15 | reversed(sorted((i for i in range(42)), reverse=True))
|
||||
16 16 |
|
||||
17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335
|
||||
11 | reversed(sorted(x, reverse=not x))
|
||||
12 |
|
||||
13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
|
||||
- reversed(sorted(i for i in range(42)))
|
||||
14 + sorted((i for i in range(42)), reverse=True)
|
||||
15 | reversed(sorted((i for i in range(42)), reverse=True))
|
||||
16 |
|
||||
17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:15:1
|
||||
|
|
@ -228,16 +217,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 |
|
||||
13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
|
||||
14 14 | reversed(sorted(i for i in range(42)))
|
||||
15 |-reversed(sorted((i for i in range(42)), reverse=True))
|
||||
15 |+sorted((i for i in range(42)), reverse=False)
|
||||
16 16 |
|
||||
17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335
|
||||
18 18 | reversed(sorted([1, 2, 3], reverse=False or True))
|
||||
12 |
|
||||
13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289
|
||||
14 | reversed(sorted(i for i in range(42)))
|
||||
- reversed(sorted((i for i in range(42)), reverse=True))
|
||||
15 + sorted((i for i in range(42)), reverse=False)
|
||||
16 |
|
||||
17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335
|
||||
18 | reversed(sorted([1, 2, 3], reverse=False or True))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:18:1
|
||||
|
|
@ -248,16 +236,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
19 | reversed(sorted([1, 2, 3], reverse=(False or True)))
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
15 15 | reversed(sorted((i for i in range(42)), reverse=True))
|
||||
16 16 |
|
||||
17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335
|
||||
18 |-reversed(sorted([1, 2, 3], reverse=False or True))
|
||||
18 |+sorted([1, 2, 3], reverse=not (False or True))
|
||||
19 19 | reversed(sorted([1, 2, 3], reverse=(False or True)))
|
||||
20 20 |
|
||||
21 21 | # These fixes need to be parenthesized to avoid syntax errors and behavior
|
||||
15 | reversed(sorted((i for i in range(42)), reverse=True))
|
||||
16 |
|
||||
17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335
|
||||
- reversed(sorted([1, 2, 3], reverse=False or True))
|
||||
18 + sorted([1, 2, 3], reverse=not (False or True))
|
||||
19 | reversed(sorted([1, 2, 3], reverse=(False or True)))
|
||||
20 |
|
||||
21 | # These fixes need to be parenthesized to avoid syntax errors and behavior
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:19:1
|
||||
|
|
@ -270,16 +257,15 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
21 | # These fixes need to be parenthesized to avoid syntax errors and behavior
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
16 16 |
|
||||
17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335
|
||||
18 18 | reversed(sorted([1, 2, 3], reverse=False or True))
|
||||
19 |-reversed(sorted([1, 2, 3], reverse=(False or True)))
|
||||
19 |+sorted([1, 2, 3], reverse=not (False or True))
|
||||
20 20 |
|
||||
21 21 | # These fixes need to be parenthesized to avoid syntax errors and behavior
|
||||
22 22 | # changes.
|
||||
16 |
|
||||
17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335
|
||||
18 | reversed(sorted([1, 2, 3], reverse=False or True))
|
||||
- reversed(sorted([1, 2, 3], reverse=(False or True)))
|
||||
19 + sorted([1, 2, 3], reverse=not (False or True))
|
||||
20 |
|
||||
21 | # These fixes need to be parenthesized to avoid syntax errors and behavior
|
||||
22 | # changes.
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `reversed()` call around `sorted()`
|
||||
--> C413.py:24:1
|
||||
|
|
@ -293,18 +279,17 @@ C413 [*] Unnecessary `reversed()` call around `sorted()`
|
|||
27 | (""))
|
||||
|
|
||||
help: Remove unnecessary `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
21 21 | # These fixes need to be parenthesized to avoid syntax errors and behavior
|
||||
22 22 | # changes.
|
||||
23 23 | # See https://github.com/astral-sh/ruff/issues/15789
|
||||
24 |-reversed(sorted
|
||||
25 |-(""))
|
||||
24 |+(sorted
|
||||
25 |+("", reverse=True))
|
||||
26 26 | list(sorted
|
||||
27 27 | (""))
|
||||
28 28 | list(sorted
|
||||
21 | # These fixes need to be parenthesized to avoid syntax errors and behavior
|
||||
22 | # changes.
|
||||
23 | # See https://github.com/astral-sh/ruff/issues/15789
|
||||
- reversed(sorted
|
||||
- (""))
|
||||
24 + (sorted
|
||||
25 + ("", reverse=True))
|
||||
26 | list(sorted
|
||||
27 | (""))
|
||||
28 | list(sorted
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C413 [*] Unnecessary `list()` call around `sorted()`
|
||||
--> C413.py:26:1
|
||||
|
|
@ -318,16 +303,14 @@ C413 [*] Unnecessary `list()` call around `sorted()`
|
|||
29 | ("xy"))
|
||||
|
|
||||
help: Remove unnecessary `list()` call
|
||||
|
||||
ℹ Safe fix
|
||||
23 23 | # See https://github.com/astral-sh/ruff/issues/15789
|
||||
24 24 | reversed(sorted
|
||||
25 25 | (""))
|
||||
26 |-list(sorted
|
||||
26 |+(sorted
|
||||
27 27 | (""))
|
||||
28 28 | list(sorted
|
||||
29 29 | ("xy"))
|
||||
23 | # See https://github.com/astral-sh/ruff/issues/15789
|
||||
24 | reversed(sorted
|
||||
25 | (""))
|
||||
- list(sorted
|
||||
26 + (sorted
|
||||
27 | (""))
|
||||
28 | list(sorted
|
||||
29 | ("xy"))
|
||||
|
||||
C413 [*] Unnecessary `list()` call around `sorted()`
|
||||
--> C413.py:28:1
|
||||
|
|
@ -339,11 +322,9 @@ C413 [*] Unnecessary `list()` call around `sorted()`
|
|||
| |_______^
|
||||
|
|
||||
help: Remove unnecessary `list()` call
|
||||
|
||||
ℹ Safe fix
|
||||
25 25 | (""))
|
||||
26 26 | list(sorted
|
||||
27 27 | (""))
|
||||
28 |-list(sorted
|
||||
28 |+(sorted
|
||||
29 29 | ("xy"))
|
||||
25 | (""))
|
||||
26 | list(sorted
|
||||
27 | (""))
|
||||
- list(sorted
|
||||
28 + (sorted
|
||||
29 | ("xy"))
|
||||
|
|
|
|||
|
|
@ -11,14 +11,13 @@ C414 [*] Unnecessary `list()` call within `list()`
|
|||
4 | tuple(list(x))
|
||||
|
|
||||
help: Remove the inner `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | x = [1, 2, 3]
|
||||
2 |-list(list(x))
|
||||
2 |+list(x)
|
||||
3 3 | list(tuple(x))
|
||||
4 4 | tuple(list(x))
|
||||
5 5 | tuple(tuple(x))
|
||||
1 | x = [1, 2, 3]
|
||||
- list(list(x))
|
||||
2 + list(x)
|
||||
3 | list(tuple(x))
|
||||
4 | tuple(list(x))
|
||||
5 | tuple(tuple(x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `tuple()` call within `list()`
|
||||
--> C414.py:3:1
|
||||
|
|
@ -31,15 +30,14 @@ C414 [*] Unnecessary `tuple()` call within `list()`
|
|||
5 | tuple(tuple(x))
|
||||
|
|
||||
help: Remove the inner `tuple()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | x = [1, 2, 3]
|
||||
2 2 | list(list(x))
|
||||
3 |-list(tuple(x))
|
||||
3 |+list(x)
|
||||
4 4 | tuple(list(x))
|
||||
5 5 | tuple(tuple(x))
|
||||
6 6 | set(set(x))
|
||||
1 | x = [1, 2, 3]
|
||||
2 | list(list(x))
|
||||
- list(tuple(x))
|
||||
3 + list(x)
|
||||
4 | tuple(list(x))
|
||||
5 | tuple(tuple(x))
|
||||
6 | set(set(x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `list()` call within `tuple()`
|
||||
--> C414.py:4:1
|
||||
|
|
@ -52,16 +50,15 @@ C414 [*] Unnecessary `list()` call within `tuple()`
|
|||
6 | set(set(x))
|
||||
|
|
||||
help: Remove the inner `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | x = [1, 2, 3]
|
||||
2 2 | list(list(x))
|
||||
3 3 | list(tuple(x))
|
||||
4 |-tuple(list(x))
|
||||
4 |+tuple(x)
|
||||
5 5 | tuple(tuple(x))
|
||||
6 6 | set(set(x))
|
||||
7 7 | set(list(x))
|
||||
1 | x = [1, 2, 3]
|
||||
2 | list(list(x))
|
||||
3 | list(tuple(x))
|
||||
- tuple(list(x))
|
||||
4 + tuple(x)
|
||||
5 | tuple(tuple(x))
|
||||
6 | set(set(x))
|
||||
7 | set(list(x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `tuple()` call within `tuple()`
|
||||
--> C414.py:5:1
|
||||
|
|
@ -74,16 +71,15 @@ C414 [*] Unnecessary `tuple()` call within `tuple()`
|
|||
7 | set(list(x))
|
||||
|
|
||||
help: Remove the inner `tuple()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | list(list(x))
|
||||
3 3 | list(tuple(x))
|
||||
4 4 | tuple(list(x))
|
||||
5 |-tuple(tuple(x))
|
||||
5 |+tuple(x)
|
||||
6 6 | set(set(x))
|
||||
7 7 | set(list(x))
|
||||
8 8 | set(tuple(x))
|
||||
2 | list(list(x))
|
||||
3 | list(tuple(x))
|
||||
4 | tuple(list(x))
|
||||
- tuple(tuple(x))
|
||||
5 + tuple(x)
|
||||
6 | set(set(x))
|
||||
7 | set(list(x))
|
||||
8 | set(tuple(x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `set()` call within `set()`
|
||||
--> C414.py:6:1
|
||||
|
|
@ -96,16 +92,15 @@ C414 [*] Unnecessary `set()` call within `set()`
|
|||
8 | set(tuple(x))
|
||||
|
|
||||
help: Remove the inner `set()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | list(tuple(x))
|
||||
4 4 | tuple(list(x))
|
||||
5 5 | tuple(tuple(x))
|
||||
6 |-set(set(x))
|
||||
6 |+set(x)
|
||||
7 7 | set(list(x))
|
||||
8 8 | set(tuple(x))
|
||||
9 9 | set(sorted(x))
|
||||
3 | list(tuple(x))
|
||||
4 | tuple(list(x))
|
||||
5 | tuple(tuple(x))
|
||||
- set(set(x))
|
||||
6 + set(x)
|
||||
7 | set(list(x))
|
||||
8 | set(tuple(x))
|
||||
9 | set(sorted(x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `list()` call within `set()`
|
||||
--> C414.py:7:1
|
||||
|
|
@ -118,16 +113,15 @@ C414 [*] Unnecessary `list()` call within `set()`
|
|||
9 | set(sorted(x))
|
||||
|
|
||||
help: Remove the inner `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | tuple(list(x))
|
||||
5 5 | tuple(tuple(x))
|
||||
6 6 | set(set(x))
|
||||
7 |-set(list(x))
|
||||
7 |+set(x)
|
||||
8 8 | set(tuple(x))
|
||||
9 9 | set(sorted(x))
|
||||
10 10 | set(sorted(x, key=lambda y: y))
|
||||
4 | tuple(list(x))
|
||||
5 | tuple(tuple(x))
|
||||
6 | set(set(x))
|
||||
- set(list(x))
|
||||
7 + set(x)
|
||||
8 | set(tuple(x))
|
||||
9 | set(sorted(x))
|
||||
10 | set(sorted(x, key=lambda y: y))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `tuple()` call within `set()`
|
||||
--> C414.py:8:1
|
||||
|
|
@ -140,16 +134,15 @@ C414 [*] Unnecessary `tuple()` call within `set()`
|
|||
10 | set(sorted(x, key=lambda y: y))
|
||||
|
|
||||
help: Remove the inner `tuple()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | tuple(tuple(x))
|
||||
6 6 | set(set(x))
|
||||
7 7 | set(list(x))
|
||||
8 |-set(tuple(x))
|
||||
8 |+set(x)
|
||||
9 9 | set(sorted(x))
|
||||
10 10 | set(sorted(x, key=lambda y: y))
|
||||
11 11 | set(reversed(x))
|
||||
5 | tuple(tuple(x))
|
||||
6 | set(set(x))
|
||||
7 | set(list(x))
|
||||
- set(tuple(x))
|
||||
8 + set(x)
|
||||
9 | set(sorted(x))
|
||||
10 | set(sorted(x, key=lambda y: y))
|
||||
11 | set(reversed(x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `sorted()` call within `set()`
|
||||
--> C414.py:9:1
|
||||
|
|
@ -162,16 +155,15 @@ C414 [*] Unnecessary `sorted()` call within `set()`
|
|||
11 | set(reversed(x))
|
||||
|
|
||||
help: Remove the inner `sorted()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 | set(set(x))
|
||||
7 7 | set(list(x))
|
||||
8 8 | set(tuple(x))
|
||||
9 |-set(sorted(x))
|
||||
9 |+set(x)
|
||||
10 10 | set(sorted(x, key=lambda y: y))
|
||||
11 11 | set(reversed(x))
|
||||
12 12 | sorted(list(x))
|
||||
6 | set(set(x))
|
||||
7 | set(list(x))
|
||||
8 | set(tuple(x))
|
||||
- set(sorted(x))
|
||||
9 + set(x)
|
||||
10 | set(sorted(x, key=lambda y: y))
|
||||
11 | set(reversed(x))
|
||||
12 | sorted(list(x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `sorted()` call within `set()`
|
||||
--> C414.py:10:1
|
||||
|
|
@ -184,16 +176,15 @@ C414 [*] Unnecessary `sorted()` call within `set()`
|
|||
12 | sorted(list(x))
|
||||
|
|
||||
help: Remove the inner `sorted()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | set(list(x))
|
||||
8 8 | set(tuple(x))
|
||||
9 9 | set(sorted(x))
|
||||
10 |-set(sorted(x, key=lambda y: y))
|
||||
10 |+set(x)
|
||||
11 11 | set(reversed(x))
|
||||
12 12 | sorted(list(x))
|
||||
13 13 | sorted(tuple(x))
|
||||
7 | set(list(x))
|
||||
8 | set(tuple(x))
|
||||
9 | set(sorted(x))
|
||||
- set(sorted(x, key=lambda y: y))
|
||||
10 + set(x)
|
||||
11 | set(reversed(x))
|
||||
12 | sorted(list(x))
|
||||
13 | sorted(tuple(x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `reversed()` call within `set()`
|
||||
--> C414.py:11:1
|
||||
|
|
@ -206,16 +197,15 @@ C414 [*] Unnecessary `reversed()` call within `set()`
|
|||
13 | sorted(tuple(x))
|
||||
|
|
||||
help: Remove the inner `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | set(tuple(x))
|
||||
9 9 | set(sorted(x))
|
||||
10 10 | set(sorted(x, key=lambda y: y))
|
||||
11 |-set(reversed(x))
|
||||
11 |+set(x)
|
||||
12 12 | sorted(list(x))
|
||||
13 13 | sorted(tuple(x))
|
||||
14 14 | sorted(sorted(x))
|
||||
8 | set(tuple(x))
|
||||
9 | set(sorted(x))
|
||||
10 | set(sorted(x, key=lambda y: y))
|
||||
- set(reversed(x))
|
||||
11 + set(x)
|
||||
12 | sorted(list(x))
|
||||
13 | sorted(tuple(x))
|
||||
14 | sorted(sorted(x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `list()` call within `sorted()`
|
||||
--> C414.py:12:1
|
||||
|
|
@ -228,16 +218,15 @@ C414 [*] Unnecessary `list()` call within `sorted()`
|
|||
14 | sorted(sorted(x))
|
||||
|
|
||||
help: Remove the inner `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | set(sorted(x))
|
||||
10 10 | set(sorted(x, key=lambda y: y))
|
||||
11 11 | set(reversed(x))
|
||||
12 |-sorted(list(x))
|
||||
12 |+sorted(x)
|
||||
13 13 | sorted(tuple(x))
|
||||
14 14 | sorted(sorted(x))
|
||||
15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
9 | set(sorted(x))
|
||||
10 | set(sorted(x, key=lambda y: y))
|
||||
11 | set(reversed(x))
|
||||
- sorted(list(x))
|
||||
12 + sorted(x)
|
||||
13 | sorted(tuple(x))
|
||||
14 | sorted(sorted(x))
|
||||
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `tuple()` call within `sorted()`
|
||||
--> C414.py:13:1
|
||||
|
|
@ -250,16 +239,15 @@ C414 [*] Unnecessary `tuple()` call within `sorted()`
|
|||
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
|
|
||||
help: Remove the inner `tuple()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
10 10 | set(sorted(x, key=lambda y: y))
|
||||
11 11 | set(reversed(x))
|
||||
12 12 | sorted(list(x))
|
||||
13 |-sorted(tuple(x))
|
||||
13 |+sorted(x)
|
||||
14 14 | sorted(sorted(x))
|
||||
15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
16 16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
10 | set(sorted(x, key=lambda y: y))
|
||||
11 | set(reversed(x))
|
||||
12 | sorted(list(x))
|
||||
- sorted(tuple(x))
|
||||
13 + sorted(x)
|
||||
14 | sorted(sorted(x))
|
||||
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `sorted()` call within `sorted()`
|
||||
--> C414.py:14:1
|
||||
|
|
@ -272,16 +260,15 @@ C414 [*] Unnecessary `sorted()` call within `sorted()`
|
|||
16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
|
|
||||
help: Remove the inner `sorted()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
11 11 | set(reversed(x))
|
||||
12 12 | sorted(list(x))
|
||||
13 13 | sorted(tuple(x))
|
||||
14 |-sorted(sorted(x))
|
||||
14 |+sorted(x)
|
||||
15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
16 16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
17 17 | sorted(reversed(x))
|
||||
11 | set(reversed(x))
|
||||
12 | sorted(list(x))
|
||||
13 | sorted(tuple(x))
|
||||
- sorted(sorted(x))
|
||||
14 + sorted(x)
|
||||
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
17 | sorted(reversed(x))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `sorted()` call within `sorted()`
|
||||
--> C414.py:15:1
|
||||
|
|
@ -294,16 +281,15 @@ C414 [*] Unnecessary `sorted()` call within `sorted()`
|
|||
17 | sorted(reversed(x))
|
||||
|
|
||||
help: Remove the inner `sorted()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | sorted(list(x))
|
||||
13 13 | sorted(tuple(x))
|
||||
14 14 | sorted(sorted(x))
|
||||
15 |-sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
15 |+sorted(x, reverse=False, key=foo)
|
||||
16 16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
17 17 | sorted(reversed(x))
|
||||
18 18 | sorted(list(x), key=lambda y: y)
|
||||
12 | sorted(list(x))
|
||||
13 | sorted(tuple(x))
|
||||
14 | sorted(sorted(x))
|
||||
- sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
15 + sorted(x, reverse=False, key=foo)
|
||||
16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
17 | sorted(reversed(x))
|
||||
18 | sorted(list(x), key=lambda y: y)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `sorted()` call within `sorted()`
|
||||
--> C414.py:16:1
|
||||
|
|
@ -316,16 +302,15 @@ C414 [*] Unnecessary `sorted()` call within `sorted()`
|
|||
18 | sorted(list(x), key=lambda y: y)
|
||||
|
|
||||
help: Remove the inner `sorted()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 | sorted(tuple(x))
|
||||
14 14 | sorted(sorted(x))
|
||||
15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
16 |-sorted(sorted(x, reverse=True), reverse=True)
|
||||
16 |+sorted(x, reverse=True)
|
||||
17 17 | sorted(reversed(x))
|
||||
18 18 | sorted(list(x), key=lambda y: y)
|
||||
19 19 | tuple(
|
||||
13 | sorted(tuple(x))
|
||||
14 | sorted(sorted(x))
|
||||
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
- sorted(sorted(x, reverse=True), reverse=True)
|
||||
16 + sorted(x, reverse=True)
|
||||
17 | sorted(reversed(x))
|
||||
18 | sorted(list(x), key=lambda y: y)
|
||||
19 | tuple(
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `reversed()` call within `sorted()`
|
||||
--> C414.py:17:1
|
||||
|
|
@ -338,16 +323,15 @@ C414 [*] Unnecessary `reversed()` call within `sorted()`
|
|||
19 | tuple(
|
||||
|
|
||||
help: Remove the inner `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 | sorted(sorted(x))
|
||||
15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
16 16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
17 |-sorted(reversed(x))
|
||||
17 |+sorted(x)
|
||||
18 18 | sorted(list(x), key=lambda y: y)
|
||||
19 19 | tuple(
|
||||
20 20 | list(
|
||||
14 | sorted(sorted(x))
|
||||
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
- sorted(reversed(x))
|
||||
17 + sorted(x)
|
||||
18 | sorted(list(x), key=lambda y: y)
|
||||
19 | tuple(
|
||||
20 | list(
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `list()` call within `sorted()`
|
||||
--> C414.py:18:1
|
||||
|
|
@ -360,16 +344,15 @@ C414 [*] Unnecessary `list()` call within `sorted()`
|
|||
20 | list(
|
||||
|
|
||||
help: Remove the inner `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
16 16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
17 17 | sorted(reversed(x))
|
||||
18 |-sorted(list(x), key=lambda y: y)
|
||||
18 |+sorted(x, key=lambda y: y)
|
||||
19 19 | tuple(
|
||||
20 20 | list(
|
||||
21 21 | [x, 3, "hell"\
|
||||
15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo)
|
||||
16 | sorted(sorted(x, reverse=True), reverse=True)
|
||||
17 | sorted(reversed(x))
|
||||
- sorted(list(x), key=lambda y: y)
|
||||
18 + sorted(x, key=lambda y: y)
|
||||
19 | tuple(
|
||||
20 | list(
|
||||
21 | [x, 3, "hell"\
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `list()` call within `tuple()`
|
||||
--> C414.py:19:1
|
||||
|
|
@ -387,19 +370,18 @@ C414 [*] Unnecessary `list()` call within `tuple()`
|
|||
26 | set(list())
|
||||
|
|
||||
help: Remove the inner `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 | sorted(reversed(x))
|
||||
18 18 | sorted(list(x), key=lambda y: y)
|
||||
19 19 | tuple(
|
||||
20 |- list(
|
||||
21 |- [x, 3, "hell"\
|
||||
20 |+ [x, 3, "hell"\
|
||||
22 21 | "o"]
|
||||
23 |- )
|
||||
24 22 | )
|
||||
25 23 | set(set())
|
||||
26 24 | set(list())
|
||||
17 | sorted(reversed(x))
|
||||
18 | sorted(list(x), key=lambda y: y)
|
||||
19 | tuple(
|
||||
- list(
|
||||
- [x, 3, "hell"\
|
||||
20 + [x, 3, "hell"\
|
||||
21 | "o"]
|
||||
- )
|
||||
22 | )
|
||||
23 | set(set())
|
||||
24 | set(list())
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `set()` call within `set()`
|
||||
--> C414.py:25:1
|
||||
|
|
@ -412,16 +394,15 @@ C414 [*] Unnecessary `set()` call within `set()`
|
|||
27 | set(tuple())
|
||||
|
|
||||
help: Remove the inner `set()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 | "o"]
|
||||
23 23 | )
|
||||
24 24 | )
|
||||
25 |-set(set())
|
||||
25 |+set()
|
||||
26 26 | set(list())
|
||||
27 27 | set(tuple())
|
||||
28 28 | sorted(reversed())
|
||||
22 | "o"]
|
||||
23 | )
|
||||
24 | )
|
||||
- set(set())
|
||||
25 + set()
|
||||
26 | set(list())
|
||||
27 | set(tuple())
|
||||
28 | sorted(reversed())
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `list()` call within `set()`
|
||||
--> C414.py:26:1
|
||||
|
|
@ -434,16 +415,15 @@ C414 [*] Unnecessary `list()` call within `set()`
|
|||
28 | sorted(reversed())
|
||||
|
|
||||
help: Remove the inner `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
23 23 | )
|
||||
24 24 | )
|
||||
25 25 | set(set())
|
||||
26 |-set(list())
|
||||
26 |+set()
|
||||
27 27 | set(tuple())
|
||||
28 28 | sorted(reversed())
|
||||
29 29 |
|
||||
23 | )
|
||||
24 | )
|
||||
25 | set(set())
|
||||
- set(list())
|
||||
26 + set()
|
||||
27 | set(tuple())
|
||||
28 | sorted(reversed())
|
||||
29 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `tuple()` call within `set()`
|
||||
--> C414.py:27:1
|
||||
|
|
@ -455,16 +435,15 @@ C414 [*] Unnecessary `tuple()` call within `set()`
|
|||
28 | sorted(reversed())
|
||||
|
|
||||
help: Remove the inner `tuple()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
24 24 | )
|
||||
25 25 | set(set())
|
||||
26 26 | set(list())
|
||||
27 |-set(tuple())
|
||||
27 |+set()
|
||||
28 28 | sorted(reversed())
|
||||
29 29 |
|
||||
30 30 | # Nested sorts with differing keyword arguments. Not flagged.
|
||||
24 | )
|
||||
25 | set(set())
|
||||
26 | set(list())
|
||||
- set(tuple())
|
||||
27 + set()
|
||||
28 | sorted(reversed())
|
||||
29 |
|
||||
30 | # Nested sorts with differing keyword arguments. Not flagged.
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `reversed()` call within `sorted()`
|
||||
--> C414.py:28:1
|
||||
|
|
@ -477,16 +456,15 @@ C414 [*] Unnecessary `reversed()` call within `sorted()`
|
|||
30 | # Nested sorts with differing keyword arguments. Not flagged.
|
||||
|
|
||||
help: Remove the inner `reversed()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
25 25 | set(set())
|
||||
26 26 | set(list())
|
||||
27 27 | set(tuple())
|
||||
28 |-sorted(reversed())
|
||||
28 |+sorted()
|
||||
29 29 |
|
||||
30 30 | # Nested sorts with differing keyword arguments. Not flagged.
|
||||
31 31 | sorted(sorted(x, key=lambda y: y))
|
||||
25 | set(set())
|
||||
26 | set(list())
|
||||
27 | set(tuple())
|
||||
- sorted(reversed())
|
||||
28 + sorted()
|
||||
29 |
|
||||
30 | # Nested sorts with differing keyword arguments. Not flagged.
|
||||
31 | sorted(sorted(x, key=lambda y: y))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `list()` call within `sorted()`
|
||||
--> C414.py:37:27
|
||||
|
|
@ -504,16 +482,15 @@ C414 [*] Unnecessary `list()` call within `sorted()`
|
|||
44 | xxxxxxxxxxx_xxxxx_xxxxx = sorted(
|
||||
|
|
||||
help: Remove the inner `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
35 35 |
|
||||
36 36 | # Preserve trailing comments.
|
||||
37 37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted(
|
||||
38 |- list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()),
|
||||
38 |+ x_xxxx_xxxxxxxxxxx_xxxxx.xxxx(),
|
||||
39 39 | # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx, xxx xxxxxx3 xxxxxxxxx xx
|
||||
40 40 | # xx xxxx xxxxxxx xxxx xxx xxxxxxxx Nxxx
|
||||
41 41 | key=lambda xxxxx: xxxxx or "",
|
||||
35 |
|
||||
36 | # Preserve trailing comments.
|
||||
37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted(
|
||||
- list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()),
|
||||
38 + x_xxxx_xxxxxxxxxxx_xxxxx.xxxx(),
|
||||
39 | # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx, xxx xxxxxx3 xxxxxxxxx xx
|
||||
40 | # xx xxxx xxxxxxx xxxx xxx xxxxxxxx Nxxx
|
||||
41 | key=lambda xxxxx: xxxxx or "",
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C414 [*] Unnecessary `list()` call within `sorted()`
|
||||
--> C414.py:44:27
|
||||
|
|
@ -528,12 +505,11 @@ C414 [*] Unnecessary `list()` call within `sorted()`
|
|||
| |_^
|
||||
|
|
||||
help: Remove the inner `list()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
42 42 | )
|
||||
43 43 |
|
||||
44 44 | xxxxxxxxxxx_xxxxx_xxxxx = sorted(
|
||||
45 |- list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()), # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx
|
||||
45 |+ x_xxxx_xxxxxxxxxxx_xxxxx.xxxx(), # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx
|
||||
46 46 | key=lambda xxxxx: xxxxx or "",
|
||||
47 47 | )
|
||||
42 | )
|
||||
43 |
|
||||
44 | xxxxxxxxxxx_xxxxx_xxxxx = sorted(
|
||||
- list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()), # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx
|
||||
45 + x_xxxx_xxxxxxxxxxx_xxxxx.xxxx(), # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx
|
||||
46 | key=lambda xxxxx: xxxxx or "",
|
||||
47 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,16 +12,15 @@ C416 [*] Unnecessary list comprehension (rewrite using `list()`)
|
|||
8 | {k: v for k, v in y}
|
||||
|
|
||||
help: Rewrite using `list()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | z = [(1,), (2,), (3,)]
|
||||
4 4 | d = {"a": 1, "b": 2, "c": 3}
|
||||
5 5 |
|
||||
6 |-[i for i in x]
|
||||
6 |+list(x)
|
||||
7 7 | {i for i in x}
|
||||
8 8 | {k: v for k, v in y}
|
||||
9 9 | {k: v for k, v in d.items()}
|
||||
3 | z = [(1,), (2,), (3,)]
|
||||
4 | d = {"a": 1, "b": 2, "c": 3}
|
||||
5 |
|
||||
- [i for i in x]
|
||||
6 + list(x)
|
||||
7 | {i for i in x}
|
||||
8 | {k: v for k, v in y}
|
||||
9 | {k: v for k, v in d.items()}
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C416 [*] Unnecessary set comprehension (rewrite using `set()`)
|
||||
--> C416.py:7:1
|
||||
|
|
@ -33,16 +32,15 @@ C416 [*] Unnecessary set comprehension (rewrite using `set()`)
|
|||
9 | {k: v for k, v in d.items()}
|
||||
|
|
||||
help: Rewrite using `set()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | d = {"a": 1, "b": 2, "c": 3}
|
||||
5 5 |
|
||||
6 6 | [i for i in x]
|
||||
7 |-{i for i in x}
|
||||
7 |+set(x)
|
||||
8 8 | {k: v for k, v in y}
|
||||
9 9 | {k: v for k, v in d.items()}
|
||||
10 10 | [(k, v) for k, v in d.items()]
|
||||
4 | d = {"a": 1, "b": 2, "c": 3}
|
||||
5 |
|
||||
6 | [i for i in x]
|
||||
- {i for i in x}
|
||||
7 + set(x)
|
||||
8 | {k: v for k, v in y}
|
||||
9 | {k: v for k, v in d.items()}
|
||||
10 | [(k, v) for k, v in d.items()]
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C416 [*] Unnecessary dict comprehension (rewrite using `dict()`)
|
||||
--> C416.py:8:1
|
||||
|
|
@ -55,16 +53,15 @@ C416 [*] Unnecessary dict comprehension (rewrite using `dict()`)
|
|||
10 | [(k, v) for k, v in d.items()]
|
||||
|
|
||||
help: Rewrite using `dict()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 |
|
||||
6 6 | [i for i in x]
|
||||
7 7 | {i for i in x}
|
||||
8 |-{k: v for k, v in y}
|
||||
8 |+dict(y)
|
||||
9 9 | {k: v for k, v in d.items()}
|
||||
10 10 | [(k, v) for k, v in d.items()]
|
||||
11 11 | [(k, v) for [k, v] in d.items()]
|
||||
5 |
|
||||
6 | [i for i in x]
|
||||
7 | {i for i in x}
|
||||
- {k: v for k, v in y}
|
||||
8 + dict(y)
|
||||
9 | {k: v for k, v in d.items()}
|
||||
10 | [(k, v) for k, v in d.items()]
|
||||
11 | [(k, v) for [k, v] in d.items()]
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C416 [*] Unnecessary dict comprehension (rewrite using `dict()`)
|
||||
--> C416.py:9:1
|
||||
|
|
@ -77,16 +74,15 @@ C416 [*] Unnecessary dict comprehension (rewrite using `dict()`)
|
|||
11 | [(k, v) for [k, v] in d.items()]
|
||||
|
|
||||
help: Rewrite using `dict()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 | [i for i in x]
|
||||
7 7 | {i for i in x}
|
||||
8 8 | {k: v for k, v in y}
|
||||
9 |-{k: v for k, v in d.items()}
|
||||
9 |+dict(d.items())
|
||||
10 10 | [(k, v) for k, v in d.items()]
|
||||
11 11 | [(k, v) for [k, v] in d.items()]
|
||||
12 12 | {k: (a, b) for k, (a, b) in d.items()}
|
||||
6 | [i for i in x]
|
||||
7 | {i for i in x}
|
||||
8 | {k: v for k, v in y}
|
||||
- {k: v for k, v in d.items()}
|
||||
9 + dict(d.items())
|
||||
10 | [(k, v) for k, v in d.items()]
|
||||
11 | [(k, v) for [k, v] in d.items()]
|
||||
12 | {k: (a, b) for k, (a, b) in d.items()}
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C416 [*] Unnecessary list comprehension (rewrite using `list()`)
|
||||
--> C416.py:10:1
|
||||
|
|
@ -99,16 +95,15 @@ C416 [*] Unnecessary list comprehension (rewrite using `list()`)
|
|||
12 | {k: (a, b) for k, (a, b) in d.items()}
|
||||
|
|
||||
help: Rewrite using `list()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | {i for i in x}
|
||||
8 8 | {k: v for k, v in y}
|
||||
9 9 | {k: v for k, v in d.items()}
|
||||
10 |-[(k, v) for k, v in d.items()]
|
||||
10 |+list(d.items())
|
||||
11 11 | [(k, v) for [k, v] in d.items()]
|
||||
12 12 | {k: (a, b) for k, (a, b) in d.items()}
|
||||
13 13 |
|
||||
7 | {i for i in x}
|
||||
8 | {k: v for k, v in y}
|
||||
9 | {k: v for k, v in d.items()}
|
||||
- [(k, v) for k, v in d.items()]
|
||||
10 + list(d.items())
|
||||
11 | [(k, v) for [k, v] in d.items()]
|
||||
12 | {k: (a, b) for k, (a, b) in d.items()}
|
||||
13 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C416 [*] Unnecessary list comprehension (rewrite using `list()`)
|
||||
--> C416.py:11:1
|
||||
|
|
@ -120,16 +115,15 @@ C416 [*] Unnecessary list comprehension (rewrite using `list()`)
|
|||
12 | {k: (a, b) for k, (a, b) in d.items()}
|
||||
|
|
||||
help: Rewrite using `list()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | {k: v for k, v in y}
|
||||
9 9 | {k: v for k, v in d.items()}
|
||||
10 10 | [(k, v) for k, v in d.items()]
|
||||
11 |-[(k, v) for [k, v] in d.items()]
|
||||
11 |+list(d.items())
|
||||
12 12 | {k: (a, b) for k, (a, b) in d.items()}
|
||||
13 13 |
|
||||
14 14 | [i for i, in z]
|
||||
8 | {k: v for k, v in y}
|
||||
9 | {k: v for k, v in d.items()}
|
||||
10 | [(k, v) for k, v in d.items()]
|
||||
- [(k, v) for [k, v] in d.items()]
|
||||
11 + list(d.items())
|
||||
12 | {k: (a, b) for k, (a, b) in d.items()}
|
||||
13 |
|
||||
14 | [i for i, in z]
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C416 [*] Unnecessary list comprehension (rewrite using `list()`)
|
||||
--> C416.py:25:70
|
||||
|
|
@ -141,13 +135,12 @@ C416 [*] Unnecessary list comprehension (rewrite using `list()`)
|
|||
27 | zz = [[1], [2], [3]]
|
||||
|
|
||||
help: Rewrite using `list()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 | {k: v if v else None for k, v in y}
|
||||
23 23 |
|
||||
24 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196
|
||||
25 |-any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in[t for t in SymbolType])
|
||||
25 |+any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in list(SymbolType))
|
||||
26 26 |
|
||||
27 27 | zz = [[1], [2], [3]]
|
||||
28 28 | [(i,) for (i,) in zz] # != list(zz)
|
||||
22 | {k: v if v else None for k, v in y}
|
||||
23 |
|
||||
24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196
|
||||
- any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in[t for t in SymbolType])
|
||||
25 + any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in list(SymbolType))
|
||||
26 |
|
||||
27 | zz = [[1], [2], [3]]
|
||||
28 | [(i,) for (i,) in zz] # != list(zz)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -12,15 +12,14 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
5 | list(map(lambda x: x * 2, nums))
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Errors.
|
||||
2 2 | nums = [1, 2, 3]
|
||||
3 |-map(lambda x: x + 1, nums)
|
||||
3 |+(x + 1 for x in nums)
|
||||
4 4 | map(lambda x: str(x), nums)
|
||||
5 5 | list(map(lambda x: x * 2, nums))
|
||||
6 6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
1 | # Errors.
|
||||
2 | nums = [1, 2, 3]
|
||||
- map(lambda x: x + 1, nums)
|
||||
3 + (x + 1 for x in nums)
|
||||
4 | map(lambda x: str(x), nums)
|
||||
5 | list(map(lambda x: x * 2, nums))
|
||||
6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
||||
--> C417.py:4:1
|
||||
|
|
@ -33,16 +32,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | # Errors.
|
||||
2 2 | nums = [1, 2, 3]
|
||||
3 3 | map(lambda x: x + 1, nums)
|
||||
4 |-map(lambda x: str(x), nums)
|
||||
4 |+(str(x) for x in nums)
|
||||
5 5 | list(map(lambda x: x * 2, nums))
|
||||
6 6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
7 7 | dict(map(lambda v: (v, v**2), nums))
|
||||
1 | # Errors.
|
||||
2 | nums = [1, 2, 3]
|
||||
3 | map(lambda x: x + 1, nums)
|
||||
- map(lambda x: str(x), nums)
|
||||
4 + (str(x) for x in nums)
|
||||
5 | list(map(lambda x: x * 2, nums))
|
||||
6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
7 | dict(map(lambda v: (v, v**2), nums))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a list comprehension)
|
||||
--> C417.py:5:1
|
||||
|
|
@ -55,16 +53,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a list comprehension)
|
|||
7 | dict(map(lambda v: (v, v**2), nums))
|
||||
|
|
||||
help: Replace `map()` with a list comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 | nums = [1, 2, 3]
|
||||
3 3 | map(lambda x: x + 1, nums)
|
||||
4 4 | map(lambda x: str(x), nums)
|
||||
5 |-list(map(lambda x: x * 2, nums))
|
||||
5 |+[x * 2 for x in nums]
|
||||
6 6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
7 7 | dict(map(lambda v: (v, v**2), nums))
|
||||
8 8 | dict(map(lambda v: [v, v**2], nums))
|
||||
2 | nums = [1, 2, 3]
|
||||
3 | map(lambda x: x + 1, nums)
|
||||
4 | map(lambda x: str(x), nums)
|
||||
- list(map(lambda x: x * 2, nums))
|
||||
5 + [x * 2 for x in nums]
|
||||
6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
7 | dict(map(lambda v: (v, v**2), nums))
|
||||
8 | dict(map(lambda v: [v, v**2], nums))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a set comprehension)
|
||||
--> C417.py:6:1
|
||||
|
|
@ -77,16 +74,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a set comprehension)
|
|||
8 | dict(map(lambda v: [v, v**2], nums))
|
||||
|
|
||||
help: Replace `map()` with a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | map(lambda x: x + 1, nums)
|
||||
4 4 | map(lambda x: str(x), nums)
|
||||
5 5 | list(map(lambda x: x * 2, nums))
|
||||
6 |-set(map(lambda x: x % 2 == 0, nums))
|
||||
6 |+{x % 2 == 0 for x in nums}
|
||||
7 7 | dict(map(lambda v: (v, v**2), nums))
|
||||
8 8 | dict(map(lambda v: [v, v**2], nums))
|
||||
9 9 |
|
||||
3 | map(lambda x: x + 1, nums)
|
||||
4 | map(lambda x: str(x), nums)
|
||||
5 | list(map(lambda x: x * 2, nums))
|
||||
- set(map(lambda x: x % 2 == 0, nums))
|
||||
6 + {x % 2 == 0 for x in nums}
|
||||
7 | dict(map(lambda v: (v, v**2), nums))
|
||||
8 | dict(map(lambda v: [v, v**2], nums))
|
||||
9 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a dict comprehension)
|
||||
--> C417.py:7:1
|
||||
|
|
@ -98,16 +94,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a dict comprehension)
|
|||
8 | dict(map(lambda v: [v, v**2], nums))
|
||||
|
|
||||
help: Replace `map()` with a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | map(lambda x: str(x), nums)
|
||||
5 5 | list(map(lambda x: x * 2, nums))
|
||||
6 6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
7 |-dict(map(lambda v: (v, v**2), nums))
|
||||
7 |+{v: v**2 for v in nums}
|
||||
8 8 | dict(map(lambda v: [v, v**2], nums))
|
||||
9 9 |
|
||||
10 10 | map(lambda _: 3.0, nums)
|
||||
4 | map(lambda x: str(x), nums)
|
||||
5 | list(map(lambda x: x * 2, nums))
|
||||
6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
- dict(map(lambda v: (v, v**2), nums))
|
||||
7 + {v: v**2 for v in nums}
|
||||
8 | dict(map(lambda v: [v, v**2], nums))
|
||||
9 |
|
||||
10 | map(lambda _: 3.0, nums)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a dict comprehension)
|
||||
--> C417.py:8:1
|
||||
|
|
@ -120,16 +115,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a dict comprehension)
|
|||
10 | map(lambda _: 3.0, nums)
|
||||
|
|
||||
help: Replace `map()` with a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | list(map(lambda x: x * 2, nums))
|
||||
6 6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
7 7 | dict(map(lambda v: (v, v**2), nums))
|
||||
8 |-dict(map(lambda v: [v, v**2], nums))
|
||||
8 |+{v: v**2 for v in nums}
|
||||
9 9 |
|
||||
10 10 | map(lambda _: 3.0, nums)
|
||||
11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
|
||||
5 | list(map(lambda x: x * 2, nums))
|
||||
6 | set(map(lambda x: x % 2 == 0, nums))
|
||||
7 | dict(map(lambda v: (v, v**2), nums))
|
||||
- dict(map(lambda v: [v, v**2], nums))
|
||||
8 + {v: v**2 for v in nums}
|
||||
9 |
|
||||
10 | map(lambda _: 3.0, nums)
|
||||
11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
||||
--> C417.py:10:1
|
||||
|
|
@ -142,16 +136,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
12 | all(map(lambda v: isinstance(v, dict), nums))
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | dict(map(lambda v: (v, v**2), nums))
|
||||
8 8 | dict(map(lambda v: [v, v**2], nums))
|
||||
9 9 |
|
||||
10 |-map(lambda _: 3.0, nums)
|
||||
10 |+(3.0 for _ in nums)
|
||||
11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
|
||||
12 12 | all(map(lambda v: isinstance(v, dict), nums))
|
||||
13 13 | filter(func, map(lambda v: v, nums))
|
||||
7 | dict(map(lambda v: (v, v**2), nums))
|
||||
8 | dict(map(lambda v: [v, v**2], nums))
|
||||
9 |
|
||||
- map(lambda _: 3.0, nums)
|
||||
10 + (3.0 for _ in nums)
|
||||
11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
|
||||
12 | all(map(lambda v: isinstance(v, dict), nums))
|
||||
13 | filter(func, map(lambda v: v, nums))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
||||
--> C417.py:11:13
|
||||
|
|
@ -163,16 +156,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
13 | filter(func, map(lambda v: v, nums))
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | dict(map(lambda v: [v, v**2], nums))
|
||||
9 9 |
|
||||
10 10 | map(lambda _: 3.0, nums)
|
||||
11 |-_ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
|
||||
11 |+_ = "".join((x in nums and "1" or "0" for x in range(123)))
|
||||
12 12 | all(map(lambda v: isinstance(v, dict), nums))
|
||||
13 13 | filter(func, map(lambda v: v, nums))
|
||||
14 14 |
|
||||
8 | dict(map(lambda v: [v, v**2], nums))
|
||||
9 |
|
||||
10 | map(lambda _: 3.0, nums)
|
||||
- _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
|
||||
11 + _ = "".join((x in nums and "1" or "0" for x in range(123)))
|
||||
12 | all(map(lambda v: isinstance(v, dict), nums))
|
||||
13 | filter(func, map(lambda v: v, nums))
|
||||
14 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
||||
--> C417.py:12:5
|
||||
|
|
@ -184,16 +176,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
13 | filter(func, map(lambda v: v, nums))
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 |
|
||||
10 10 | map(lambda _: 3.0, nums)
|
||||
11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
|
||||
12 |-all(map(lambda v: isinstance(v, dict), nums))
|
||||
12 |+all((isinstance(v, dict) for v in nums))
|
||||
13 13 | filter(func, map(lambda v: v, nums))
|
||||
14 14 |
|
||||
15 15 |
|
||||
9 |
|
||||
10 | map(lambda _: 3.0, nums)
|
||||
11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
|
||||
- all(map(lambda v: isinstance(v, dict), nums))
|
||||
12 + all((isinstance(v, dict) for v in nums))
|
||||
13 | filter(func, map(lambda v: v, nums))
|
||||
14 |
|
||||
15 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
||||
--> C417.py:13:14
|
||||
|
|
@ -204,16 +195,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
10 10 | map(lambda _: 3.0, nums)
|
||||
11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
|
||||
12 12 | all(map(lambda v: isinstance(v, dict), nums))
|
||||
13 |-filter(func, map(lambda v: v, nums))
|
||||
13 |+filter(func, (v for v in nums))
|
||||
14 14 |
|
||||
15 15 |
|
||||
16 16 | # When inside f-string, then the fix should be surrounded by whitespace
|
||||
10 | map(lambda _: 3.0, nums)
|
||||
11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123)))
|
||||
12 | all(map(lambda v: isinstance(v, dict), nums))
|
||||
- filter(func, map(lambda v: v, nums))
|
||||
13 + filter(func, (v for v in nums))
|
||||
14 |
|
||||
15 |
|
||||
16 | # When inside f-string, then the fix should be surrounded by whitespace
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a set comprehension)
|
||||
--> C417.py:17:8
|
||||
|
|
@ -224,16 +214,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a set comprehension)
|
|||
18 | _ = f"{dict(map(lambda v: (v, v**2), nums))}"
|
||||
|
|
||||
help: Replace `map()` with a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 |
|
||||
15 15 |
|
||||
16 16 | # When inside f-string, then the fix should be surrounded by whitespace
|
||||
17 |-_ = f"{set(map(lambda x: x % 2 == 0, nums))}"
|
||||
17 |+_ = f"{ {x % 2 == 0 for x in nums} }"
|
||||
18 18 | _ = f"{dict(map(lambda v: (v, v**2), nums))}"
|
||||
19 19 |
|
||||
20 20 | # False negatives.
|
||||
14 |
|
||||
15 |
|
||||
16 | # When inside f-string, then the fix should be surrounded by whitespace
|
||||
- _ = f"{set(map(lambda x: x % 2 == 0, nums))}"
|
||||
17 + _ = f"{ {x % 2 == 0 for x in nums} }"
|
||||
18 | _ = f"{dict(map(lambda v: (v, v**2), nums))}"
|
||||
19 |
|
||||
20 | # False negatives.
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a dict comprehension)
|
||||
--> C417.py:18:8
|
||||
|
|
@ -246,16 +235,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a dict comprehension)
|
|||
20 | # False negatives.
|
||||
|
|
||||
help: Replace `map()` with a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
15 15 |
|
||||
16 16 | # When inside f-string, then the fix should be surrounded by whitespace
|
||||
17 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}"
|
||||
18 |-_ = f"{dict(map(lambda v: (v, v**2), nums))}"
|
||||
18 |+_ = f"{ {v: v**2 for v in nums} }"
|
||||
19 19 |
|
||||
20 20 | # False negatives.
|
||||
21 21 | map(lambda x=2, y=1: x + y, nums, nums)
|
||||
15 |
|
||||
16 | # When inside f-string, then the fix should be surrounded by whitespace
|
||||
17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}"
|
||||
- _ = f"{dict(map(lambda v: (v, v**2), nums))}"
|
||||
18 + _ = f"{ {v: v**2 for v in nums} }"
|
||||
19 |
|
||||
20 | # False negatives.
|
||||
21 | map(lambda x=2, y=1: x + y, nums, nums)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
||||
--> C417.py:36:1
|
||||
|
|
@ -267,16 +255,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
38 | # Ok because of the default parameters, and variadic arguments.
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
33 33 | map(lambda x: lambda: x, range(4))
|
||||
34 34 |
|
||||
35 35 | # Error: the `x` is overridden by the inner lambda.
|
||||
36 |-map(lambda x: lambda x: x, range(4))
|
||||
36 |+(lambda x: x for x in range(4))
|
||||
37 37 |
|
||||
38 38 | # Ok because of the default parameters, and variadic arguments.
|
||||
39 39 | map(lambda x=1: x, nums)
|
||||
33 | map(lambda x: lambda: x, range(4))
|
||||
34 |
|
||||
35 | # Error: the `x` is overridden by the inner lambda.
|
||||
- map(lambda x: lambda x: x, range(4))
|
||||
36 + (lambda x: x for x in range(4))
|
||||
37 |
|
||||
38 | # Ok because of the default parameters, and variadic arguments.
|
||||
39 | map(lambda x=1: x, nums)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
||||
--> C417.py:47:1
|
||||
|
|
@ -288,16 +275,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
49 | map(lambda x: x, (x, y, z))
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
44 44 | dict(map(lambda k, v: (k, v), keys, values))
|
||||
45 45 |
|
||||
46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121
|
||||
47 |-map(lambda x: x, y if y else z)
|
||||
47 |+(x for x in (y if y else z))
|
||||
48 48 | map(lambda x: x, (y if y else z))
|
||||
49 49 | map(lambda x: x, (x, y, z))
|
||||
50 50 |
|
||||
44 | dict(map(lambda k, v: (k, v), keys, values))
|
||||
45 |
|
||||
46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121
|
||||
- map(lambda x: x, y if y else z)
|
||||
47 + (x for x in (y if y else z))
|
||||
48 | map(lambda x: x, (y if y else z))
|
||||
49 | map(lambda x: x, (x, y, z))
|
||||
50 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
||||
--> C417.py:48:1
|
||||
|
|
@ -309,16 +295,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
49 | map(lambda x: x, (x, y, z))
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
45 45 |
|
||||
46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121
|
||||
47 47 | map(lambda x: x, y if y else z)
|
||||
48 |-map(lambda x: x, (y if y else z))
|
||||
48 |+(x for x in (y if y else z))
|
||||
49 49 | map(lambda x: x, (x, y, z))
|
||||
50 50 |
|
||||
51 51 | # See https://github.com/astral-sh/ruff/issues/14808
|
||||
45 |
|
||||
46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121
|
||||
47 | map(lambda x: x, y if y else z)
|
||||
- map(lambda x: x, (y if y else z))
|
||||
48 + (x for x in (y if y else z))
|
||||
49 | map(lambda x: x, (x, y, z))
|
||||
50 |
|
||||
51 | # See https://github.com/astral-sh/ruff/issues/14808
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
||||
--> C417.py:49:1
|
||||
|
|
@ -331,16 +316,15 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
51 | # See https://github.com/astral-sh/ruff/issues/14808
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121
|
||||
47 47 | map(lambda x: x, y if y else z)
|
||||
48 48 | map(lambda x: x, (y if y else z))
|
||||
49 |-map(lambda x: x, (x, y, z))
|
||||
49 |+(x for x in (x, y, z))
|
||||
50 50 |
|
||||
51 51 | # See https://github.com/astral-sh/ruff/issues/14808
|
||||
52 52 | # The following should be Ok since
|
||||
46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121
|
||||
47 | map(lambda x: x, y if y else z)
|
||||
48 | map(lambda x: x, (y if y else z))
|
||||
- map(lambda x: x, (x, y, z))
|
||||
49 + (x for x in (x, y, z))
|
||||
50 |
|
||||
51 | # See https://github.com/astral-sh/ruff/issues/14808
|
||||
52 | # The following should be Ok since
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a set comprehension)
|
||||
--> C417.py:75:8
|
||||
|
|
@ -351,15 +335,14 @@ C417 [*] Unnecessary `map()` usage (rewrite using a set comprehension)
|
|||
76 | _ = t"{dict(map(lambda v: (v, v**2), nums))}"
|
||||
|
|
||||
help: Replace `map()` with a set comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
72 72 | list(map(lambda x, y: x, [(1, 2), (3, 4)]))
|
||||
73 73 |
|
||||
74 74 | # When inside t-string, then the fix should be surrounded by whitespace
|
||||
75 |-_ = t"{set(map(lambda x: x % 2 == 0, nums))}"
|
||||
75 |+_ = t"{ {x % 2 == 0 for x in nums} }"
|
||||
76 76 | _ = t"{dict(map(lambda v: (v, v**2), nums))}"
|
||||
77 77 |
|
||||
72 | list(map(lambda x, y: x, [(1, 2), (3, 4)]))
|
||||
73 |
|
||||
74 | # When inside t-string, then the fix should be surrounded by whitespace
|
||||
- _ = t"{set(map(lambda x: x % 2 == 0, nums))}"
|
||||
75 + _ = t"{ {x % 2 == 0 for x in nums} }"
|
||||
76 | _ = t"{dict(map(lambda v: (v, v**2), nums))}"
|
||||
77 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C417 [*] Unnecessary `map()` usage (rewrite using a dict comprehension)
|
||||
--> C417.py:76:8
|
||||
|
|
@ -370,11 +353,10 @@ C417 [*] Unnecessary `map()` usage (rewrite using a dict comprehension)
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace `map()` with a dict comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
73 73 |
|
||||
74 74 | # When inside t-string, then the fix should be surrounded by whitespace
|
||||
75 75 | _ = t"{set(map(lambda x: x % 2 == 0, nums))}"
|
||||
76 |-_ = t"{dict(map(lambda v: (v, v**2), nums))}"
|
||||
76 |+_ = t"{ {v: v**2 for v in nums} }"
|
||||
77 77 |
|
||||
73 |
|
||||
74 | # When inside t-string, then the fix should be surrounded by whitespace
|
||||
75 | _ = t"{set(map(lambda x: x % 2 == 0, nums))}"
|
||||
- _ = t"{dict(map(lambda v: (v, v**2), nums))}"
|
||||
76 + _ = t"{ {v: v**2 for v in nums} }"
|
||||
77 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C417 [*] Unnecessary `map()` usage (rewrite using a generator expression)
|
|||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace `map()` with a generator expression
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 |
|
||||
5 5 | def overshadowed_list():
|
||||
6 6 | list = ...
|
||||
7 |- list(map(lambda x: x, []))
|
||||
7 |+ list((x for x in []))
|
||||
8 8 |
|
||||
9 9 |
|
||||
10 10 | ### No errors
|
||||
4 |
|
||||
5 | def overshadowed_list():
|
||||
6 | list = ...
|
||||
- list(map(lambda x: x, []))
|
||||
7 + list((x for x in []))
|
||||
8 |
|
||||
9 |
|
||||
10 | ### No errors
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C418 [*] Unnecessary dict literal passed to `dict()` (remove the outer call to `
|
|||
3 | dict({'x': 1 for x in range(10)})
|
||||
|
|
||||
help: Remove outer `dict()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-dict({})
|
||||
1 |+{}
|
||||
2 2 | dict({'a': 1})
|
||||
3 3 | dict({'x': 1 for x in range(10)})
|
||||
4 4 | dict(
|
||||
- dict({})
|
||||
1 + {}
|
||||
2 | dict({'a': 1})
|
||||
3 | dict({'x': 1 for x in range(10)})
|
||||
4 | dict(
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C418 [*] Unnecessary dict literal passed to `dict()` (remove the outer call to `dict()`)
|
||||
--> C418.py:2:1
|
||||
|
|
@ -28,14 +27,13 @@ C418 [*] Unnecessary dict literal passed to `dict()` (remove the outer call to `
|
|||
4 | dict(
|
||||
|
|
||||
help: Remove outer `dict()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | dict({})
|
||||
2 |-dict({'a': 1})
|
||||
2 |+{'a': 1}
|
||||
3 3 | dict({'x': 1 for x in range(10)})
|
||||
4 4 | dict(
|
||||
5 5 | {'x': 1 for x in range(10)}
|
||||
1 | dict({})
|
||||
- dict({'a': 1})
|
||||
2 + {'a': 1}
|
||||
3 | dict({'x': 1 for x in range(10)})
|
||||
4 | dict(
|
||||
5 | {'x': 1 for x in range(10)}
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C418 [*] Unnecessary dict comprehension passed to `dict()` (remove the outer call to `dict()`)
|
||||
--> C418.py:3:1
|
||||
|
|
@ -48,15 +46,14 @@ C418 [*] Unnecessary dict comprehension passed to `dict()` (remove the outer cal
|
|||
5 | {'x': 1 for x in range(10)}
|
||||
|
|
||||
help: Remove outer `dict()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | dict({})
|
||||
2 2 | dict({'a': 1})
|
||||
3 |-dict({'x': 1 for x in range(10)})
|
||||
3 |+{'x': 1 for x in range(10)}
|
||||
4 4 | dict(
|
||||
5 5 | {'x': 1 for x in range(10)}
|
||||
6 6 | )
|
||||
1 | dict({})
|
||||
2 | dict({'a': 1})
|
||||
- dict({'x': 1 for x in range(10)})
|
||||
3 + {'x': 1 for x in range(10)}
|
||||
4 | dict(
|
||||
5 | {'x': 1 for x in range(10)}
|
||||
6 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C418 [*] Unnecessary dict comprehension passed to `dict()` (remove the outer call to `dict()`)
|
||||
--> C418.py:4:1
|
||||
|
|
@ -71,15 +68,14 @@ C418 [*] Unnecessary dict comprehension passed to `dict()` (remove the outer cal
|
|||
8 | dict({}, a=1)
|
||||
|
|
||||
help: Remove outer `dict()` call
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | dict({})
|
||||
2 2 | dict({'a': 1})
|
||||
3 3 | dict({'x': 1 for x in range(10)})
|
||||
4 |-dict(
|
||||
5 |- {'x': 1 for x in range(10)}
|
||||
6 |-)
|
||||
4 |+{'x': 1 for x in range(10)}
|
||||
7 5 |
|
||||
8 6 | dict({}, a=1)
|
||||
9 7 | dict({x: 1 for x in range(1)}, a=1)
|
||||
1 | dict({})
|
||||
2 | dict({'a': 1})
|
||||
3 | dict({'x': 1 for x in range(10)})
|
||||
- dict(
|
||||
- {'x': 1 for x in range(10)}
|
||||
- )
|
||||
4 + {'x': 1 for x in range(10)}
|
||||
5 |
|
||||
6 | dict({}, a=1)
|
||||
7 | dict({x: 1 for x in range(1)}, a=1)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C419 [*] Unnecessary list comprehension
|
|||
3 | any( # first comment
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-any([x.id for x in bar])
|
||||
1 |+any(x.id for x in bar)
|
||||
2 2 | all([x.id for x in bar])
|
||||
3 3 | any( # first comment
|
||||
4 4 | [x.id for x in bar], # second comment
|
||||
- any([x.id for x in bar])
|
||||
1 + any(x.id for x in bar)
|
||||
2 | all([x.id for x in bar])
|
||||
3 | any( # first comment
|
||||
4 | [x.id for x in bar], # second comment
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary list comprehension
|
||||
--> C419.py:2:5
|
||||
|
|
@ -28,14 +27,13 @@ C419 [*] Unnecessary list comprehension
|
|||
4 | [x.id for x in bar], # second comment
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | any([x.id for x in bar])
|
||||
2 |-all([x.id for x in bar])
|
||||
2 |+all(x.id for x in bar)
|
||||
3 3 | any( # first comment
|
||||
4 4 | [x.id for x in bar], # second comment
|
||||
5 5 | ) # third comment
|
||||
1 | any([x.id for x in bar])
|
||||
- all([x.id for x in bar])
|
||||
2 + all(x.id for x in bar)
|
||||
3 | any( # first comment
|
||||
4 | [x.id for x in bar], # second comment
|
||||
5 | ) # third comment
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary list comprehension
|
||||
--> C419.py:4:5
|
||||
|
|
@ -48,16 +46,15 @@ C419 [*] Unnecessary list comprehension
|
|||
6 | all( # first comment
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | any([x.id for x in bar])
|
||||
2 2 | all([x.id for x in bar])
|
||||
3 3 | any( # first comment
|
||||
4 |- [x.id for x in bar], # second comment
|
||||
4 |+ x.id for x in bar # second comment
|
||||
5 5 | ) # third comment
|
||||
6 6 | all( # first comment
|
||||
7 7 | [x.id for x in bar], # second comment
|
||||
1 | any([x.id for x in bar])
|
||||
2 | all([x.id for x in bar])
|
||||
3 | any( # first comment
|
||||
- [x.id for x in bar], # second comment
|
||||
4 + x.id for x in bar # second comment
|
||||
5 | ) # third comment
|
||||
6 | all( # first comment
|
||||
7 | [x.id for x in bar], # second comment
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary list comprehension
|
||||
--> C419.py:7:5
|
||||
|
|
@ -70,16 +67,15 @@ C419 [*] Unnecessary list comprehension
|
|||
9 | any({x.id for x in bar})
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | [x.id for x in bar], # second comment
|
||||
5 5 | ) # third comment
|
||||
6 6 | all( # first comment
|
||||
7 |- [x.id for x in bar], # second comment
|
||||
7 |+ x.id for x in bar # second comment
|
||||
8 8 | ) # third comment
|
||||
9 9 | any({x.id for x in bar})
|
||||
10 10 |
|
||||
4 | [x.id for x in bar], # second comment
|
||||
5 | ) # third comment
|
||||
6 | all( # first comment
|
||||
- [x.id for x in bar], # second comment
|
||||
7 + x.id for x in bar # second comment
|
||||
8 | ) # third comment
|
||||
9 | any({x.id for x in bar})
|
||||
10 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary set comprehension
|
||||
--> C419.py:9:5
|
||||
|
|
@ -92,16 +88,15 @@ C419 [*] Unnecessary set comprehension
|
|||
11 | # OK
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 | all( # first comment
|
||||
7 7 | [x.id for x in bar], # second comment
|
||||
8 8 | ) # third comment
|
||||
9 |-any({x.id for x in bar})
|
||||
9 |+any(x.id for x in bar)
|
||||
10 10 |
|
||||
11 11 | # OK
|
||||
12 12 | all(x.id for x in bar)
|
||||
6 | all( # first comment
|
||||
7 | [x.id for x in bar], # second comment
|
||||
8 | ) # third comment
|
||||
- any({x.id for x in bar})
|
||||
9 + any(x.id for x in bar)
|
||||
10 |
|
||||
11 | # OK
|
||||
12 | all(x.id for x in bar)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary list comprehension
|
||||
--> C419.py:28:5
|
||||
|
|
@ -119,24 +114,23 @@ C419 [*] Unnecessary list comprehension
|
|||
35 | )
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
25 25 |
|
||||
26 26 | # Special comment handling
|
||||
27 27 | any(
|
||||
28 |- [ # lbracket comment
|
||||
29 |- # second line comment
|
||||
30 |- i.bit_count()
|
||||
28 |+ # lbracket comment
|
||||
29 |+ # second line comment
|
||||
30 |+ i.bit_count()
|
||||
31 31 | # random middle comment
|
||||
32 |- for i in range(5) # rbracket comment
|
||||
33 |- ] # rpar comment
|
||||
32 |+ for i in range(5) # rbracket comment # rpar comment
|
||||
34 33 | # trailing comment
|
||||
35 34 | )
|
||||
36 35 |
|
||||
25 |
|
||||
26 | # Special comment handling
|
||||
27 | any(
|
||||
- [ # lbracket comment
|
||||
- # second line comment
|
||||
- i.bit_count()
|
||||
28 + # lbracket comment
|
||||
29 + # second line comment
|
||||
30 + i.bit_count()
|
||||
31 | # random middle comment
|
||||
- for i in range(5) # rbracket comment
|
||||
- ] # rpar comment
|
||||
32 + for i in range(5) # rbracket comment # rpar comment
|
||||
33 | # trailing comment
|
||||
34 | )
|
||||
35 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary list comprehension
|
||||
--> C419.py:39:5
|
||||
|
|
@ -152,22 +146,21 @@ C419 [*] Unnecessary list comprehension
|
|||
43 | )
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
36 36 |
|
||||
37 37 | # Weird case where the function call, opening bracket, and comment are all
|
||||
38 38 | # on the same line.
|
||||
39 |-any([ # lbracket comment
|
||||
40 |- # second line comment
|
||||
41 |- i.bit_count() for i in range(5) # rbracket comment
|
||||
42 |- ] # rpar comment
|
||||
39 |+any(
|
||||
40 |+# lbracket comment
|
||||
41 |+# second line comment
|
||||
42 |+i.bit_count() for i in range(5) # rbracket comment # rpar comment
|
||||
43 43 | )
|
||||
44 44 |
|
||||
45 45 | ## Set comprehensions should only be linted
|
||||
36 |
|
||||
37 | # Weird case where the function call, opening bracket, and comment are all
|
||||
38 | # on the same line.
|
||||
- any([ # lbracket comment
|
||||
- # second line comment
|
||||
- i.bit_count() for i in range(5) # rbracket comment
|
||||
- ] # rpar comment
|
||||
39 + any(
|
||||
40 + # lbracket comment
|
||||
41 + # second line comment
|
||||
42 + i.bit_count() for i in range(5) # rbracket comment # rpar comment
|
||||
43 | )
|
||||
44 |
|
||||
45 | ## Set comprehensions should only be linted
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary set comprehension
|
||||
--> C419.py:49:5
|
||||
|
|
@ -178,16 +171,15 @@ C419 [*] Unnecessary set comprehension
|
|||
50 | all({x.id for x in bar})
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
46 46 | ## when function is invariant under duplication of inputs
|
||||
47 47 |
|
||||
48 48 | # should be linted...
|
||||
49 |-any({x.id for x in bar})
|
||||
49 |+any(x.id for x in bar)
|
||||
50 50 | all({x.id for x in bar})
|
||||
51 51 |
|
||||
52 52 | # should be linted in preview...
|
||||
46 | ## when function is invariant under duplication of inputs
|
||||
47 |
|
||||
48 | # should be linted...
|
||||
- any({x.id for x in bar})
|
||||
49 + any(x.id for x in bar)
|
||||
50 | all({x.id for x in bar})
|
||||
51 |
|
||||
52 | # should be linted in preview...
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary set comprehension
|
||||
--> C419.py:50:5
|
||||
|
|
@ -200,13 +192,12 @@ C419 [*] Unnecessary set comprehension
|
|||
52 | # should be linted in preview...
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
47 47 |
|
||||
48 48 | # should be linted...
|
||||
49 49 | any({x.id for x in bar})
|
||||
50 |-all({x.id for x in bar})
|
||||
50 |+all(x.id for x in bar)
|
||||
51 51 |
|
||||
52 52 | # should be linted in preview...
|
||||
53 53 | min({x.id for x in bar})
|
||||
47 |
|
||||
48 | # should be linted...
|
||||
49 | any({x.id for x in bar})
|
||||
- all({x.id for x in bar})
|
||||
50 + all(x.id for x in bar)
|
||||
51 |
|
||||
52 | # should be linted in preview...
|
||||
53 | min({x.id for x in bar})
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,16 +10,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable, value)`)
|
||||
|
||||
ℹ Safe fix
|
||||
3 3 |
|
||||
4 4 | def func():
|
||||
5 5 | numbers = [1, 2, 3]
|
||||
6 |- {n: None for n in numbers} # RUF025
|
||||
6 |+ dict.fromkeys(numbers) # RUF025
|
||||
7 7 |
|
||||
8 8 |
|
||||
9 9 | def func():
|
||||
3 |
|
||||
4 | def func():
|
||||
5 | numbers = [1, 2, 3]
|
||||
- {n: None for n in numbers} # RUF025
|
||||
6 + dict.fromkeys(numbers) # RUF025
|
||||
7 |
|
||||
8 |
|
||||
9 | def func():
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:10:23
|
||||
|
|
@ -30,16 +28,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
11 | pass
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
7 7 |
|
||||
8 8 |
|
||||
9 9 | def func():
|
||||
10 |- for key, value in {n: 1 for n in [1, 2, 3]}.items(): # RUF025
|
||||
10 |+ for key, value in dict.fromkeys([1, 2, 3], 1).items(): # RUF025
|
||||
11 11 | pass
|
||||
12 12 |
|
||||
13 13 |
|
||||
7 |
|
||||
8 |
|
||||
9 | def func():
|
||||
- for key, value in {n: 1 for n in [1, 2, 3]}.items(): # RUF025
|
||||
10 + for key, value in dict.fromkeys([1, 2, 3], 1).items(): # RUF025
|
||||
11 | pass
|
||||
12 |
|
||||
13 |
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:15:5
|
||||
|
|
@ -49,16 +45,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
12 12 |
|
||||
13 13 |
|
||||
14 14 | def func():
|
||||
15 |- {n: 1.1 for n in [1, 2, 3]} # RUF025
|
||||
15 |+ dict.fromkeys([1, 2, 3], 1.1) # RUF025
|
||||
16 16 |
|
||||
17 17 |
|
||||
18 18 | def func():
|
||||
12 |
|
||||
13 |
|
||||
14 | def func():
|
||||
- {n: 1.1 for n in [1, 2, 3]} # RUF025
|
||||
15 + dict.fromkeys([1, 2, 3], 1.1) # RUF025
|
||||
16 |
|
||||
17 |
|
||||
18 | def func():
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:26:7
|
||||
|
|
@ -69,16 +63,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
23 23 | def f(data):
|
||||
24 24 | return data
|
||||
25 25 |
|
||||
26 |- f({c: "a" for c in "12345"}) # RUF025
|
||||
26 |+ f(dict.fromkeys("12345", "a")) # RUF025
|
||||
27 27 |
|
||||
28 28 |
|
||||
29 29 | def func():
|
||||
23 | def f(data):
|
||||
24 | return data
|
||||
25 |
|
||||
- f({c: "a" for c in "12345"}) # RUF025
|
||||
26 + f(dict.fromkeys("12345", "a")) # RUF025
|
||||
27 |
|
||||
28 |
|
||||
29 | def func():
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:30:5
|
||||
|
|
@ -88,16 +80,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
27 27 |
|
||||
28 28 |
|
||||
29 29 | def func():
|
||||
30 |- {n: True for n in [1, 2, 2]} # RUF025
|
||||
30 |+ dict.fromkeys([1, 2, 2], True) # RUF025
|
||||
31 31 |
|
||||
32 32 |
|
||||
33 33 | def func():
|
||||
27 |
|
||||
28 |
|
||||
29 | def func():
|
||||
- {n: True for n in [1, 2, 2]} # RUF025
|
||||
30 + dict.fromkeys([1, 2, 2], True) # RUF025
|
||||
31 |
|
||||
32 |
|
||||
33 | def func():
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:34:5
|
||||
|
|
@ -107,16 +97,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
31 31 |
|
||||
32 32 |
|
||||
33 33 | def func():
|
||||
34 |- {n: b"hello" for n in (1, 2, 2)} # RUF025
|
||||
34 |+ dict.fromkeys((1, 2, 2), b"hello") # RUF025
|
||||
35 35 |
|
||||
36 36 |
|
||||
37 37 | def func():
|
||||
31 |
|
||||
32 |
|
||||
33 | def func():
|
||||
- {n: b"hello" for n in (1, 2, 2)} # RUF025
|
||||
34 + dict.fromkeys((1, 2, 2), b"hello") # RUF025
|
||||
35 |
|
||||
36 |
|
||||
37 | def func():
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:38:5
|
||||
|
|
@ -126,16 +114,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
35 35 |
|
||||
36 36 |
|
||||
37 37 | def func():
|
||||
38 |- {n: ... for n in [1, 2, 3]} # RUF025
|
||||
38 |+ dict.fromkeys([1, 2, 3], ...) # RUF025
|
||||
39 39 |
|
||||
40 40 |
|
||||
41 41 | def func():
|
||||
35 |
|
||||
36 |
|
||||
37 | def func():
|
||||
- {n: ... for n in [1, 2, 3]} # RUF025
|
||||
38 + dict.fromkeys([1, 2, 3], ...) # RUF025
|
||||
39 |
|
||||
40 |
|
||||
41 | def func():
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:42:5
|
||||
|
|
@ -145,16 +131,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
39 39 |
|
||||
40 40 |
|
||||
41 41 | def func():
|
||||
42 |- {n: False for n in {1: "a", 2: "b"}} # RUF025
|
||||
42 |+ dict.fromkeys({1: "a", 2: "b"}, False) # RUF025
|
||||
43 43 |
|
||||
44 44 |
|
||||
45 45 | def func():
|
||||
39 |
|
||||
40 |
|
||||
41 | def func():
|
||||
- {n: False for n in {1: "a", 2: "b"}} # RUF025
|
||||
42 + dict.fromkeys({1: "a", 2: "b"}, False) # RUF025
|
||||
43 |
|
||||
44 |
|
||||
45 | def func():
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:46:5
|
||||
|
|
@ -164,16 +148,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
43 43 |
|
||||
44 44 |
|
||||
45 45 | def func():
|
||||
46 |- {(a, b): 1 for (a, b) in [(1, 2), (3, 4)]} # RUF025
|
||||
46 |+ dict.fromkeys([(1, 2), (3, 4)], 1) # RUF025
|
||||
47 47 |
|
||||
48 48 |
|
||||
49 49 | def func():
|
||||
43 |
|
||||
44 |
|
||||
45 | def func():
|
||||
- {(a, b): 1 for (a, b) in [(1, 2), (3, 4)]} # RUF025
|
||||
46 + dict.fromkeys([(1, 2), (3, 4)], 1) # RUF025
|
||||
47 |
|
||||
48 |
|
||||
49 | def func():
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:54:5
|
||||
|
|
@ -183,16 +165,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
51 51 | return 1
|
||||
52 52 |
|
||||
53 53 | a = f()
|
||||
54 |- {n: a for n in [1, 2, 3]} # RUF025
|
||||
54 |+ dict.fromkeys([1, 2, 3], a) # RUF025
|
||||
55 55 |
|
||||
56 56 |
|
||||
57 57 | def func():
|
||||
51 | return 1
|
||||
52 |
|
||||
53 | a = f()
|
||||
- {n: a for n in [1, 2, 3]} # RUF025
|
||||
54 + dict.fromkeys([1, 2, 3], a) # RUF025
|
||||
55 |
|
||||
56 |
|
||||
57 | def func():
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:59:6
|
||||
|
|
@ -203,16 +183,14 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
56 56 |
|
||||
57 57 | def func():
|
||||
58 58 | values = ["a", "b", "c"]
|
||||
59 |- [{n: values for n in [1, 2, 3]}] # RUF025
|
||||
59 |+ [dict.fromkeys([1, 2, 3], values)] # RUF025
|
||||
60 60 |
|
||||
61 61 |
|
||||
62 62 | # Non-violation cases: RUF025
|
||||
56 |
|
||||
57 | def func():
|
||||
58 | values = ["a", "b", "c"]
|
||||
- [{n: values for n in [1, 2, 3]}] # RUF025
|
||||
59 + [dict.fromkeys([1, 2, 3], values)] # RUF025
|
||||
60 |
|
||||
61 |
|
||||
62 | # Non-violation cases: RUF025
|
||||
|
||||
C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
|
||||
--> C420.py:95:1
|
||||
|
|
@ -230,18 +208,17 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| |_^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable, value)`)
|
||||
|
||||
ℹ Unsafe fix
|
||||
92 92 | {(a, b): a + b for (a, b) in [(1, 2), (3, 4)]} # OK
|
||||
93 93 |
|
||||
94 94 | # https://github.com/astral-sh/ruff/issues/18764
|
||||
95 |-{ # 1
|
||||
96 |-a # 2
|
||||
97 |-: # 3
|
||||
98 |-None # 4
|
||||
99 |-for # 5
|
||||
100 |-a # 6
|
||||
101 |-in # 7
|
||||
102 |-iterable # 8
|
||||
103 |-} # 9
|
||||
95 |+dict.fromkeys(iterable) # 9
|
||||
92 | {(a, b): a + b for (a, b) in [(1, 2), (3, 4)]} # OK
|
||||
93 |
|
||||
94 | # https://github.com/astral-sh/ruff/issues/18764
|
||||
- { # 1
|
||||
- a # 2
|
||||
- : # 3
|
||||
- None # 4
|
||||
- for # 5
|
||||
- a # 6
|
||||
- in # 7
|
||||
- iterable # 8
|
||||
- } # 9
|
||||
95 + dict.fromkeys(iterable) # 9
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable)`)
|
||||
|
||||
ℹ Safe fix
|
||||
1 |-{x: NotImplemented for x in "XY"}
|
||||
1 |+dict.fromkeys("XY", NotImplemented)
|
||||
2 2 |
|
||||
3 3 |
|
||||
4 4 | # Builtin bindings are placed at top of file, but should not count as
|
||||
- {x: NotImplemented for x in "XY"}
|
||||
1 + dict.fromkeys("XY", NotImplemented)
|
||||
2 |
|
||||
3 |
|
||||
4 | # Builtin bindings are placed at top of file, but should not count as
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@ C420 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instea
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Replace with `dict.fromkeys(iterable, value)`)
|
||||
|
||||
ℹ Safe fix
|
||||
1 |-foo or{x: None for x in bar}
|
||||
1 |+foo or dict.fromkeys(bar)
|
||||
2 2 |
|
||||
3 3 |
|
||||
4 4 | # C420 fix must make sure to insert a leading space if needed,
|
||||
- foo or{x: None for x in bar}
|
||||
1 + foo or dict.fromkeys(bar)
|
||||
2 |
|
||||
3 |
|
||||
4 | # C420 fix must make sure to insert a leading space if needed,
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
3 | t3 = tuple((1, 2))
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-t1 = tuple([])
|
||||
1 |+t1 = ()
|
||||
2 2 | t2 = tuple([1, 2])
|
||||
3 3 | t3 = tuple((1, 2))
|
||||
4 4 | t4 = tuple([
|
||||
- t1 = tuple([])
|
||||
1 + t1 = ()
|
||||
2 | t2 = tuple([1, 2])
|
||||
3 | t3 = tuple((1, 2))
|
||||
4 | t4 = tuple([
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:2:6
|
||||
|
|
@ -28,14 +27,13 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
4 | t4 = tuple([
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t1 = tuple([])
|
||||
2 |-t2 = tuple([1, 2])
|
||||
2 |+t2 = (1, 2)
|
||||
3 3 | t3 = tuple((1, 2))
|
||||
4 4 | t4 = tuple([
|
||||
5 5 | 1,
|
||||
1 | t1 = tuple([])
|
||||
- t2 = tuple([1, 2])
|
||||
2 + t2 = (1, 2)
|
||||
3 | t3 = tuple((1, 2))
|
||||
4 | t4 = tuple([
|
||||
5 | 1,
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to `tuple()`)
|
||||
--> C409.py:3:6
|
||||
|
|
@ -48,15 +46,14 @@ C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to
|
|||
5 | 1,
|
||||
|
|
||||
help: Remove the outer call to `tuple()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t1 = tuple([])
|
||||
2 2 | t2 = tuple([1, 2])
|
||||
3 |-t3 = tuple((1, 2))
|
||||
3 |+t3 = (1, 2)
|
||||
4 4 | t4 = tuple([
|
||||
5 5 | 1,
|
||||
6 6 | 2
|
||||
1 | t1 = tuple([])
|
||||
2 | t2 = tuple([1, 2])
|
||||
- t3 = tuple((1, 2))
|
||||
3 + t3 = (1, 2)
|
||||
4 | t4 = tuple([
|
||||
5 | 1,
|
||||
6 | 2
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:4:6
|
||||
|
|
@ -73,20 +70,19 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
9 | (1, 2)
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | t1 = tuple([])
|
||||
2 2 | t2 = tuple([1, 2])
|
||||
3 3 | t3 = tuple((1, 2))
|
||||
4 |-t4 = tuple([
|
||||
4 |+t4 = (
|
||||
5 5 | 1,
|
||||
6 6 | 2
|
||||
7 |-])
|
||||
7 |+)
|
||||
8 8 | t5 = tuple(
|
||||
9 9 | (1, 2)
|
||||
10 10 | )
|
||||
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 change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to `tuple()`)
|
||||
--> C409.py:8:6
|
||||
|
|
@ -102,18 +98,17 @@ C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to
|
|||
12 | tuple( # comment
|
||||
|
|
||||
help: Remove the outer call to `tuple()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | 1,
|
||||
6 6 | 2
|
||||
7 7 | ])
|
||||
8 |-t5 = tuple(
|
||||
9 |- (1, 2)
|
||||
10 |-)
|
||||
8 |+t5 = (1, 2)
|
||||
11 9 |
|
||||
12 10 | tuple( # comment
|
||||
13 11 | [1, 2]
|
||||
5 | 1,
|
||||
6 | 2
|
||||
7 | ])
|
||||
- t5 = tuple(
|
||||
- (1, 2)
|
||||
- )
|
||||
8 + t5 = (1, 2)
|
||||
9 |
|
||||
10 | tuple( # comment
|
||||
11 | [1, 2]
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:12:1
|
||||
|
|
@ -128,18 +123,17 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
16 | tuple([ # comment
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | (1, 2)
|
||||
10 10 | )
|
||||
11 11 |
|
||||
12 |-tuple( # comment
|
||||
13 |- [1, 2]
|
||||
14 |-)
|
||||
12 |+(1, 2)
|
||||
15 13 |
|
||||
16 14 | tuple([ # comment
|
||||
17 15 | 1, 2
|
||||
9 | (1, 2)
|
||||
10 | )
|
||||
11 |
|
||||
- tuple( # comment
|
||||
- [1, 2]
|
||||
- )
|
||||
12 + (1, 2)
|
||||
13 |
|
||||
14 | tuple([ # comment
|
||||
15 | 1, 2
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:16:1
|
||||
|
|
@ -154,19 +148,18 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
20 | tuple((
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 | [1, 2]
|
||||
14 14 | )
|
||||
15 15 |
|
||||
16 |-tuple([ # comment
|
||||
16 |+( # comment
|
||||
17 17 | 1, 2
|
||||
18 |-])
|
||||
18 |+)
|
||||
19 19 |
|
||||
20 20 | tuple((
|
||||
21 21 | 1,
|
||||
13 | [1, 2]
|
||||
14 | )
|
||||
15 |
|
||||
- tuple([ # comment
|
||||
16 + ( # comment
|
||||
17 | 1, 2
|
||||
- ])
|
||||
18 + )
|
||||
19 |
|
||||
20 | tuple((
|
||||
21 | 1,
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to `tuple()`)
|
||||
--> C409.py:20:1
|
||||
|
|
@ -181,19 +174,18 @@ C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to
|
|||
24 | t6 = tuple([1])
|
||||
|
|
||||
help: Remove the outer call to `tuple()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 | 1, 2
|
||||
18 18 | ])
|
||||
19 19 |
|
||||
20 |-tuple((
|
||||
20 |+(
|
||||
21 21 | 1,
|
||||
22 |-))
|
||||
22 |+)
|
||||
23 23 |
|
||||
24 24 | t6 = tuple([1])
|
||||
25 25 | t7 = tuple((1,))
|
||||
17 | 1, 2
|
||||
18 | ])
|
||||
19 |
|
||||
- tuple((
|
||||
20 + (
|
||||
21 | 1,
|
||||
- ))
|
||||
22 + )
|
||||
23 |
|
||||
24 | t6 = tuple([1])
|
||||
25 | t7 = tuple((1,))
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:24:6
|
||||
|
|
@ -206,16 +198,15 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
26 | t8 = tuple([1,])
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
21 21 | 1,
|
||||
22 22 | ))
|
||||
23 23 |
|
||||
24 |-t6 = tuple([1])
|
||||
24 |+t6 = (1,)
|
||||
25 25 | t7 = tuple((1,))
|
||||
26 26 | t8 = tuple([1,])
|
||||
27 27 |
|
||||
21 | 1,
|
||||
22 | ))
|
||||
23 |
|
||||
- t6 = tuple([1])
|
||||
24 + t6 = (1,)
|
||||
25 | t7 = tuple((1,))
|
||||
26 | t8 = tuple([1,])
|
||||
27 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to `tuple()`)
|
||||
--> C409.py:25:6
|
||||
|
|
@ -226,16 +217,15 @@ C409 [*] Unnecessary tuple literal passed to `tuple()` (remove the outer call to
|
|||
26 | t8 = tuple([1,])
|
||||
|
|
||||
help: Remove the outer call to `tuple()`
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 | ))
|
||||
23 23 |
|
||||
24 24 | t6 = tuple([1])
|
||||
25 |-t7 = tuple((1,))
|
||||
25 |+t7 = (1,)
|
||||
26 26 | t8 = tuple([1,])
|
||||
27 27 |
|
||||
28 28 | tuple([x for x in range(5)])
|
||||
22 | ))
|
||||
23 |
|
||||
24 | t6 = tuple([1])
|
||||
- t7 = tuple((1,))
|
||||
25 + t7 = (1,)
|
||||
26 | t8 = tuple([1,])
|
||||
27 |
|
||||
28 | tuple([x for x in range(5)])
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
|
||||
--> C409.py:26:6
|
||||
|
|
@ -248,16 +238,15 @@ C409 [*] Unnecessary list literal passed to `tuple()` (rewrite as a tuple litera
|
|||
28 | tuple([x for x in range(5)])
|
||||
|
|
||||
help: Rewrite as a tuple literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
23 23 |
|
||||
24 24 | t6 = tuple([1])
|
||||
25 25 | t7 = tuple((1,))
|
||||
26 |-t8 = tuple([1,])
|
||||
26 |+t8 = (1,)
|
||||
27 27 |
|
||||
28 28 | tuple([x for x in range(5)])
|
||||
29 29 | tuple({x for x in range(10)})
|
||||
23 |
|
||||
24 | t6 = tuple([1])
|
||||
25 | t7 = tuple((1,))
|
||||
- t8 = tuple([1,])
|
||||
26 + t8 = (1,)
|
||||
27 |
|
||||
28 | tuple([x for x in range(5)])
|
||||
29 | tuple({x for x in range(10)})
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator)
|
||||
--> C409.py:28:1
|
||||
|
|
@ -270,16 +259,15 @@ C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a genera
|
|||
30 | tuple(x for x in range(5))
|
||||
|
|
||||
help: Rewrite as a generator
|
||||
|
||||
ℹ Unsafe fix
|
||||
25 25 | t7 = tuple((1,))
|
||||
26 26 | t8 = tuple([1,])
|
||||
27 27 |
|
||||
28 |-tuple([x for x in range(5)])
|
||||
28 |+tuple(x for x in range(5))
|
||||
29 29 | tuple({x for x in range(10)})
|
||||
30 30 | tuple(x for x in range(5))
|
||||
31 31 | tuple([
|
||||
25 | t7 = tuple((1,))
|
||||
26 | t8 = tuple([1,])
|
||||
27 |
|
||||
- tuple([x for x in range(5)])
|
||||
28 + tuple(x for x in range(5))
|
||||
29 | tuple({x for x in range(10)})
|
||||
30 | tuple(x for x in range(5))
|
||||
31 | tuple([
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator)
|
||||
--> C409.py:31:1
|
||||
|
|
@ -294,18 +282,17 @@ C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a genera
|
|||
35 | [x for x in [1,2,3]]
|
||||
|
|
||||
help: Rewrite as a generator
|
||||
|
||||
ℹ Unsafe fix
|
||||
28 28 | tuple([x for x in range(5)])
|
||||
29 29 | tuple({x for x in range(10)})
|
||||
30 30 | tuple(x for x in range(5))
|
||||
31 |-tuple([
|
||||
32 |- x for x in [1,2,3]
|
||||
33 |-])
|
||||
31 |+tuple(x for x in [1,2,3])
|
||||
34 32 | tuple( # comment
|
||||
35 33 | [x for x in [1,2,3]]
|
||||
36 34 | )
|
||||
28 | tuple([x for x in range(5)])
|
||||
29 | tuple({x for x in range(10)})
|
||||
30 | tuple(x for x in range(5))
|
||||
- tuple([
|
||||
- x for x in [1,2,3]
|
||||
- ])
|
||||
31 + tuple(x for x in [1,2,3])
|
||||
32 | tuple( # comment
|
||||
33 | [x for x in [1,2,3]]
|
||||
34 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator)
|
||||
--> C409.py:34:1
|
||||
|
|
@ -320,16 +307,15 @@ C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a genera
|
|||
38 | x for x in range(10)
|
||||
|
|
||||
help: Rewrite as a generator
|
||||
|
||||
ℹ Unsafe fix
|
||||
32 32 | x for x in [1,2,3]
|
||||
33 33 | ])
|
||||
34 34 | tuple( # comment
|
||||
35 |- [x for x in [1,2,3]]
|
||||
35 |+ x for x in [1,2,3]
|
||||
36 36 | )
|
||||
37 37 | tuple([ # comment
|
||||
38 38 | x for x in range(10)
|
||||
32 | x for x in [1,2,3]
|
||||
33 | ])
|
||||
34 | tuple( # comment
|
||||
- [x for x in [1,2,3]]
|
||||
35 + x for x in [1,2,3]
|
||||
36 | )
|
||||
37 | tuple([ # comment
|
||||
38 | x for x in range(10)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a generator)
|
||||
--> C409.py:37:1
|
||||
|
|
@ -344,18 +330,17 @@ C409 [*] Unnecessary list comprehension passed to `tuple()` (rewrite as a genera
|
|||
41 | {
|
||||
|
|
||||
help: Rewrite as a generator
|
||||
|
||||
ℹ Unsafe fix
|
||||
34 34 | tuple( # comment
|
||||
35 35 | [x for x in [1,2,3]]
|
||||
36 36 | )
|
||||
37 |-tuple([ # comment
|
||||
38 |- x for x in range(10)
|
||||
39 |-])
|
||||
40 37 | tuple(
|
||||
38 |+# comment
|
||||
39 |+x for x in range(10))
|
||||
40 |+tuple(
|
||||
41 41 | {
|
||||
42 42 | x for x in [1,2,3]
|
||||
43 43 | }
|
||||
34 | tuple( # comment
|
||||
35 | [x for x in [1,2,3]]
|
||||
36 | )
|
||||
- tuple([ # comment
|
||||
- x for x in range(10)
|
||||
- ])
|
||||
37 | tuple(
|
||||
38 + # comment
|
||||
39 + x for x in range(10))
|
||||
40 + tuple(
|
||||
41 | {
|
||||
42 | x for x in [1,2,3]
|
||||
43 | }
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ C419 [*] Unnecessary list comprehension
|
|||
3 | max([x.val for x in bar])
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 |-sum([x.val for x in bar])
|
||||
1 |+sum(x.val for x in bar)
|
||||
2 2 | min([x.val for x in bar])
|
||||
3 3 | max([x.val for x in bar])
|
||||
4 4 | sum([x.val for x in bar], 0)
|
||||
- sum([x.val for x in bar])
|
||||
1 + sum(x.val for x in bar)
|
||||
2 | min([x.val for x in bar])
|
||||
3 | max([x.val for x in bar])
|
||||
4 | sum([x.val for x in bar], 0)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary list comprehension
|
||||
--> C419_1.py:2:5
|
||||
|
|
@ -28,14 +27,13 @@ C419 [*] Unnecessary list comprehension
|
|||
4 | sum([x.val for x in bar], 0)
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | sum([x.val for x in bar])
|
||||
2 |-min([x.val for x in bar])
|
||||
2 |+min(x.val for x in bar)
|
||||
3 3 | max([x.val for x in bar])
|
||||
4 4 | sum([x.val for x in bar], 0)
|
||||
5 5 |
|
||||
1 | sum([x.val for x in bar])
|
||||
- min([x.val for x in bar])
|
||||
2 + min(x.val for x in bar)
|
||||
3 | max([x.val for x in bar])
|
||||
4 | sum([x.val for x in bar], 0)
|
||||
5 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary list comprehension
|
||||
--> C419_1.py:3:5
|
||||
|
|
@ -47,15 +45,14 @@ C419 [*] Unnecessary list comprehension
|
|||
4 | sum([x.val for x in bar], 0)
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | sum([x.val for x in bar])
|
||||
2 2 | min([x.val for x in bar])
|
||||
3 |-max([x.val for x in bar])
|
||||
3 |+max(x.val for x in bar)
|
||||
4 4 | sum([x.val for x in bar], 0)
|
||||
5 5 |
|
||||
6 6 | # OK
|
||||
1 | sum([x.val for x in bar])
|
||||
2 | min([x.val for x in bar])
|
||||
- max([x.val for x in bar])
|
||||
3 + max(x.val for x in bar)
|
||||
4 | sum([x.val for x in bar], 0)
|
||||
5 |
|
||||
6 | # OK
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary list comprehension
|
||||
--> C419_1.py:4:5
|
||||
|
|
@ -68,16 +65,15 @@ C419 [*] Unnecessary list comprehension
|
|||
6 | # OK
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | sum([x.val for x in bar])
|
||||
2 2 | min([x.val for x in bar])
|
||||
3 3 | max([x.val for x in bar])
|
||||
4 |-sum([x.val for x in bar], 0)
|
||||
4 |+sum((x.val for x in bar), 0)
|
||||
5 5 |
|
||||
6 6 | # OK
|
||||
7 7 | sum(x.val for x in bar)
|
||||
1 | sum([x.val for x in bar])
|
||||
2 | min([x.val for x in bar])
|
||||
3 | max([x.val for x in bar])
|
||||
- sum([x.val for x in bar], 0)
|
||||
4 + sum((x.val for x in bar), 0)
|
||||
5 |
|
||||
6 | # OK
|
||||
7 | sum(x.val for x in bar)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
C419 [*] Unnecessary list comprehension
|
||||
--> C419_1.py:14:5
|
||||
|
|
@ -94,17 +90,16 @@ C419 [*] Unnecessary list comprehension
|
|||
20 | )
|
||||
|
|
||||
help: Remove unnecessary comprehension
|
||||
|
||||
ℹ Unsafe fix
|
||||
11 11 |
|
||||
12 12 | # Multi-line
|
||||
13 13 | sum(
|
||||
14 |- [
|
||||
14 |+ (
|
||||
15 15 | delta
|
||||
16 16 | for delta in timedelta_list
|
||||
17 17 | if delta
|
||||
18 |- ],
|
||||
18 |+ ),
|
||||
19 19 | dt.timedelta(),
|
||||
20 20 | )
|
||||
11 |
|
||||
12 | # Multi-line
|
||||
13 | sum(
|
||||
- [
|
||||
14 + (
|
||||
15 | delta
|
||||
16 | for delta in timedelta_list
|
||||
17 | if delta
|
||||
- ],
|
||||
18 + ),
|
||||
19 | dt.timedelta(),
|
||||
20 | )
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -9,17 +9,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 |
|
||||
4 4 | def f_a():
|
||||
5 |- raise RuntimeError("This is an example exception")
|
||||
5 |+ msg = "This is an example exception"
|
||||
6 |+ raise RuntimeError(msg)
|
||||
6 7 |
|
||||
7 8 |
|
||||
8 9 | def f_a_short():
|
||||
2 |
|
||||
3 |
|
||||
4 | def f_a():
|
||||
- raise RuntimeError("This is an example exception")
|
||||
5 + msg = "This is an example exception"
|
||||
6 + raise RuntimeError(msg)
|
||||
7 |
|
||||
8 |
|
||||
9 | def f_a_short():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM102 [*] Exception must not use an f-string literal, assign to variable first
|
||||
--> EM.py:18:24
|
||||
|
|
@ -30,17 +29,16 @@ EM102 [*] Exception must not use an f-string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove f-string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
15 15 |
|
||||
16 16 | def f_b():
|
||||
17 17 | example = "example"
|
||||
18 |- raise RuntimeError(f"This is an {example} exception")
|
||||
18 |+ msg = f"This is an {example} exception"
|
||||
19 |+ raise RuntimeError(msg)
|
||||
19 20 |
|
||||
20 21 |
|
||||
21 22 | def f_c():
|
||||
15 |
|
||||
16 | def f_b():
|
||||
17 | example = "example"
|
||||
- raise RuntimeError(f"This is an {example} exception")
|
||||
18 + msg = f"This is an {example} exception"
|
||||
19 + raise RuntimeError(msg)
|
||||
20 |
|
||||
21 |
|
||||
22 | def f_c():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
|
||||
--> EM.py:22:24
|
||||
|
|
@ -50,17 +48,16 @@ EM103 [*] Exception must not use a `.format()` string directly, assign to variab
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove `.format()` string
|
||||
|
||||
ℹ Unsafe fix
|
||||
19 19 |
|
||||
20 20 |
|
||||
21 21 | def f_c():
|
||||
22 |- raise RuntimeError("This is an {example} exception".format(example="example"))
|
||||
22 |+ msg = "This is an {example} exception".format(example="example")
|
||||
23 |+ raise RuntimeError(msg)
|
||||
23 24 |
|
||||
24 25 |
|
||||
25 26 | def f_ok():
|
||||
19 |
|
||||
20 |
|
||||
21 | def f_c():
|
||||
- raise RuntimeError("This is an {example} exception".format(example="example"))
|
||||
22 + msg = "This is an {example} exception".format(example="example")
|
||||
23 + raise RuntimeError(msg)
|
||||
24 |
|
||||
25 |
|
||||
26 | def f_ok():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:32:24
|
||||
|
|
@ -71,17 +68,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 |
|
||||
30 30 | def f_msg_defined():
|
||||
31 31 | msg = "hello"
|
||||
32 |- raise RuntimeError("This is an example exception")
|
||||
32 |+ msg = "This is an example exception"
|
||||
33 |+ raise RuntimeError(msg)
|
||||
33 34 |
|
||||
34 35 |
|
||||
35 36 | def f_msg_in_nested_scope():
|
||||
29 |
|
||||
30 | def f_msg_defined():
|
||||
31 | msg = "hello"
|
||||
- raise RuntimeError("This is an example exception")
|
||||
32 + msg = "This is an example exception"
|
||||
33 + raise RuntimeError(msg)
|
||||
34 |
|
||||
35 |
|
||||
36 | def f_msg_in_nested_scope():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:39:24
|
||||
|
|
@ -92,17 +88,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
36 36 | def nested():
|
||||
37 37 | msg = "hello"
|
||||
38 38 |
|
||||
39 |- raise RuntimeError("This is an example exception")
|
||||
39 |+ msg = "This is an example exception"
|
||||
40 |+ raise RuntimeError(msg)
|
||||
40 41 |
|
||||
41 42 |
|
||||
42 43 | def f_msg_in_parent_scope():
|
||||
36 | def nested():
|
||||
37 | msg = "hello"
|
||||
38 |
|
||||
- raise RuntimeError("This is an example exception")
|
||||
39 + msg = "This is an example exception"
|
||||
40 + raise RuntimeError(msg)
|
||||
41 |
|
||||
42 |
|
||||
43 | def f_msg_in_parent_scope():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:46:28
|
||||
|
|
@ -112,17 +107,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
43 43 | msg = "hello"
|
||||
44 44 |
|
||||
45 45 | def nested():
|
||||
46 |- raise RuntimeError("This is an example exception")
|
||||
46 |+ msg = "This is an example exception"
|
||||
47 |+ raise RuntimeError(msg)
|
||||
47 48 |
|
||||
48 49 |
|
||||
49 50 | def f_fix_indentation_check(foo):
|
||||
43 | msg = "hello"
|
||||
44 |
|
||||
45 | def nested():
|
||||
- raise RuntimeError("This is an example exception")
|
||||
46 + msg = "This is an example exception"
|
||||
47 + raise RuntimeError(msg)
|
||||
48 |
|
||||
49 |
|
||||
50 | def f_fix_indentation_check(foo):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:51:28
|
||||
|
|
@ -135,17 +129,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
53 | if foo == "foo":
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
48 48 |
|
||||
49 49 | def f_fix_indentation_check(foo):
|
||||
50 50 | if foo:
|
||||
51 |- raise RuntimeError("This is an example exception")
|
||||
51 |+ msg = "This is an example exception"
|
||||
52 |+ raise RuntimeError(msg)
|
||||
52 53 | else:
|
||||
53 54 | if foo == "foo":
|
||||
54 55 | raise RuntimeError(f"This is an exception: {foo}")
|
||||
48 |
|
||||
49 | def f_fix_indentation_check(foo):
|
||||
50 | if foo:
|
||||
- raise RuntimeError("This is an example exception")
|
||||
51 + msg = "This is an example exception"
|
||||
52 + raise RuntimeError(msg)
|
||||
53 | else:
|
||||
54 | if foo == "foo":
|
||||
55 | raise RuntimeError(f"This is an exception: {foo}")
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM102 [*] Exception must not use an f-string literal, assign to variable first
|
||||
--> EM.py:54:32
|
||||
|
|
@ -157,17 +150,16 @@ EM102 [*] Exception must not use an f-string literal, assign to variable first
|
|||
55 | raise RuntimeError("This is an exception: {}".format(foo))
|
||||
|
|
||||
help: Assign to variable; remove f-string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
51 51 | raise RuntimeError("This is an example exception")
|
||||
52 52 | else:
|
||||
53 53 | if foo == "foo":
|
||||
54 |- raise RuntimeError(f"This is an exception: {foo}")
|
||||
54 |+ msg = f"This is an exception: {foo}"
|
||||
55 |+ raise RuntimeError(msg)
|
||||
55 56 | raise RuntimeError("This is an exception: {}".format(foo))
|
||||
56 57 |
|
||||
57 58 |
|
||||
51 | raise RuntimeError("This is an example exception")
|
||||
52 | else:
|
||||
53 | if foo == "foo":
|
||||
- raise RuntimeError(f"This is an exception: {foo}")
|
||||
54 + msg = f"This is an exception: {foo}"
|
||||
55 + raise RuntimeError(msg)
|
||||
56 | raise RuntimeError("This is an exception: {}".format(foo))
|
||||
57 |
|
||||
58 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
|
||||
--> EM.py:55:24
|
||||
|
|
@ -178,17 +170,16 @@ EM103 [*] Exception must not use a `.format()` string directly, assign to variab
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove `.format()` string
|
||||
|
||||
ℹ Unsafe fix
|
||||
52 52 | else:
|
||||
53 53 | if foo == "foo":
|
||||
54 54 | raise RuntimeError(f"This is an exception: {foo}")
|
||||
55 |- raise RuntimeError("This is an exception: {}".format(foo))
|
||||
55 |+ msg = "This is an exception: {}".format(foo)
|
||||
56 |+ raise RuntimeError(msg)
|
||||
56 57 |
|
||||
57 58 |
|
||||
58 59 | # Report these, but don't fix them
|
||||
52 | else:
|
||||
53 | if foo == "foo":
|
||||
54 | raise RuntimeError(f"This is an exception: {foo}")
|
||||
- raise RuntimeError("This is an exception: {}".format(foo))
|
||||
55 + msg = "This is an exception: {}".format(foo)
|
||||
56 + raise RuntimeError(msg)
|
||||
57 |
|
||||
58 |
|
||||
59 | # Report these, but don't fix them
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:59:28
|
||||
|
|
@ -218,17 +209,16 @@ EM102 [*] Exception must not use an f-string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove f-string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
61 61 |
|
||||
62 62 |
|
||||
63 63 | def f_triple_quoted_string():
|
||||
64 |- raise RuntimeError(f"""This is an {"example"} exception""")
|
||||
64 |+ msg = f"""This is an {"example"} exception"""
|
||||
65 |+ raise RuntimeError(msg)
|
||||
65 66 |
|
||||
66 67 |
|
||||
67 68 | def f_multi_line_string():
|
||||
61 |
|
||||
62 |
|
||||
63 | def f_triple_quoted_string():
|
||||
- raise RuntimeError(f"""This is an {"example"} exception""")
|
||||
64 + msg = f"""This is an {"example"} exception"""
|
||||
65 + raise RuntimeError(msg)
|
||||
66 |
|
||||
67 |
|
||||
68 | def f_multi_line_string():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
|
||||
--> EM.py:76:9
|
||||
|
|
@ -242,23 +232,22 @@ EM103 [*] Exception must not use a `.format()` string directly, assign to variab
|
|||
79 | )
|
||||
|
|
||||
help: Assign to variable; remove `.format()` string
|
||||
|
||||
ℹ Unsafe fix
|
||||
72 72 |
|
||||
73 73 |
|
||||
74 74 | def f_multi_line_string2():
|
||||
75 |- raise RuntimeError(
|
||||
75 |+ msg = (
|
||||
76 76 | "This is an {example} exception".format(
|
||||
77 77 | example="example"
|
||||
78 78 | )
|
||||
79 79 | )
|
||||
80 |+ raise RuntimeError(
|
||||
81 |+ msg
|
||||
82 |+ )
|
||||
80 83 |
|
||||
81 84 |
|
||||
82 85 | def f_multi_line_string2():
|
||||
72 |
|
||||
73 |
|
||||
74 | def f_multi_line_string2():
|
||||
- raise RuntimeError(
|
||||
75 + msg = (
|
||||
76 | "This is an {example} exception".format(
|
||||
77 | example="example"
|
||||
78 | )
|
||||
79 | )
|
||||
80 + raise RuntimeError(
|
||||
81 + msg
|
||||
82 + )
|
||||
83 |
|
||||
84 |
|
||||
85 | def f_multi_line_string2():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
|
||||
--> EM.py:84:9
|
||||
|
|
@ -275,23 +264,22 @@ EM103 [*] Exception must not use a `.format()` string directly, assign to variab
|
|||
90 | )
|
||||
|
|
||||
help: Assign to variable; remove `.format()` string
|
||||
|
||||
ℹ Unsafe fix
|
||||
80 80 |
|
||||
81 81 |
|
||||
82 82 | def f_multi_line_string2():
|
||||
83 |- raise RuntimeError(
|
||||
83 |+ msg = (
|
||||
84 84 | (
|
||||
85 85 | "This is an "
|
||||
86 86 | "{example} exception"
|
||||
80 |
|
||||
81 |
|
||||
82 | def f_multi_line_string2():
|
||||
- raise RuntimeError(
|
||||
83 + msg = (
|
||||
84 | (
|
||||
85 | "This is an "
|
||||
86 | "{example} exception"
|
||||
--------------------------------------------------------------------------------
|
||||
88 88 | example="example"
|
||||
89 89 | )
|
||||
90 90 | )
|
||||
91 |+ raise RuntimeError(
|
||||
92 |+ msg
|
||||
93 |+ )
|
||||
91 94 |
|
||||
92 95 |
|
||||
93 96 | def raise_typing_cast_exception():
|
||||
88 | example="example"
|
||||
89 | )
|
||||
90 | )
|
||||
91 + raise RuntimeError(
|
||||
92 + msg
|
||||
93 + )
|
||||
94 |
|
||||
95 |
|
||||
96 | def raise_typing_cast_exception():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -9,17 +9,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 |
|
||||
4 4 | def f_a():
|
||||
5 |- raise RuntimeError("This is an example exception")
|
||||
5 |+ msg = "This is an example exception"
|
||||
6 |+ raise RuntimeError(msg)
|
||||
6 7 |
|
||||
7 8 |
|
||||
8 9 | def f_a_short():
|
||||
2 |
|
||||
3 |
|
||||
4 | def f_a():
|
||||
- raise RuntimeError("This is an example exception")
|
||||
5 + msg = "This is an example exception"
|
||||
6 + raise RuntimeError(msg)
|
||||
7 |
|
||||
8 |
|
||||
9 | def f_a_short():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:9:24
|
||||
|
|
@ -29,17 +28,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 |
|
||||
7 7 |
|
||||
8 8 | def f_a_short():
|
||||
9 |- raise RuntimeError("Error")
|
||||
9 |+ msg = "Error"
|
||||
10 |+ raise RuntimeError(msg)
|
||||
10 11 |
|
||||
11 12 |
|
||||
12 13 | def f_a_empty():
|
||||
6 |
|
||||
7 |
|
||||
8 | def f_a_short():
|
||||
- raise RuntimeError("Error")
|
||||
9 + msg = "Error"
|
||||
10 + raise RuntimeError(msg)
|
||||
11 |
|
||||
12 |
|
||||
13 | def f_a_empty():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:13:24
|
||||
|
|
@ -49,17 +47,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
10 10 |
|
||||
11 11 |
|
||||
12 12 | def f_a_empty():
|
||||
13 |- raise RuntimeError("")
|
||||
13 |+ msg = ""
|
||||
14 |+ raise RuntimeError(msg)
|
||||
14 15 |
|
||||
15 16 |
|
||||
16 17 | def f_b():
|
||||
10 |
|
||||
11 |
|
||||
12 | def f_a_empty():
|
||||
- raise RuntimeError("")
|
||||
13 + msg = ""
|
||||
14 + raise RuntimeError(msg)
|
||||
15 |
|
||||
16 |
|
||||
17 | def f_b():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM102 [*] Exception must not use an f-string literal, assign to variable first
|
||||
--> EM.py:18:24
|
||||
|
|
@ -70,17 +67,16 @@ EM102 [*] Exception must not use an f-string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove f-string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
15 15 |
|
||||
16 16 | def f_b():
|
||||
17 17 | example = "example"
|
||||
18 |- raise RuntimeError(f"This is an {example} exception")
|
||||
18 |+ msg = f"This is an {example} exception"
|
||||
19 |+ raise RuntimeError(msg)
|
||||
19 20 |
|
||||
20 21 |
|
||||
21 22 | def f_c():
|
||||
15 |
|
||||
16 | def f_b():
|
||||
17 | example = "example"
|
||||
- raise RuntimeError(f"This is an {example} exception")
|
||||
18 + msg = f"This is an {example} exception"
|
||||
19 + raise RuntimeError(msg)
|
||||
20 |
|
||||
21 |
|
||||
22 | def f_c():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
|
||||
--> EM.py:22:24
|
||||
|
|
@ -90,17 +86,16 @@ EM103 [*] Exception must not use a `.format()` string directly, assign to variab
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove `.format()` string
|
||||
|
||||
ℹ Unsafe fix
|
||||
19 19 |
|
||||
20 20 |
|
||||
21 21 | def f_c():
|
||||
22 |- raise RuntimeError("This is an {example} exception".format(example="example"))
|
||||
22 |+ msg = "This is an {example} exception".format(example="example")
|
||||
23 |+ raise RuntimeError(msg)
|
||||
23 24 |
|
||||
24 25 |
|
||||
25 26 | def f_ok():
|
||||
19 |
|
||||
20 |
|
||||
21 | def f_c():
|
||||
- raise RuntimeError("This is an {example} exception".format(example="example"))
|
||||
22 + msg = "This is an {example} exception".format(example="example")
|
||||
23 + raise RuntimeError(msg)
|
||||
24 |
|
||||
25 |
|
||||
26 | def f_ok():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:32:24
|
||||
|
|
@ -111,17 +106,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 |
|
||||
30 30 | def f_msg_defined():
|
||||
31 31 | msg = "hello"
|
||||
32 |- raise RuntimeError("This is an example exception")
|
||||
32 |+ msg = "This is an example exception"
|
||||
33 |+ raise RuntimeError(msg)
|
||||
33 34 |
|
||||
34 35 |
|
||||
35 36 | def f_msg_in_nested_scope():
|
||||
29 |
|
||||
30 | def f_msg_defined():
|
||||
31 | msg = "hello"
|
||||
- raise RuntimeError("This is an example exception")
|
||||
32 + msg = "This is an example exception"
|
||||
33 + raise RuntimeError(msg)
|
||||
34 |
|
||||
35 |
|
||||
36 | def f_msg_in_nested_scope():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:39:24
|
||||
|
|
@ -132,17 +126,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
36 36 | def nested():
|
||||
37 37 | msg = "hello"
|
||||
38 38 |
|
||||
39 |- raise RuntimeError("This is an example exception")
|
||||
39 |+ msg = "This is an example exception"
|
||||
40 |+ raise RuntimeError(msg)
|
||||
40 41 |
|
||||
41 42 |
|
||||
42 43 | def f_msg_in_parent_scope():
|
||||
36 | def nested():
|
||||
37 | msg = "hello"
|
||||
38 |
|
||||
- raise RuntimeError("This is an example exception")
|
||||
39 + msg = "This is an example exception"
|
||||
40 + raise RuntimeError(msg)
|
||||
41 |
|
||||
42 |
|
||||
43 | def f_msg_in_parent_scope():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:46:28
|
||||
|
|
@ -152,17 +145,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
43 43 | msg = "hello"
|
||||
44 44 |
|
||||
45 45 | def nested():
|
||||
46 |- raise RuntimeError("This is an example exception")
|
||||
46 |+ msg = "This is an example exception"
|
||||
47 |+ raise RuntimeError(msg)
|
||||
47 48 |
|
||||
48 49 |
|
||||
49 50 | def f_fix_indentation_check(foo):
|
||||
43 | msg = "hello"
|
||||
44 |
|
||||
45 | def nested():
|
||||
- raise RuntimeError("This is an example exception")
|
||||
46 + msg = "This is an example exception"
|
||||
47 + raise RuntimeError(msg)
|
||||
48 |
|
||||
49 |
|
||||
50 | def f_fix_indentation_check(foo):
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:51:28
|
||||
|
|
@ -175,17 +167,16 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
53 | if foo == "foo":
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
48 48 |
|
||||
49 49 | def f_fix_indentation_check(foo):
|
||||
50 50 | if foo:
|
||||
51 |- raise RuntimeError("This is an example exception")
|
||||
51 |+ msg = "This is an example exception"
|
||||
52 |+ raise RuntimeError(msg)
|
||||
52 53 | else:
|
||||
53 54 | if foo == "foo":
|
||||
54 55 | raise RuntimeError(f"This is an exception: {foo}")
|
||||
48 |
|
||||
49 | def f_fix_indentation_check(foo):
|
||||
50 | if foo:
|
||||
- raise RuntimeError("This is an example exception")
|
||||
51 + msg = "This is an example exception"
|
||||
52 + raise RuntimeError(msg)
|
||||
53 | else:
|
||||
54 | if foo == "foo":
|
||||
55 | raise RuntimeError(f"This is an exception: {foo}")
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM102 [*] Exception must not use an f-string literal, assign to variable first
|
||||
--> EM.py:54:32
|
||||
|
|
@ -197,17 +188,16 @@ EM102 [*] Exception must not use an f-string literal, assign to variable first
|
|||
55 | raise RuntimeError("This is an exception: {}".format(foo))
|
||||
|
|
||||
help: Assign to variable; remove f-string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
51 51 | raise RuntimeError("This is an example exception")
|
||||
52 52 | else:
|
||||
53 53 | if foo == "foo":
|
||||
54 |- raise RuntimeError(f"This is an exception: {foo}")
|
||||
54 |+ msg = f"This is an exception: {foo}"
|
||||
55 |+ raise RuntimeError(msg)
|
||||
55 56 | raise RuntimeError("This is an exception: {}".format(foo))
|
||||
56 57 |
|
||||
57 58 |
|
||||
51 | raise RuntimeError("This is an example exception")
|
||||
52 | else:
|
||||
53 | if foo == "foo":
|
||||
- raise RuntimeError(f"This is an exception: {foo}")
|
||||
54 + msg = f"This is an exception: {foo}"
|
||||
55 + raise RuntimeError(msg)
|
||||
56 | raise RuntimeError("This is an exception: {}".format(foo))
|
||||
57 |
|
||||
58 |
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
|
||||
--> EM.py:55:24
|
||||
|
|
@ -218,17 +208,16 @@ EM103 [*] Exception must not use a `.format()` string directly, assign to variab
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove `.format()` string
|
||||
|
||||
ℹ Unsafe fix
|
||||
52 52 | else:
|
||||
53 53 | if foo == "foo":
|
||||
54 54 | raise RuntimeError(f"This is an exception: {foo}")
|
||||
55 |- raise RuntimeError("This is an exception: {}".format(foo))
|
||||
55 |+ msg = "This is an exception: {}".format(foo)
|
||||
56 |+ raise RuntimeError(msg)
|
||||
56 57 |
|
||||
57 58 |
|
||||
58 59 | # Report these, but don't fix them
|
||||
52 | else:
|
||||
53 | if foo == "foo":
|
||||
54 | raise RuntimeError(f"This is an exception: {foo}")
|
||||
- raise RuntimeError("This is an exception: {}".format(foo))
|
||||
55 + msg = "This is an exception: {}".format(foo)
|
||||
56 + raise RuntimeError(msg)
|
||||
57 |
|
||||
58 |
|
||||
59 | # Report these, but don't fix them
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:59:28
|
||||
|
|
@ -258,17 +247,16 @@ EM102 [*] Exception must not use an f-string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove f-string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
61 61 |
|
||||
62 62 |
|
||||
63 63 | def f_triple_quoted_string():
|
||||
64 |- raise RuntimeError(f"""This is an {"example"} exception""")
|
||||
64 |+ msg = f"""This is an {"example"} exception"""
|
||||
65 |+ raise RuntimeError(msg)
|
||||
65 66 |
|
||||
66 67 |
|
||||
67 68 | def f_multi_line_string():
|
||||
61 |
|
||||
62 |
|
||||
63 | def f_triple_quoted_string():
|
||||
- raise RuntimeError(f"""This is an {"example"} exception""")
|
||||
64 + msg = f"""This is an {"example"} exception"""
|
||||
65 + raise RuntimeError(msg)
|
||||
66 |
|
||||
67 |
|
||||
68 | def f_multi_line_string():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM.py:69:9
|
||||
|
|
@ -281,22 +269,21 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
71 | )
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
65 65 |
|
||||
66 66 |
|
||||
67 67 | def f_multi_line_string():
|
||||
68 |- raise RuntimeError(
|
||||
68 |+ msg = (
|
||||
69 69 | "first"
|
||||
70 70 | "second"
|
||||
71 71 | )
|
||||
72 |+ raise RuntimeError(
|
||||
73 |+ msg
|
||||
74 |+ )
|
||||
72 75 |
|
||||
73 76 |
|
||||
74 77 | def f_multi_line_string2():
|
||||
65 |
|
||||
66 |
|
||||
67 | def f_multi_line_string():
|
||||
- raise RuntimeError(
|
||||
68 + msg = (
|
||||
69 | "first"
|
||||
70 | "second"
|
||||
71 | )
|
||||
72 + raise RuntimeError(
|
||||
73 + msg
|
||||
74 + )
|
||||
75 |
|
||||
76 |
|
||||
77 | def f_multi_line_string2():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
|
||||
--> EM.py:76:9
|
||||
|
|
@ -310,23 +297,22 @@ EM103 [*] Exception must not use a `.format()` string directly, assign to variab
|
|||
79 | )
|
||||
|
|
||||
help: Assign to variable; remove `.format()` string
|
||||
|
||||
ℹ Unsafe fix
|
||||
72 72 |
|
||||
73 73 |
|
||||
74 74 | def f_multi_line_string2():
|
||||
75 |- raise RuntimeError(
|
||||
75 |+ msg = (
|
||||
76 76 | "This is an {example} exception".format(
|
||||
77 77 | example="example"
|
||||
78 78 | )
|
||||
79 79 | )
|
||||
80 |+ raise RuntimeError(
|
||||
81 |+ msg
|
||||
82 |+ )
|
||||
80 83 |
|
||||
81 84 |
|
||||
82 85 | def f_multi_line_string2():
|
||||
72 |
|
||||
73 |
|
||||
74 | def f_multi_line_string2():
|
||||
- raise RuntimeError(
|
||||
75 + msg = (
|
||||
76 | "This is an {example} exception".format(
|
||||
77 | example="example"
|
||||
78 | )
|
||||
79 | )
|
||||
80 + raise RuntimeError(
|
||||
81 + msg
|
||||
82 + )
|
||||
83 |
|
||||
84 |
|
||||
85 | def f_multi_line_string2():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM103 [*] Exception must not use a `.format()` string directly, assign to variable first
|
||||
--> EM.py:84:9
|
||||
|
|
@ -343,23 +329,22 @@ EM103 [*] Exception must not use a `.format()` string directly, assign to variab
|
|||
90 | )
|
||||
|
|
||||
help: Assign to variable; remove `.format()` string
|
||||
|
||||
ℹ Unsafe fix
|
||||
80 80 |
|
||||
81 81 |
|
||||
82 82 | def f_multi_line_string2():
|
||||
83 |- raise RuntimeError(
|
||||
83 |+ msg = (
|
||||
84 84 | (
|
||||
85 85 | "This is an "
|
||||
86 86 | "{example} exception"
|
||||
80 |
|
||||
81 |
|
||||
82 | def f_multi_line_string2():
|
||||
- raise RuntimeError(
|
||||
83 + msg = (
|
||||
84 | (
|
||||
85 | "This is an "
|
||||
86 | "{example} exception"
|
||||
--------------------------------------------------------------------------------
|
||||
88 88 | example="example"
|
||||
89 89 | )
|
||||
90 90 | )
|
||||
91 |+ raise RuntimeError(
|
||||
92 |+ msg
|
||||
93 |+ )
|
||||
91 94 |
|
||||
92 95 |
|
||||
93 96 | def raise_typing_cast_exception():
|
||||
88 | example="example"
|
||||
89 | )
|
||||
90 | )
|
||||
91 + raise RuntimeError(
|
||||
92 + msg
|
||||
93 + )
|
||||
94 |
|
||||
95 |
|
||||
96 | def raise_typing_cast_exception():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -9,15 +9,14 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | def f_byte():
|
||||
2 |- raise RuntimeError(b"This is an example exception")
|
||||
2 |+ msg = b"This is an example exception"
|
||||
3 |+ raise RuntimeError(msg)
|
||||
3 4 |
|
||||
4 5 |
|
||||
5 6 | def f_byte_empty():
|
||||
1 | def f_byte():
|
||||
- raise RuntimeError(b"This is an example exception")
|
||||
2 + msg = b"This is an example exception"
|
||||
3 + raise RuntimeError(msg)
|
||||
4 |
|
||||
5 |
|
||||
6 | def f_byte_empty():
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
||||
EM101 [*] Exception must not use a string literal, assign to variable first
|
||||
--> EM101_byte_string.py:6:24
|
||||
|
|
@ -27,11 +26,10 @@ EM101 [*] Exception must not use a string literal, assign to variable first
|
|||
| ^^^
|
||||
|
|
||||
help: Assign to variable; remove string literal
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 |
|
||||
4 4 |
|
||||
5 5 | def f_byte_empty():
|
||||
6 |- raise RuntimeError(b"")
|
||||
6 |+ msg = b""
|
||||
7 |+ raise RuntimeError(msg)
|
||||
3 |
|
||||
4 |
|
||||
5 | def f_byte_empty():
|
||||
- raise RuntimeError(b"")
|
||||
6 + msg = b""
|
||||
7 + raise RuntimeError(msg)
|
||||
note: This is an unsafe fix and may change runtime behavior
|
||||
|
|
|
|||
|
|
@ -8,7 +8,5 @@ EXE004 [*] Avoid whitespace before shebang
|
|||
| ^^^^
|
||||
|
|
||||
help: Remove whitespace before shebang
|
||||
|
||||
ℹ Safe fix
|
||||
1 |- #!/usr/bin/python
|
||||
1 |+#!/usr/bin/python
|
||||
- #!/usr/bin/python
|
||||
1 + #!/usr/bin/python
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue