From af40e64d6cd1a36ac41a345900afa380e96ec413 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 1 Dec 2022 16:04:42 -0500 Subject: [PATCH] Remove Patch abstraction from Fix (#987) --- src/autofix/fixer.rs | 70 +- src/autofix/mod.rs | 39 +- src/check_ast.rs | 2 +- ...f__eradicate__tests__ERA001_ERA001.py.snap | 75 +- ...__flake8_bugbear__tests__B007_B007.py.snap | 60 +- ...ke8_bugbear__tests__B009_B009_B010.py.snap | 75 +- ...ke8_bugbear__tests__B010_B009_B010.py.snap | 75 +- ...__flake8_bugbear__tests__B011_B011.py.snap | 30 +- ...__flake8_bugbear__tests__B013_B013.py.snap | 15 +- ...__flake8_bugbear__tests__B014_B014.py.snap | 45 +- ...8_comprehensions__tests__C400_C400.py.snap | 30 +- ...8_comprehensions__tests__C401_C401.py.snap | 30 +- ...8_comprehensions__tests__C402_C402.py.snap | 30 +- ...8_comprehensions__tests__C403_C403.py.snap | 30 +- ...8_comprehensions__tests__C404_C404.py.snap | 15 +- ...8_comprehensions__tests__C405_C405.py.snap | 60 +- ...8_comprehensions__tests__C406_C406.py.snap | 60 +- ...8_comprehensions__tests__C408_C408.py.snap | 60 +- ...8_comprehensions__tests__C409_C409.py.snap | 75 +- ...8_comprehensions__tests__C410_C410.py.snap | 60 +- ...8_comprehensions__tests__C411_C411.py.snap | 15 +- ...8_comprehensions__tests__C413_C413.py.snap | 60 +- ...8_comprehensions__tests__C416_C416.py.snap | 30 +- src/flake8_print/plugins/print_call.rs | 2 +- ...ff__flake8_print__tests__T201_T201.py.snap | 15 +- ...ff__flake8_print__tests__T203_T203.py.snap | 30 +- ...tests__add_newline_before_comments.py.snap | 15 +- ...isort__tests__combine_import_froms.py.snap | 15 +- .../ruff__isort__tests__comments.py.snap | 15 +- ..._isort__tests__deduplicate_imports.py.snap | 15 +- ...uff__isort__tests__fit_line_length.py.snap | 15 +- ...rt__tests__fit_line_length_comment.py.snap | 15 +- ...t__tests__import_from_after_import.py.snap | 15 +- ...ruff__isort__tests__leading_prefix.py.snap | 30 +- .../ruff__isort__tests__order_by_type.py.snap | 15 +- ...s__order_relative_imports_by_level.py.snap | 15 +- ...ort__tests__preserve_comment_order.py.snap | 15 +- ...isort__tests__preserve_indentation.py.snap | 30 +- ...ort__tests__reorder_within_section.py.snap | 15 +- ...ests__separate_first_party_imports.py.snap | 15 +- ...rt__tests__separate_future_imports.py.snap | 15 +- ...sts__separate_local_folder_imports.py.snap | 15 +- ...ests__separate_third_party_imports.py.snap | 15 +- .../ruff__isort__tests__skip.py.snap | 15 +- ...isort__tests__sort_similar_imports.py.snap | 15 +- ...uff__isort__tests__trailing_suffix.py.snap | 30 +- ...uff__pycodestyle__tests__E711_E711.py.snap | 150 ++-- ...uff__pycodestyle__tests__E712_E712.py.snap | 165 ++--- ...uff__pycodestyle__tests__E713_E713.py.snap | 75 +- ...uff__pycodestyle__tests__E714_E714.py.snap | 30 +- ...uff__pycodestyle__tests__E731_E731.py.snap | 45 +- .../ruff__pydocstyle__tests__D201_D.py.snap | 60 +- .../ruff__pydocstyle__tests__D202_D.py.snap | 60 +- .../ruff__pydocstyle__tests__D203_D.py.snap | 45 +- .../ruff__pydocstyle__tests__D204_D.py.snap | 30 +- .../ruff__pydocstyle__tests__D205_D.py.snap | 30 +- .../ruff__pydocstyle__tests__D207_D.py.snap | 30 +- .../ruff__pydocstyle__tests__D208_D.py.snap | 45 +- .../ruff__pydocstyle__tests__D209_D.py.snap | 15 +- .../ruff__pydocstyle__tests__D210_D.py.snap | 45 +- .../ruff__pydocstyle__tests__D211_D.py.snap | 30 +- ...__pydocstyle__tests__D214_sections.py.snap | 15 +- ...__pydocstyle__tests__D215_sections.py.snap | 30 +- ...__pydocstyle__tests__D405_sections.py.snap | 30 +- ...__pydocstyle__tests__D406_sections.py.snap | 60 +- ...__pydocstyle__tests__D407_sections.py.snap | 225 +++--- ...__pydocstyle__tests__D408_sections.py.snap | 15 +- ...__pydocstyle__tests__D409_sections.py.snap | 30 +- ...__pydocstyle__tests__D410_sections.py.snap | 30 +- ...__pydocstyle__tests__D411_sections.py.snap | 45 +- ...__pydocstyle__tests__D412_sections.py.snap | 15 +- ...ruff__pyflakes__tests__F401_F401_0.py.snap | 105 ++- ...ruff__pyflakes__tests__F401_F401_5.py.snap | 60 +- ...ruff__pyflakes__tests__F401_F401_6.py.snap | 60 +- .../ruff__pyflakes__tests__F632_F632.py.snap | 45 +- .../ruff__pyflakes__tests__F901_F901.py.snap | 30 +- ...__pyflakes__tests__future_annotations.snap | 15 +- .../plugins/unnecessary_future_import.rs | 2 +- .../plugins/useless_metaclass_type.rs | 2 +- .../ruff__pyupgrade__tests__U001_U001.py.snap | 30 +- .../ruff__pyupgrade__tests__U003_U003.py.snap | 75 +- .../ruff__pyupgrade__tests__U004_U004.py.snap | 300 ++++---- .../ruff__pyupgrade__tests__U005_U005.py.snap | 60 +- .../ruff__pyupgrade__tests__U006_U006.py.snap | 60 +- .../ruff__pyupgrade__tests__U007_U007.py.snap | 105 ++- .../ruff__pyupgrade__tests__U008_U008.py.snap | 75 +- ...uff__pyupgrade__tests__U009_U009_0.py.snap | 15 +- ...uff__pyupgrade__tests__U009_U009_1.py.snap | 15 +- .../ruff__pyupgrade__tests__U010_U010.py.snap | 150 ++-- ...uff__pyupgrade__tests__U011_U011_0.py.snap | 150 ++-- .../ruff__pyupgrade__tests__U012_U012.py.snap | 225 +++--- .../ruff__pyupgrade__tests__U013_U013.py.snap | 150 ++-- .../ruff__pyupgrade__tests__U014_U014.py.snap | 45 +- .../ruff__pyupgrade__tests__U015_U015.py.snap | 660 ++++++++---------- ...tests__future_annotations_pep_585_p37.snap | 15 +- ...sts__future_annotations_pep_585_py310.snap | 30 +- ...tests__future_annotations_pep_604_p37.snap | 15 +- ...sts__future_annotations_pep_604_py310.snap | 15 +- .../ruff__rules__tests__RUF001_RUF001.py.snap | 15 +- .../ruff__rules__tests__RUF002_RUF002.py.snap | 15 +- .../ruff__rules__tests__RUF003_RUF003.py.snap | 15 +- ...uff__rules__tests__RUF101_RUF101_1.py.snap | 30 +- ...uff__rules__tests__RUF101_RUF101_2.py.snap | 30 +- ...uff__rules__tests__RUF101_RUF101_4.py.snap | 30 +- .../snapshots/ruff__rules__tests__m001.snap | 150 ++-- 105 files changed, 2594 insertions(+), 2983 deletions(-) diff --git a/src/autofix/fixer.rs b/src/autofix/fixer.rs index c03c5d697b..b71db260f0 100644 --- a/src/autofix/fixer.rs +++ b/src/autofix/fixer.rs @@ -6,7 +6,7 @@ use ropey::RopeBuilder; use rustpython_parser::ast::Location; use crate::ast::types::Range; -use crate::autofix::{Fix, Patch}; +use crate::autofix::Fix; use crate::checks::Check; use crate::source_code_locator::SourceCodeLocator; @@ -58,36 +58,36 @@ fn apply_fixes<'a>( ) -> (Cow<'a, str>, usize) { let mut output = RopeBuilder::new(); let mut last_pos: Location = Location::new(1, 0); - let mut applied: BTreeSet<&Patch> = BTreeSet::default(); + let mut applied: BTreeSet<&Fix> = BTreeSet::default(); let mut num_fixed: usize = 0; - for fix in fixes.sorted_by_key(|fix| fix.patch.location) { + for fix in fixes.sorted_by_key(|fix| fix.location) { // If we already applied an identical fix as part of another correction, skip // any re-application. - if applied.contains(&fix.patch) { + if applied.contains(&fix) { num_fixed += 1; continue; } // Best-effort approach: if this fix overlaps with a fix we've already applied, // skip it. - if last_pos > fix.patch.location { + if last_pos > fix.location { continue; } - // Add all contents from `last_pos` to `fix.patch.location`. + // Add all contents from `last_pos` to `fix.location`. let slice = locator.slice_source_code_range(&Range { location: last_pos, - end_location: fix.patch.location, + end_location: fix.location, }); output.append(&slice); // Add the patch itself. - output.append(&fix.patch.content); + output.append(&fix.content); // Track that the fix was applied. - last_pos = fix.patch.end_location; - applied.insert(&fix.patch); + last_pos = fix.end_location; + applied.insert(fix); num_fixed += 1; } @@ -103,7 +103,7 @@ mod tests { use rustpython_parser::ast::Location; use crate::autofix::fixer::apply_fixes; - use crate::autofix::{Fix, Patch}; + use crate::autofix::Fix; use crate::SourceCodeLocator; #[test] @@ -118,11 +118,9 @@ mod tests { #[test] fn apply_single_replacement() { let fixes = vec![Fix { - patch: Patch { - content: "Bar".to_string(), - location: Location::new(1, 8), - end_location: Location::new(1, 14), - }, + content: "Bar".to_string(), + location: Location::new(1, 8), + end_location: Location::new(1, 14), }]; let locator = SourceCodeLocator::new( r#" @@ -146,11 +144,9 @@ class A(Bar): #[test] fn apply_single_removal() { let fixes = vec![Fix { - patch: Patch { - content: String::new(), - location: Location::new(1, 7), - end_location: Location::new(1, 15), - }, + content: String::new(), + location: Location::new(1, 7), + end_location: Location::new(1, 15), }]; let locator = SourceCodeLocator::new( r#" @@ -175,18 +171,14 @@ class A: fn apply_double_removal() { let fixes = vec![ Fix { - patch: Patch { - content: String::new(), - location: Location::new(1, 7), - end_location: Location::new(1, 16), - }, + content: String::new(), + location: Location::new(1, 7), + end_location: Location::new(1, 16), }, Fix { - patch: Patch { - content: String::new(), - location: Location::new(1, 16), - end_location: Location::new(1, 23), - }, + content: String::new(), + location: Location::new(1, 16), + end_location: Location::new(1, 23), }, ]; let locator = SourceCodeLocator::new( @@ -213,18 +205,14 @@ class A: fn ignore_overlapping_fixes() { let fixes = vec![ Fix { - patch: Patch { - content: String::new(), - location: Location::new(1, 7), - end_location: Location::new(1, 15), - }, + content: String::new(), + location: Location::new(1, 7), + end_location: Location::new(1, 15), }, Fix { - patch: Patch { - content: "ignored".to_string(), - location: Location::new(1, 9), - end_location: Location::new(1, 11), - }, + content: "ignored".to_string(), + location: Location::new(1, 9), + end_location: Location::new(1, 11), }, ]; let locator = SourceCodeLocator::new( diff --git a/src/autofix/mod.rs b/src/autofix/mod.rs index 5fd61d575d..f340e93802 100644 --- a/src/autofix/mod.rs +++ b/src/autofix/mod.rs @@ -5,55 +5,42 @@ pub mod fixer; pub mod helpers; #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] -pub struct Patch { +pub struct Fix { pub content: String, pub location: Location, pub end_location: Location, } -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct Fix { - pub patch: Patch, -} - impl Fix { pub fn deletion(start: Location, end: Location) -> Self { Self { - patch: Patch { - content: String::new(), - location: start, - end_location: end, - }, + content: String::new(), + location: start, + end_location: end, } } pub fn replacement(content: String, start: Location, end: Location) -> Self { Self { - patch: Patch { - content, - location: start, - end_location: end, - }, + content, + location: start, + end_location: end, } } pub fn insertion(content: String, at: Location) -> Self { Self { - patch: Patch { - content, - location: at, - end_location: at, - }, + content, + location: at, + end_location: at, } } pub fn dummy(location: Location) -> Self { Self { - patch: Patch { - content: String::new(), - location, - end_location: location, - }, + content: String::new(), + location, + end_location: location, } } } diff --git a/src/check_ast.rs b/src/check_ast.rs index 1233b6ef5e..a4ceecd6df 100644 --- a/src/check_ast.rs +++ b/src/check_ast.rs @@ -2990,7 +2990,7 @@ impl<'a> Checker<'a> { &deleted, ) { Ok(fix) => { - if fix.patch.content.is_empty() || fix.patch.content == "pass" { + if fix.content.is_empty() || fix.content == "pass" { self.deletions.insert(defined_by); } Some(fix) diff --git a/src/eradicate/snapshots/ruff__eradicate__tests__ERA001_ERA001.py.snap b/src/eradicate/snapshots/ruff__eradicate__tests__ERA001_ERA001.py.snap index fc5aac4def..b3cd1d6f1c 100644 --- a/src/eradicate/snapshots/ruff__eradicate__tests__ERA001_ERA001.py.snap +++ b/src/eradicate/snapshots/ruff__eradicate__tests__ERA001_ERA001.py.snap @@ -10,14 +10,13 @@ expression: checks row: 1 column: 10 fix: - patch: - content: "" - location: - row: 1 - column: 0 - end_location: - row: 2 - column: 0 + content: "" + location: + row: 1 + column: 0 + end_location: + row: 2 + column: 0 - kind: CommentedOutCode location: row: 2 @@ -26,14 +25,13 @@ expression: checks row: 2 column: 22 fix: - patch: - content: "" - location: - row: 2 - column: 0 - end_location: - row: 3 - column: 0 + content: "" + location: + row: 2 + column: 0 + end_location: + row: 3 + column: 0 - kind: CommentedOutCode location: row: 3 @@ -42,14 +40,13 @@ expression: checks row: 3 column: 6 fix: - patch: - content: "" - location: - row: 3 - column: 0 - end_location: - row: 4 - column: 0 + content: "" + location: + row: 3 + column: 0 + end_location: + row: 4 + column: 0 - kind: CommentedOutCode location: row: 5 @@ -58,14 +55,13 @@ expression: checks row: 5 column: 13 fix: - patch: - content: "" - location: - row: 5 - column: 0 - end_location: - row: 6 - column: 0 + content: "" + location: + row: 5 + column: 0 + end_location: + row: 6 + column: 0 - kind: CommentedOutCode location: row: 12 @@ -74,12 +70,11 @@ expression: checks row: 12 column: 16 fix: - patch: - content: "" - location: - row: 12 - column: 0 - end_location: - row: 13 - column: 0 + content: "" + location: + row: 12 + column: 0 + end_location: + row: 13 + column: 0 diff --git a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B007_B007.py.snap b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B007_B007.py.snap index 4c4da78829..ac1939a98e 100644 --- a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B007_B007.py.snap +++ b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B007_B007.py.snap @@ -11,14 +11,13 @@ expression: checks row: 6 column: 5 fix: - patch: - content: _i - location: - row: 6 - column: 4 - end_location: - row: 6 - column: 5 + content: _i + location: + row: 6 + column: 4 + end_location: + row: 6 + column: 5 - kind: UnusedLoopControlVariable: k location: @@ -28,14 +27,13 @@ expression: checks row: 18 column: 13 fix: - patch: - content: _k - location: - row: 18 - column: 12 - end_location: - row: 18 - column: 13 + content: _k + location: + row: 18 + column: 12 + end_location: + row: 18 + column: 13 - kind: UnusedLoopControlVariable: i location: @@ -45,14 +43,13 @@ expression: checks row: 30 column: 5 fix: - patch: - content: _i - location: - row: 30 - column: 4 - end_location: - row: 30 - column: 5 + content: _i + location: + row: 30 + column: 4 + end_location: + row: 30 + column: 5 - kind: UnusedLoopControlVariable: k location: @@ -62,12 +59,11 @@ expression: checks row: 30 column: 13 fix: - patch: - content: _k - location: - row: 30 - column: 12 - end_location: - row: 30 - column: 13 + content: _k + location: + row: 30 + column: 12 + end_location: + row: 30 + column: 13 diff --git a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B009_B009_B010.py.snap b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B009_B009_B010.py.snap index 8332cfbf89..49fcace529 100644 --- a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B009_B009_B010.py.snap +++ b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B009_B009_B010.py.snap @@ -10,14 +10,13 @@ expression: checks row: 18 column: 19 fix: - patch: - content: foo.bar - location: - row: 18 - column: 0 - end_location: - row: 18 - column: 19 + content: foo.bar + location: + row: 18 + column: 0 + end_location: + row: 18 + column: 19 - kind: GetAttrWithConstant location: row: 19 @@ -26,14 +25,13 @@ expression: checks row: 19 column: 23 fix: - patch: - content: foo._123abc - location: - row: 19 - column: 0 - end_location: - row: 19 - column: 23 + content: foo._123abc + location: + row: 19 + column: 0 + end_location: + row: 19 + column: 23 - kind: GetAttrWithConstant location: row: 20 @@ -42,14 +40,13 @@ expression: checks row: 20 column: 22 fix: - patch: - content: foo.abc123 - location: - row: 20 - column: 0 - end_location: - row: 20 - column: 22 + content: foo.abc123 + location: + row: 20 + column: 0 + end_location: + row: 20 + column: 22 - kind: GetAttrWithConstant location: row: 21 @@ -58,14 +55,13 @@ expression: checks row: 21 column: 23 fix: - patch: - content: foo.abc123 - location: - row: 21 - column: 0 - end_location: - row: 21 - column: 23 + content: foo.abc123 + location: + row: 21 + column: 0 + end_location: + row: 21 + column: 23 - kind: GetAttrWithConstant location: row: 22 @@ -74,12 +70,11 @@ expression: checks row: 22 column: 31 fix: - patch: - content: x.bar - location: - row: 22 - column: 14 - end_location: - row: 22 - column: 31 + content: x.bar + location: + row: 22 + column: 14 + end_location: + row: 22 + column: 31 diff --git a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B010_B009_B010.py.snap b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B010_B009_B010.py.snap index 56837bc121..26d438ef97 100644 --- a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B010_B009_B010.py.snap +++ b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B010_B009_B010.py.snap @@ -10,14 +10,13 @@ expression: checks row: 33 column: 25 fix: - patch: - content: foo.bar = None - location: - row: 33 - column: 0 - end_location: - row: 33 - column: 25 + content: foo.bar = None + location: + row: 33 + column: 0 + end_location: + row: 33 + column: 25 - kind: SetAttrWithConstant location: row: 34 @@ -26,14 +25,13 @@ expression: checks row: 34 column: 29 fix: - patch: - content: foo._123abc = None - location: - row: 34 - column: 0 - end_location: - row: 34 - column: 29 + content: foo._123abc = None + location: + row: 34 + column: 0 + end_location: + row: 34 + column: 29 - kind: SetAttrWithConstant location: row: 35 @@ -42,14 +40,13 @@ expression: checks row: 35 column: 28 fix: - patch: - content: foo.abc123 = None - location: - row: 35 - column: 0 - end_location: - row: 35 - column: 28 + content: foo.abc123 = None + location: + row: 35 + column: 0 + end_location: + row: 35 + column: 28 - kind: SetAttrWithConstant location: row: 36 @@ -58,14 +55,13 @@ expression: checks row: 36 column: 29 fix: - patch: - content: foo.abc123 = None - location: - row: 36 - column: 0 - end_location: - row: 36 - column: 29 + content: foo.abc123 = None + location: + row: 36 + column: 0 + end_location: + row: 36 + column: 29 - kind: SetAttrWithConstant location: row: 37 @@ -74,12 +70,11 @@ expression: checks row: 37 column: 30 fix: - patch: - content: foo.bar.baz = None - location: - row: 37 - column: 0 - end_location: - row: 37 - column: 30 + content: foo.bar.baz = None + location: + row: 37 + column: 0 + end_location: + row: 37 + column: 30 diff --git a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B011_B011.py.snap b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B011_B011.py.snap index 14f86088f6..004b4ba4e3 100644 --- a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B011_B011.py.snap +++ b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B011_B011.py.snap @@ -10,14 +10,13 @@ expression: checks row: 8 column: 12 fix: - patch: - content: raise AssertionError() - location: - row: 8 - column: 0 - end_location: - row: 8 - column: 12 + content: raise AssertionError() + location: + row: 8 + column: 0 + end_location: + row: 8 + column: 12 - kind: DoNotAssertFalse location: row: 10 @@ -26,12 +25,11 @@ expression: checks row: 10 column: 12 fix: - patch: - content: "raise AssertionError('message')" - location: - row: 10 - column: 0 - end_location: - row: 10 - column: 23 + content: "raise AssertionError('message')" + location: + row: 10 + column: 0 + end_location: + row: 10 + column: 23 diff --git a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B013_B013.py.snap b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B013_B013.py.snap index 8e279a3606..0214640f68 100644 --- a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B013_B013.py.snap +++ b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B013_B013.py.snap @@ -11,12 +11,11 @@ expression: checks row: 3 column: 19 fix: - patch: - content: ValueError - location: - row: 3 - column: 7 - end_location: - row: 3 - column: 20 + content: ValueError + location: + row: 3 + column: 7 + end_location: + row: 3 + column: 20 diff --git a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B014_B014.py.snap b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B014_B014.py.snap index 8eec40c5c3..b34fbcbfa7 100644 --- a/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B014_B014.py.snap +++ b/src/flake8_bugbear/snapshots/ruff__flake8_bugbear__tests__B014_B014.py.snap @@ -12,14 +12,13 @@ expression: checks row: 17 column: 24 fix: - patch: - content: "OSError," - location: - row: 17 - column: 8 - end_location: - row: 17 - column: 24 + content: "OSError," + location: + row: 17 + column: 8 + end_location: + row: 17 + column: 24 - kind: DuplicateHandlerException: - MyError @@ -30,14 +29,13 @@ expression: checks row: 28 column: 24 fix: - patch: - content: "MyError," - location: - row: 28 - column: 8 - end_location: - row: 28 - column: 24 + content: "MyError," + location: + row: 28 + column: 8 + end_location: + row: 28 + column: 24 - kind: DuplicateHandlerException: - re.error @@ -48,12 +46,11 @@ expression: checks row: 49 column: 26 fix: - patch: - content: "re.error," - location: - row: 49 - column: 8 - end_location: - row: 49 - column: 26 + content: "re.error," + location: + row: 49 + column: 8 + end_location: + row: 49 + column: 26 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C400_C400.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C400_C400.py.snap index 0261badeea..b73743bfa2 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C400_C400.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C400_C400.py.snap @@ -10,14 +10,13 @@ expression: checks row: 1 column: 29 fix: - patch: - content: "[x for x in range(3)]" - location: - row: 1 - column: 4 - end_location: - row: 1 - column: 29 + content: "[x for x in range(3)]" + location: + row: 1 + column: 4 + end_location: + row: 1 + column: 29 - kind: UnnecessaryGeneratorList location: row: 2 @@ -26,12 +25,11 @@ expression: checks row: 4 column: 1 fix: - patch: - content: "[\n x for x in range(3)\n]" - location: - row: 2 - column: 4 - end_location: - row: 4 - column: 1 + content: "[\n x for x in range(3)\n]" + location: + row: 2 + column: 4 + end_location: + row: 4 + column: 1 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C401_C401.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C401_C401.py.snap index ba7b007ffe..0be6857f20 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C401_C401.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C401_C401.py.snap @@ -10,14 +10,13 @@ expression: checks row: 1 column: 28 fix: - patch: - content: "{x for x in range(3)}" - location: - row: 1 - column: 4 - end_location: - row: 1 - column: 28 + content: "{x for x in range(3)}" + location: + row: 1 + column: 4 + end_location: + row: 1 + column: 28 - kind: UnnecessaryGeneratorSet location: row: 2 @@ -26,12 +25,11 @@ expression: checks row: 4 column: 1 fix: - patch: - content: "{\n x for x in range(3)\n}" - location: - row: 2 - column: 4 - end_location: - row: 4 - column: 1 + content: "{\n x for x in range(3)\n}" + location: + row: 2 + column: 4 + end_location: + row: 4 + column: 1 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C402_C402.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C402_C402.py.snap index ea0bdf3ee9..404d1b5310 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C402_C402.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C402_C402.py.snap @@ -10,14 +10,13 @@ expression: checks row: 1 column: 30 fix: - patch: - content: "{x: x for x in range(3)}" - location: - row: 1 - column: 0 - end_location: - row: 1 - column: 30 + content: "{x: x for x in range(3)}" + location: + row: 1 + column: 0 + end_location: + row: 1 + column: 30 - kind: UnnecessaryGeneratorDict location: row: 2 @@ -26,12 +25,11 @@ expression: checks row: 4 column: 1 fix: - patch: - content: "{\n x: x for x in range(3)\n}" - location: - row: 2 - column: 0 - end_location: - row: 4 - column: 1 + content: "{\n x: x for x in range(3)\n}" + location: + row: 2 + column: 0 + end_location: + row: 4 + column: 1 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C403_C403.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C403_C403.py.snap index 1829c23225..194e4a1e6a 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C403_C403.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C403_C403.py.snap @@ -10,14 +10,13 @@ expression: checks row: 1 column: 30 fix: - patch: - content: "{x for x in range(3)}" - location: - row: 1 - column: 4 - end_location: - row: 1 - column: 30 + content: "{x for x in range(3)}" + location: + row: 1 + column: 4 + end_location: + row: 1 + column: 30 - kind: UnnecessaryListComprehensionSet location: row: 2 @@ -26,12 +25,11 @@ expression: checks row: 4 column: 1 fix: - patch: - content: "{\n x for x in range(3)\n}" - location: - row: 2 - column: 4 - end_location: - row: 4 - column: 1 + content: "{\n x for x in range(3)\n}" + location: + row: 2 + column: 4 + end_location: + row: 4 + column: 1 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C404_C404.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C404_C404.py.snap index dfef6434da..964f07528b 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C404_C404.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C404_C404.py.snap @@ -10,12 +10,11 @@ expression: checks row: 1 column: 32 fix: - patch: - content: "{i: i for i in range(3)}" - location: - row: 1 - column: 0 - end_location: - row: 1 - column: 32 + content: "{i: i for i in range(3)}" + location: + row: 1 + column: 0 + end_location: + row: 1 + column: 32 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C405_C405.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C405_C405.py.snap index 0c32029dbe..c13f231e1c 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C405_C405.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C405_C405.py.snap @@ -11,14 +11,13 @@ expression: checks row: 1 column: 16 fix: - patch: - content: "{1, 2}" - location: - row: 1 - column: 5 - end_location: - row: 1 - column: 16 + content: "{1, 2}" + location: + row: 1 + column: 5 + end_location: + row: 1 + column: 16 - kind: UnnecessaryLiteralSet: tuple location: @@ -28,14 +27,13 @@ expression: checks row: 2 column: 16 fix: - patch: - content: "{1, 2}" - location: - row: 2 - column: 5 - end_location: - row: 2 - column: 16 + content: "{1, 2}" + location: + row: 2 + column: 5 + end_location: + row: 2 + column: 16 - kind: UnnecessaryLiteralSet: list location: @@ -45,14 +43,13 @@ expression: checks row: 3 column: 12 fix: - patch: - content: set() - location: - row: 3 - column: 5 - end_location: - row: 3 - column: 12 + content: set() + location: + row: 3 + column: 5 + end_location: + row: 3 + column: 12 - kind: UnnecessaryLiteralSet: tuple location: @@ -62,12 +59,11 @@ expression: checks row: 4 column: 12 fix: - patch: - content: set() - location: - row: 4 - column: 5 - end_location: - row: 4 - column: 12 + content: set() + location: + row: 4 + column: 5 + end_location: + row: 4 + column: 12 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C406_C406.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C406_C406.py.snap index 6ddc9dd728..be55a42b2c 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C406_C406.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C406_C406.py.snap @@ -11,14 +11,13 @@ expression: checks row: 1 column: 19 fix: - patch: - content: "{1: 2}" - location: - row: 1 - column: 5 - end_location: - row: 1 - column: 19 + content: "{1: 2}" + location: + row: 1 + column: 5 + end_location: + row: 1 + column: 19 - kind: UnnecessaryLiteralDict: tuple location: @@ -28,14 +27,13 @@ expression: checks row: 2 column: 20 fix: - patch: - content: "{1: 2,}" - location: - row: 2 - column: 5 - end_location: - row: 2 - column: 20 + content: "{1: 2,}" + location: + row: 2 + column: 5 + end_location: + row: 2 + column: 20 - kind: UnnecessaryLiteralDict: list location: @@ -45,14 +43,13 @@ expression: checks row: 3 column: 13 fix: - patch: - content: "{}" - location: - row: 3 - column: 5 - end_location: - row: 3 - column: 13 + content: "{}" + location: + row: 3 + column: 5 + end_location: + row: 3 + column: 13 - kind: UnnecessaryLiteralDict: tuple location: @@ -62,12 +59,11 @@ expression: checks row: 4 column: 13 fix: - patch: - content: "{}" - location: - row: 4 - column: 5 - end_location: - row: 4 - column: 13 + content: "{}" + location: + row: 4 + column: 5 + end_location: + row: 4 + column: 13 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C408_C408.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C408_C408.py.snap index 8410fc240a..2124c54aea 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C408_C408.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C408_C408.py.snap @@ -11,14 +11,13 @@ expression: checks row: 1 column: 11 fix: - patch: - content: () - location: - row: 1 - column: 4 - end_location: - row: 1 - column: 11 + content: () + location: + row: 1 + column: 4 + end_location: + row: 1 + column: 11 - kind: UnnecessaryCollectionCall: list location: @@ -28,14 +27,13 @@ expression: checks row: 2 column: 10 fix: - patch: - content: "[]" - location: - row: 2 - column: 4 - end_location: - row: 2 - column: 10 + content: "[]" + location: + row: 2 + column: 4 + end_location: + row: 2 + column: 10 - kind: UnnecessaryCollectionCall: dict location: @@ -45,14 +43,13 @@ expression: checks row: 3 column: 11 fix: - patch: - content: "{}" - location: - row: 3 - column: 5 - end_location: - row: 3 - column: 11 + content: "{}" + location: + row: 3 + column: 5 + end_location: + row: 3 + column: 11 - kind: UnnecessaryCollectionCall: dict location: @@ -62,12 +59,11 @@ expression: checks row: 4 column: 14 fix: - patch: - content: "{\"a\": 1}" - location: - row: 4 - column: 5 - end_location: - row: 4 - column: 14 + content: "{\"a\": 1}" + location: + row: 4 + column: 5 + end_location: + row: 4 + column: 14 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C409_C409.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C409_C409.py.snap index 446ab288ad..e2f55a73dc 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C409_C409.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C409_C409.py.snap @@ -11,14 +11,13 @@ expression: checks row: 1 column: 14 fix: - patch: - content: () - location: - row: 1 - column: 5 - end_location: - row: 1 - column: 14 + content: () + location: + row: 1 + column: 5 + end_location: + row: 1 + column: 14 - kind: UnnecessaryLiteralWithinTupleCall: list location: @@ -28,14 +27,13 @@ expression: checks row: 2 column: 18 fix: - patch: - content: "(1, 2)" - location: - row: 2 - column: 5 - end_location: - row: 2 - column: 18 + content: "(1, 2)" + location: + row: 2 + column: 5 + end_location: + row: 2 + column: 18 - kind: UnnecessaryLiteralWithinTupleCall: tuple location: @@ -45,14 +43,13 @@ expression: checks row: 3 column: 18 fix: - patch: - content: "(1, 2)" - location: - row: 3 - column: 5 - end_location: - row: 3 - column: 18 + content: "(1, 2)" + location: + row: 3 + column: 5 + end_location: + row: 3 + column: 18 - kind: UnnecessaryLiteralWithinTupleCall: list location: @@ -62,14 +59,13 @@ expression: checks row: 7 column: 2 fix: - patch: - content: "(\n 1,\n 2\n)" - location: - row: 4 - column: 5 - end_location: - row: 7 - column: 2 + content: "(\n 1,\n 2\n)" + location: + row: 4 + column: 5 + end_location: + row: 7 + column: 2 - kind: UnnecessaryLiteralWithinTupleCall: tuple location: @@ -79,12 +75,11 @@ expression: checks row: 10 column: 1 fix: - patch: - content: "(1, 2)" - location: - row: 8 - column: 5 - end_location: - row: 10 - column: 1 + content: "(1, 2)" + location: + row: 8 + column: 5 + end_location: + row: 10 + column: 1 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C410_C410.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C410_C410.py.snap index 1ba8f4ae79..69dc509c31 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C410_C410.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C410_C410.py.snap @@ -11,14 +11,13 @@ expression: checks row: 1 column: 17 fix: - patch: - content: "[1, 2]" - location: - row: 1 - column: 5 - end_location: - row: 1 - column: 17 + content: "[1, 2]" + location: + row: 1 + column: 5 + end_location: + row: 1 + column: 17 - kind: UnnecessaryLiteralWithinListCall: tuple location: @@ -28,14 +27,13 @@ expression: checks row: 2 column: 17 fix: - patch: - content: "[1, 2]" - location: - row: 2 - column: 5 - end_location: - row: 2 - column: 17 + content: "[1, 2]" + location: + row: 2 + column: 5 + end_location: + row: 2 + column: 17 - kind: UnnecessaryLiteralWithinListCall: list location: @@ -45,14 +43,13 @@ expression: checks row: 3 column: 13 fix: - patch: - content: "[]" - location: - row: 3 - column: 5 - end_location: - row: 3 - column: 13 + content: "[]" + location: + row: 3 + column: 5 + end_location: + row: 3 + column: 13 - kind: UnnecessaryLiteralWithinListCall: tuple location: @@ -62,12 +59,11 @@ expression: checks row: 4 column: 13 fix: - patch: - content: "[]" - location: - row: 4 - column: 5 - end_location: - row: 4 - column: 13 + content: "[]" + location: + row: 4 + column: 5 + end_location: + row: 4 + column: 13 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C411_C411.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C411_C411.py.snap index ea46a669ea..7df4bccae2 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C411_C411.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C411_C411.py.snap @@ -10,12 +10,11 @@ expression: checks row: 2 column: 20 fix: - patch: - content: "[i for i in x]" - location: - row: 2 - column: 0 - end_location: - row: 2 - column: 20 + content: "[i for i in x]" + location: + row: 2 + column: 0 + end_location: + row: 2 + column: 20 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C413_C413.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C413_C413.py.snap index 93e0cf215a..84adad0497 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C413_C413.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C413_C413.py.snap @@ -11,14 +11,13 @@ expression: checks row: 3 column: 15 fix: - patch: - content: sorted(x) - location: - row: 3 - column: 0 - end_location: - row: 3 - column: 15 + content: sorted(x) + location: + row: 3 + column: 0 + end_location: + row: 3 + column: 15 - kind: UnnecessaryCallAroundSorted: reversed location: @@ -28,14 +27,13 @@ expression: checks row: 4 column: 19 fix: - patch: - content: "sorted(x, reverse=True)" - location: - row: 4 - column: 0 - end_location: - row: 4 - column: 19 + content: "sorted(x, reverse=True)" + location: + row: 4 + column: 0 + end_location: + row: 4 + column: 19 - kind: UnnecessaryCallAroundSorted: reversed location: @@ -45,14 +43,13 @@ expression: checks row: 5 column: 36 fix: - patch: - content: "sorted(x, key=lambda e: e, reverse=True)" - location: - row: 5 - column: 0 - end_location: - row: 5 - column: 36 + content: "sorted(x, key=lambda e: e, reverse=True)" + location: + row: 5 + column: 0 + end_location: + row: 5 + column: 36 - kind: UnnecessaryCallAroundSorted: reversed location: @@ -62,12 +59,11 @@ expression: checks row: 6 column: 33 fix: - patch: - content: "sorted(x, reverse=True)" - location: - row: 6 - column: 0 - end_location: - row: 6 - column: 33 + content: "sorted(x, reverse=True)" + location: + row: 6 + column: 0 + end_location: + row: 6 + column: 33 diff --git a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C416_C416.py.snap b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C416_C416.py.snap index 71f2c38471..eb3bcb1af9 100644 --- a/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C416_C416.py.snap +++ b/src/flake8_comprehensions/snapshots/ruff__flake8_comprehensions__tests__C416_C416.py.snap @@ -11,14 +11,13 @@ expression: checks row: 2 column: 14 fix: - patch: - content: list(x) - location: - row: 2 - column: 0 - end_location: - row: 2 - column: 14 + content: list(x) + location: + row: 2 + column: 0 + end_location: + row: 2 + column: 14 - kind: UnnecessaryComprehension: set location: @@ -28,12 +27,11 @@ expression: checks row: 3 column: 14 fix: - patch: - content: set(x) - location: - row: 3 - column: 0 - end_location: - row: 3 - column: 14 + content: set(x) + location: + row: 3 + column: 0 + end_location: + row: 3 + column: 14 diff --git a/src/flake8_print/plugins/print_call.rs b/src/flake8_print/plugins/print_call.rs index f32f18c2e1..09448904a7 100644 --- a/src/flake8_print/plugins/print_call.rs +++ b/src/flake8_print/plugins/print_call.rs @@ -32,7 +32,7 @@ pub fn print_call(checker: &mut Checker, expr: &Expr, func: &Expr) { &deleted, ) { Ok(fix) => { - if fix.patch.content.is_empty() || fix.patch.content == "pass" { + if fix.content.is_empty() || fix.content == "pass" { checker.deletions.insert(context.defined_by); } check.amend(fix); diff --git a/src/flake8_print/snapshots/ruff__flake8_print__tests__T201_T201.py.snap b/src/flake8_print/snapshots/ruff__flake8_print__tests__T201_T201.py.snap index 8e0233ecfa..523f91daa9 100644 --- a/src/flake8_print/snapshots/ruff__flake8_print__tests__T201_T201.py.snap +++ b/src/flake8_print/snapshots/ruff__flake8_print__tests__T201_T201.py.snap @@ -10,12 +10,11 @@ expression: checks row: 1 column: 22 fix: - patch: - content: "" - location: - row: 1 - column: 0 - end_location: - row: 2 - column: 0 + content: "" + location: + row: 1 + column: 0 + end_location: + row: 2 + column: 0 diff --git a/src/flake8_print/snapshots/ruff__flake8_print__tests__T203_T203.py.snap b/src/flake8_print/snapshots/ruff__flake8_print__tests__T203_T203.py.snap index e67734dc58..30312923ac 100644 --- a/src/flake8_print/snapshots/ruff__flake8_print__tests__T203_T203.py.snap +++ b/src/flake8_print/snapshots/ruff__flake8_print__tests__T203_T203.py.snap @@ -10,14 +10,13 @@ expression: checks row: 3 column: 23 fix: - patch: - content: "" - location: - row: 3 - column: 0 - end_location: - row: 4 - column: 0 + content: "" + location: + row: 3 + column: 0 + end_location: + row: 4 + column: 0 - kind: PPrintFound location: row: 8 @@ -26,12 +25,11 @@ expression: checks row: 8 column: 30 fix: - patch: - content: "" - location: - row: 8 - column: 0 - end_location: - row: 9 - column: 0 + content: "" + location: + row: 8 + column: 0 + end_location: + row: 9 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__add_newline_before_comments.py.snap b/src/isort/snapshots/ruff__isort__tests__add_newline_before_comments.py.snap index 474fcdfe92..9d1240ee9c 100644 --- a/src/isort/snapshots/ruff__isort__tests__add_newline_before_comments.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__add_newline_before_comments.py.snap @@ -10,12 +10,11 @@ expression: checks row: 8 column: 0 fix: - patch: - content: "import os\n\n# This is a comment in the same section, so we need to add one newline.\nimport sys\n\nimport numpy as np\n\n# This is a comment, but it starts a new section, so we don't need to add a newline\n# before it.\nimport leading_prefix\n" - location: - row: 1 - column: 0 - end_location: - row: 8 - column: 0 + content: "import os\n\n# This is a comment in the same section, so we need to add one newline.\nimport sys\n\nimport numpy as np\n\n# This is a comment, but it starts a new section, so we don't need to add a newline\n# before it.\nimport leading_prefix\n" + location: + row: 1 + column: 0 + end_location: + row: 8 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__combine_import_froms.py.snap b/src/isort/snapshots/ruff__isort__tests__combine_import_froms.py.snap index 458a6f7470..7b4e1f4705 100644 --- a/src/isort/snapshots/ruff__isort__tests__combine_import_froms.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__combine_import_froms.py.snap @@ -10,12 +10,11 @@ expression: checks row: 6 column: 0 fix: - patch: - content: "from collections import (\n AsyncIterable,\n Awaitable,\n ChainMap,\n Collection,\n MutableMapping,\n MutableSequence,\n)\n" - location: - row: 1 - column: 0 - end_location: - row: 6 - column: 0 + content: "from collections import (\n AsyncIterable,\n Awaitable,\n ChainMap,\n Collection,\n MutableMapping,\n MutableSequence,\n)\n" + location: + row: 1 + column: 0 + end_location: + row: 6 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__comments.py.snap b/src/isort/snapshots/ruff__isort__tests__comments.py.snap index 2d8036b864..44bddcda4f 100644 --- a/src/isort/snapshots/ruff__isort__tests__comments.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__comments.py.snap @@ -10,12 +10,11 @@ expression: checks row: 26 column: 0 fix: - patch: - content: "import B # Comment 4\n\n# Comment 3a\n# Comment 3b\nimport C\nimport D\n\n# Comment 5\n# Comment 6\nfrom A import (\n a, # Comment 7 # Comment 9\n b, # Comment 10\n c, # Comment 8 # Comment 11\n)\n" - location: - row: 3 - column: 0 - end_location: - row: 26 - column: 0 + content: "import B # Comment 4\n\n# Comment 3a\n# Comment 3b\nimport C\nimport D\n\n# Comment 5\n# Comment 6\nfrom A import (\n a, # Comment 7 # Comment 9\n b, # Comment 10\n c, # Comment 8 # Comment 11\n)\n" + location: + row: 3 + column: 0 + end_location: + row: 26 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__deduplicate_imports.py.snap b/src/isort/snapshots/ruff__isort__tests__deduplicate_imports.py.snap index 36fcb14571..8e9be17164 100644 --- a/src/isort/snapshots/ruff__isort__tests__deduplicate_imports.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__deduplicate_imports.py.snap @@ -10,12 +10,11 @@ expression: checks row: 5 column: 0 fix: - patch: - content: "import os\nimport os as os1\nimport os as os2\n" - location: - row: 1 - column: 0 - end_location: - row: 5 - column: 0 + content: "import os\nimport os as os1\nimport os as os2\n" + location: + row: 1 + column: 0 + end_location: + row: 5 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__fit_line_length.py.snap b/src/isort/snapshots/ruff__isort__tests__fit_line_length.py.snap index 35aaea0979..d2a8c9b3e8 100644 --- a/src/isort/snapshots/ruff__isort__tests__fit_line_length.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__fit_line_length.py.snap @@ -10,12 +10,11 @@ expression: checks row: 15 column: 0 fix: - patch: - content: " from line_with_88 import aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n from line_with_89 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_90 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_91 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_92 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_93 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n" - location: - row: 7 - column: 0 - end_location: - row: 15 - column: 0 + content: " from line_with_88 import aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n from line_with_89 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_90 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_91 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_92 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n from line_with_93 import (\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n )\n" + location: + row: 7 + column: 0 + end_location: + row: 15 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__fit_line_length_comment.py.snap b/src/isort/snapshots/ruff__isort__tests__fit_line_length_comment.py.snap index f2ab51d8eb..80d84c662f 100644 --- a/src/isort/snapshots/ruff__isort__tests__fit_line_length_comment.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__fit_line_length_comment.py.snap @@ -10,12 +10,11 @@ expression: checks row: 5 column: 0 fix: - patch: - content: "import a\n\n# Don't take this comment into account when determining whether the next import can fit on one line.\nfrom b import c\nfrom d import ( # Do take this comment into account when determining whether the next import can fit on one line.\n e,\n)\n" - location: - row: 1 - column: 0 - end_location: - row: 5 - column: 0 + content: "import a\n\n# Don't take this comment into account when determining whether the next import can fit on one line.\nfrom b import c\nfrom d import ( # Do take this comment into account when determining whether the next import can fit on one line.\n e,\n)\n" + location: + row: 1 + column: 0 + end_location: + row: 5 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__import_from_after_import.py.snap b/src/isort/snapshots/ruff__isort__tests__import_from_after_import.py.snap index 0fb4338994..f9e6366875 100644 --- a/src/isort/snapshots/ruff__isort__tests__import_from_after_import.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__import_from_after_import.py.snap @@ -10,12 +10,11 @@ expression: checks row: 3 column: 0 fix: - patch: - content: "import os\nfrom collections import Collection\n" - location: - row: 1 - column: 0 - end_location: - row: 3 - column: 0 + content: "import os\nfrom collections import Collection\n" + location: + row: 1 + column: 0 + end_location: + row: 3 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__leading_prefix.py.snap b/src/isort/snapshots/ruff__isort__tests__leading_prefix.py.snap index 8c8018361a..56c8a3cdd8 100644 --- a/src/isort/snapshots/ruff__isort__tests__leading_prefix.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__leading_prefix.py.snap @@ -10,14 +10,13 @@ expression: checks row: 2 column: 9 fix: - patch: - content: "\nimport os\nimport sys\n" - location: - row: 1 - column: 7 - end_location: - row: 3 - column: 0 + content: "\nimport os\nimport sys\n" + location: + row: 1 + column: 7 + end_location: + row: 3 + column: 0 - kind: UnsortedImports location: row: 5 @@ -26,12 +25,11 @@ expression: checks row: 6 column: 13 fix: - patch: - content: "\n import os\n import sys\n" - location: - row: 5 - column: 11 - end_location: - row: 7 - column: 0 + content: "\n import os\n import sys\n" + location: + row: 5 + column: 11 + end_location: + row: 7 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__order_by_type.py.snap b/src/isort/snapshots/ruff__isort__tests__order_by_type.py.snap index 8158447671..1eb3a58719 100644 --- a/src/isort/snapshots/ruff__isort__tests__order_by_type.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__order_by_type.py.snap @@ -10,12 +10,11 @@ expression: checks row: 13 column: 0 fix: - patch: - content: "import glob\nimport os\nimport shutil\nimport tempfile\nimport time\nfrom subprocess import PIPE, STDOUT, Popen\n\nimport BAR\nimport bar\nimport FOO\nimport foo\nimport StringIO\nfrom module import BASIC, CONSTANT, Apple, Class, function\n" - location: - row: 1 - column: 0 - end_location: - row: 13 - column: 0 + content: "import glob\nimport os\nimport shutil\nimport tempfile\nimport time\nfrom subprocess import PIPE, STDOUT, Popen\n\nimport BAR\nimport bar\nimport FOO\nimport foo\nimport StringIO\nfrom module import BASIC, CONSTANT, Apple, Class, function\n" + location: + row: 1 + column: 0 + end_location: + row: 13 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__order_relative_imports_by_level.py.snap b/src/isort/snapshots/ruff__isort__tests__order_relative_imports_by_level.py.snap index 5933141162..fe248f7ca2 100644 --- a/src/isort/snapshots/ruff__isort__tests__order_relative_imports_by_level.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__order_relative_imports_by_level.py.snap @@ -10,12 +10,11 @@ expression: checks row: 5 column: 0 fix: - patch: - content: "from ..a import a\nfrom ..b import a\nfrom .a import a\nfrom .b import a\n" - location: - row: 1 - column: 0 - end_location: - row: 5 - column: 0 + content: "from ..a import a\nfrom ..b import a\nfrom .a import a\nfrom .b import a\n" + location: + row: 1 + column: 0 + end_location: + row: 5 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__preserve_comment_order.py.snap b/src/isort/snapshots/ruff__isort__tests__preserve_comment_order.py.snap index 7c2edf79d8..e919554ce8 100644 --- a/src/isort/snapshots/ruff__isort__tests__preserve_comment_order.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__preserve_comment_order.py.snap @@ -10,12 +10,11 @@ expression: checks row: 12 column: 0 fix: - patch: - content: "import abc\nimport io\n\n# Old MacDonald had a farm,\n# EIEIO\n# And on his farm he had a cow,\n# EIEIO\n# With a moo-moo here and a moo-moo there\n# Here a moo, there a moo, everywhere moo-moo\n# Old MacDonald had a farm,\n# EIEIO\nfrom errno import EIO\n" - location: - row: 1 - column: 0 - end_location: - row: 12 - column: 0 + content: "import abc\nimport io\n\n# Old MacDonald had a farm,\n# EIEIO\n# And on his farm he had a cow,\n# EIEIO\n# With a moo-moo here and a moo-moo there\n# Here a moo, there a moo, everywhere moo-moo\n# Old MacDonald had a farm,\n# EIEIO\nfrom errno import EIO\n" + location: + row: 1 + column: 0 + end_location: + row: 12 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__preserve_indentation.py.snap b/src/isort/snapshots/ruff__isort__tests__preserve_indentation.py.snap index a018254d46..48134727c2 100644 --- a/src/isort/snapshots/ruff__isort__tests__preserve_indentation.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__preserve_indentation.py.snap @@ -10,14 +10,13 @@ expression: checks row: 4 column: 0 fix: - patch: - content: " import os\n import sys\n" - location: - row: 2 - column: 0 - end_location: - row: 4 - column: 0 + content: " import os\n import sys\n" + location: + row: 2 + column: 0 + end_location: + row: 4 + column: 0 - kind: UnsortedImports location: row: 5 @@ -26,12 +25,11 @@ expression: checks row: 7 column: 0 fix: - patch: - content: " import os\n import sys\n" - location: - row: 5 - column: 0 - end_location: - row: 7 - column: 0 + content: " import os\n import sys\n" + location: + row: 5 + column: 0 + end_location: + row: 7 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__reorder_within_section.py.snap b/src/isort/snapshots/ruff__isort__tests__reorder_within_section.py.snap index 0f8ae32347..d382e9fca7 100644 --- a/src/isort/snapshots/ruff__isort__tests__reorder_within_section.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__reorder_within_section.py.snap @@ -10,12 +10,11 @@ expression: checks row: 3 column: 0 fix: - patch: - content: "import os\nimport sys\n" - location: - row: 1 - column: 0 - end_location: - row: 3 - column: 0 + content: "import os\nimport sys\n" + location: + row: 1 + column: 0 + end_location: + row: 3 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__separate_first_party_imports.py.snap b/src/isort/snapshots/ruff__isort__tests__separate_first_party_imports.py.snap index 8d4e04497b..0d2b74cad4 100644 --- a/src/isort/snapshots/ruff__isort__tests__separate_first_party_imports.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__separate_first_party_imports.py.snap @@ -10,12 +10,11 @@ expression: checks row: 6 column: 0 fix: - patch: - content: "import os\nimport sys\n\nimport numpy as np\n\nimport leading_prefix\nfrom leading_prefix import Class\n" - location: - row: 1 - column: 0 - end_location: - row: 6 - column: 0 + content: "import os\nimport sys\n\nimport numpy as np\n\nimport leading_prefix\nfrom leading_prefix import Class\n" + location: + row: 1 + column: 0 + end_location: + row: 6 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__separate_future_imports.py.snap b/src/isort/snapshots/ruff__isort__tests__separate_future_imports.py.snap index 1555fc4e1a..7fd72a088a 100644 --- a/src/isort/snapshots/ruff__isort__tests__separate_future_imports.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__separate_future_imports.py.snap @@ -10,12 +10,11 @@ expression: checks row: 4 column: 0 fix: - patch: - content: "from __future__ import annotations\n\nimport os\nimport sys\n" - location: - row: 1 - column: 0 - end_location: - row: 4 - column: 0 + content: "from __future__ import annotations\n\nimport os\nimport sys\n" + location: + row: 1 + column: 0 + end_location: + row: 4 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__separate_local_folder_imports.py.snap b/src/isort/snapshots/ruff__isort__tests__separate_local_folder_imports.py.snap index 2b4f929935..16ba989a4f 100644 --- a/src/isort/snapshots/ruff__isort__tests__separate_local_folder_imports.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__separate_local_folder_imports.py.snap @@ -10,12 +10,11 @@ expression: checks row: 5 column: 0 fix: - patch: - content: "import os\nimport sys\n\nimport leading_prefix\n\nfrom . import leading_prefix\n" - location: - row: 1 - column: 0 - end_location: - row: 5 - column: 0 + content: "import os\nimport sys\n\nimport leading_prefix\n\nfrom . import leading_prefix\n" + location: + row: 1 + column: 0 + end_location: + row: 5 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__separate_third_party_imports.py.snap b/src/isort/snapshots/ruff__isort__tests__separate_third_party_imports.py.snap index f99dff2462..36f701dd08 100644 --- a/src/isort/snapshots/ruff__isort__tests__separate_third_party_imports.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__separate_third_party_imports.py.snap @@ -10,12 +10,11 @@ expression: checks row: 5 column: 0 fix: - patch: - content: "import os\nimport sys\n\nimport numpy as np\nimport pandas as pd\n" - location: - row: 1 - column: 0 - end_location: - row: 5 - column: 0 + content: "import os\nimport sys\n\nimport numpy as np\nimport pandas as pd\n" + location: + row: 1 + column: 0 + end_location: + row: 5 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__skip.py.snap b/src/isort/snapshots/ruff__isort__tests__skip.py.snap index 09d5a45538..2f7d0fd163 100644 --- a/src/isort/snapshots/ruff__isort__tests__skip.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__skip.py.snap @@ -10,12 +10,11 @@ expression: checks row: 11 column: 0 fix: - patch: - content: "import abc\nimport collections\n" - location: - row: 9 - column: 0 - end_location: - row: 11 - column: 0 + content: "import abc\nimport collections\n" + location: + row: 9 + column: 0 + end_location: + row: 11 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__sort_similar_imports.py.snap b/src/isort/snapshots/ruff__isort__tests__sort_similar_imports.py.snap index 807fbb1fd9..91b4ef02b6 100644 --- a/src/isort/snapshots/ruff__isort__tests__sort_similar_imports.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__sort_similar_imports.py.snap @@ -10,12 +10,11 @@ expression: checks row: 27 column: 0 fix: - patch: - content: "import A\nimport a\nimport B\nimport b\nimport x\nimport x as A\nimport x as Y\nimport x as a\nimport x as y\nfrom a import BAD as DEF\nfrom a import B, b\nfrom a import B as A\nfrom a import B as Abc\nfrom a import B as DEF\nfrom a import Boo as DEF\nfrom a import b as a\nfrom a import b as c\nfrom a import b as d\nfrom a import b as x\nfrom a import b as y\nfrom b import C, c\nfrom b import c as d\n" - location: - row: 1 - column: 0 - end_location: - row: 27 - column: 0 + content: "import A\nimport a\nimport B\nimport b\nimport x\nimport x as A\nimport x as Y\nimport x as a\nimport x as y\nfrom a import BAD as DEF\nfrom a import B, b\nfrom a import B as A\nfrom a import B as Abc\nfrom a import B as DEF\nfrom a import Boo as DEF\nfrom a import b as a\nfrom a import b as c\nfrom a import b as d\nfrom a import b as x\nfrom a import b as y\nfrom b import C, c\nfrom b import c as d\n" + location: + row: 1 + column: 0 + end_location: + row: 27 + column: 0 diff --git a/src/isort/snapshots/ruff__isort__tests__trailing_suffix.py.snap b/src/isort/snapshots/ruff__isort__tests__trailing_suffix.py.snap index 29cab896e7..067a3dfe4f 100644 --- a/src/isort/snapshots/ruff__isort__tests__trailing_suffix.py.snap +++ b/src/isort/snapshots/ruff__isort__tests__trailing_suffix.py.snap @@ -10,14 +10,13 @@ expression: checks row: 2 column: 9 fix: - patch: - content: "import os\nimport sys\n" - location: - row: 1 - column: 0 - end_location: - row: 3 - column: 0 + content: "import os\nimport sys\n" + location: + row: 1 + column: 0 + end_location: + row: 3 + column: 0 - kind: UnsortedImports location: row: 5 @@ -26,12 +25,11 @@ expression: checks row: 6 column: 13 fix: - patch: - content: " import os\n import sys\n" - location: - row: 5 - column: 0 - end_location: - row: 7 - column: 0 + content: " import os\n import sys\n" + location: + row: 5 + column: 0 + end_location: + row: 7 + column: 0 diff --git a/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E711_E711.py.snap b/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E711_E711.py.snap index 475603d128..8431402fb7 100644 --- a/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E711_E711.py.snap +++ b/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E711_E711.py.snap @@ -11,14 +11,13 @@ expression: checks row: 2 column: 14 fix: - patch: - content: res is None - location: - row: 2 - column: 3 - end_location: - row: 2 - column: 14 + content: res is None + location: + row: 2 + column: 3 + end_location: + row: 2 + column: 14 - kind: NoneComparison: NotEq location: @@ -28,14 +27,13 @@ expression: checks row: 5 column: 14 fix: - patch: - content: res is not None - location: - row: 5 - column: 3 - end_location: - row: 5 - column: 14 + content: res is not None + location: + row: 5 + column: 3 + end_location: + row: 5 + column: 14 - kind: NoneComparison: Eq location: @@ -45,14 +43,13 @@ expression: checks row: 8 column: 7 fix: - patch: - content: None is res - location: - row: 8 - column: 3 - end_location: - row: 8 - column: 14 + content: None is res + location: + row: 8 + column: 3 + end_location: + row: 8 + column: 14 - kind: NoneComparison: NotEq location: @@ -62,14 +59,13 @@ expression: checks row: 11 column: 7 fix: - patch: - content: None is not res - location: - row: 11 - column: 3 - end_location: - row: 11 - column: 14 + content: None is not res + location: + row: 11 + column: 3 + end_location: + row: 11 + column: 14 - kind: NoneComparison: Eq location: @@ -79,14 +75,13 @@ expression: checks row: 14 column: 17 fix: - patch: - content: "res[1] is None" - location: - row: 14 - column: 3 - end_location: - row: 14 - column: 17 + content: "res[1] is None" + location: + row: 14 + column: 3 + end_location: + row: 14 + column: 17 - kind: NoneComparison: NotEq location: @@ -96,14 +91,13 @@ expression: checks row: 17 column: 17 fix: - patch: - content: "res[1] is not None" - location: - row: 17 - column: 3 - end_location: - row: 17 - column: 17 + content: "res[1] is not None" + location: + row: 17 + column: 3 + end_location: + row: 17 + column: 17 - kind: NoneComparison: NotEq location: @@ -113,14 +107,13 @@ expression: checks row: 20 column: 7 fix: - patch: - content: "None is not res[1]" - location: - row: 20 - column: 3 - end_location: - row: 20 - column: 17 + content: "None is not res[1]" + location: + row: 20 + column: 3 + end_location: + row: 20 + column: 17 - kind: NoneComparison: Eq location: @@ -130,14 +123,13 @@ expression: checks row: 23 column: 7 fix: - patch: - content: "None is res[1]" - location: - row: 23 - column: 3 - end_location: - row: 23 - column: 17 + content: "None is res[1]" + location: + row: 23 + column: 3 + end_location: + row: 23 + column: 17 - kind: NoneComparison: Eq location: @@ -147,14 +139,13 @@ expression: checks row: 26 column: 12 fix: - patch: - content: "" - location: - row: 26 - column: 3 - end_location: - row: 26 - column: 3 + content: "" + location: + row: 26 + column: 3 + end_location: + row: 26 + column: 3 - kind: NoneComparison: NotEq location: @@ -164,12 +155,11 @@ expression: checks row: 26 column: 20 fix: - patch: - content: x is None is not None - location: - row: 26 - column: 3 - end_location: - row: 26 - column: 20 + content: x is None is not None + location: + row: 26 + column: 3 + end_location: + row: 26 + column: 20 diff --git a/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E712_E712.py.snap b/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E712_E712.py.snap index 863cc63da2..509fbde839 100644 --- a/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E712_E712.py.snap +++ b/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E712_E712.py.snap @@ -13,14 +13,13 @@ expression: checks row: 2 column: 14 fix: - patch: - content: res is True - location: - row: 2 - column: 3 - end_location: - row: 2 - column: 14 + content: res is True + location: + row: 2 + column: 3 + end_location: + row: 2 + column: 14 - kind: TrueFalseComparison: - false @@ -32,14 +31,13 @@ expression: checks row: 5 column: 15 fix: - patch: - content: res is not False - location: - row: 5 - column: 3 - end_location: - row: 5 - column: 15 + content: res is not False + location: + row: 5 + column: 3 + end_location: + row: 5 + column: 15 - kind: TrueFalseComparison: - true @@ -51,14 +49,13 @@ expression: checks row: 8 column: 7 fix: - patch: - content: True is not res - location: - row: 8 - column: 3 - end_location: - row: 8 - column: 14 + content: True is not res + location: + row: 8 + column: 3 + end_location: + row: 8 + column: 14 - kind: TrueFalseComparison: - false @@ -70,14 +67,13 @@ expression: checks row: 11 column: 8 fix: - patch: - content: False is res - location: - row: 11 - column: 3 - end_location: - row: 11 - column: 15 + content: False is res + location: + row: 11 + column: 3 + end_location: + row: 11 + column: 15 - kind: TrueFalseComparison: - true @@ -89,14 +85,13 @@ expression: checks row: 14 column: 17 fix: - patch: - content: "res[1] is True" - location: - row: 14 - column: 3 - end_location: - row: 14 - column: 17 + content: "res[1] is True" + location: + row: 14 + column: 3 + end_location: + row: 14 + column: 17 - kind: TrueFalseComparison: - false @@ -108,14 +103,13 @@ expression: checks row: 17 column: 18 fix: - patch: - content: "res[1] is not False" - location: - row: 17 - column: 3 - end_location: - row: 17 - column: 18 + content: "res[1] is not False" + location: + row: 17 + column: 3 + end_location: + row: 17 + column: 18 - kind: TrueFalseComparison: - true @@ -127,14 +121,13 @@ expression: checks row: 20 column: 23 fix: - patch: - content: cond is True - location: - row: 20 - column: 11 - end_location: - row: 20 - column: 23 + content: cond is True + location: + row: 20 + column: 11 + end_location: + row: 20 + column: 23 - kind: TrueFalseComparison: - false @@ -146,14 +139,13 @@ expression: checks row: 20 column: 48 fix: - patch: - content: cond is False - location: - row: 20 - column: 35 - end_location: - row: 20 - column: 48 + content: cond is False + location: + row: 20 + column: 35 + end_location: + row: 20 + column: 48 - kind: TrueFalseComparison: - true @@ -165,14 +157,13 @@ expression: checks row: 22 column: 8 fix: - patch: - content: True is TrueElement - location: - row: 22 - column: 3 - end_location: - row: 22 - column: 24 + content: True is TrueElement + location: + row: 22 + column: 3 + end_location: + row: 22 + column: 24 - kind: TrueFalseComparison: - true @@ -184,14 +175,13 @@ expression: checks row: 25 column: 14 fix: - patch: - content: "" - location: - row: 25 - column: 3 - end_location: - row: 25 - column: 3 + content: "" + location: + row: 25 + column: 3 + end_location: + row: 25 + column: 3 - kind: TrueFalseComparison: - false @@ -203,12 +193,11 @@ expression: checks row: 25 column: 23 fix: - patch: - content: res is True is not False - location: - row: 25 - column: 3 - end_location: - row: 25 - column: 23 + content: res is True is not False + location: + row: 25 + column: 3 + end_location: + row: 25 + column: 23 diff --git a/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E713_E713.py.snap b/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E713_E713.py.snap index a2bc02b2dc..291ebb422a 100644 --- a/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E713_E713.py.snap +++ b/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E713_E713.py.snap @@ -10,14 +10,13 @@ expression: checks row: 2 column: 13 fix: - patch: - content: X not in Y - location: - row: 2 - column: 3 - end_location: - row: 2 - column: 13 + content: X not in Y + location: + row: 2 + column: 3 + end_location: + row: 2 + column: 13 - kind: NotInTest location: row: 5 @@ -26,14 +25,13 @@ expression: checks row: 5 column: 15 fix: - patch: - content: X.B not in Y - location: - row: 5 - column: 3 - end_location: - row: 5 - column: 15 + content: X.B not in Y + location: + row: 5 + column: 3 + end_location: + row: 5 + column: 15 - kind: NotInTest location: row: 8 @@ -42,14 +40,13 @@ expression: checks row: 8 column: 13 fix: - patch: - content: X not in Y - location: - row: 8 - column: 3 - end_location: - row: 8 - column: 13 + content: X not in Y + location: + row: 8 + column: 3 + end_location: + row: 8 + column: 13 - kind: NotInTest location: row: 11 @@ -58,14 +55,13 @@ expression: checks row: 11 column: 28 fix: - patch: - content: Y not in Z - location: - row: 11 - column: 18 - end_location: - row: 11 - column: 28 + content: Y not in Z + location: + row: 11 + column: 18 + end_location: + row: 11 + column: 28 - kind: NotInTest location: row: 14 @@ -74,12 +70,11 @@ expression: checks row: 14 column: 14 fix: - patch: - content: X not in Y - location: - row: 14 - column: 3 - end_location: - row: 14 - column: 15 + content: X not in Y + location: + row: 14 + column: 3 + end_location: + row: 14 + column: 15 diff --git a/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E714_E714.py.snap b/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E714_E714.py.snap index 557fefa842..58c50a95b2 100644 --- a/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E714_E714.py.snap +++ b/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E714_E714.py.snap @@ -10,14 +10,13 @@ expression: checks row: 2 column: 13 fix: - patch: - content: X is not Y - location: - row: 2 - column: 3 - end_location: - row: 2 - column: 13 + content: X is not Y + location: + row: 2 + column: 3 + end_location: + row: 2 + column: 13 - kind: NotIsTest location: row: 5 @@ -26,14 +25,13 @@ expression: checks row: 5 column: 15 fix: - patch: - content: X.B is not Y - location: - row: 5 - column: 3 - end_location: - row: 5 - column: 15 + content: X.B is not Y + location: + row: 5 + column: 3 + end_location: + row: 5 + column: 15 - kind: NotIsTest location: row: 8 diff --git a/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E731_E731.py.snap b/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E731_E731.py.snap index 7d2c5834df..122c39bd39 100644 --- a/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E731_E731.py.snap +++ b/src/pycodestyle/snapshots/ruff__pycodestyle__tests__E731_E731.py.snap @@ -10,14 +10,13 @@ expression: checks row: 2 column: 19 fix: - patch: - content: "def f(x):\n return (2 * x)" - location: - row: 2 - column: 0 - end_location: - row: 2 - column: 19 + content: "def f(x):\n return (2 * x)" + location: + row: 2 + column: 0 + end_location: + row: 2 + column: 19 - kind: DoNotAssignLambda location: row: 4 @@ -26,14 +25,13 @@ expression: checks row: 4 column: 19 fix: - patch: - content: "def f(x):\n return (2 * x)" - location: - row: 4 - column: 0 - end_location: - row: 4 - column: 19 + content: "def f(x):\n return (2 * x)" + location: + row: 4 + column: 0 + end_location: + row: 4 + column: 19 - kind: DoNotAssignLambda location: row: 7 @@ -42,12 +40,11 @@ expression: checks row: 7 column: 29 fix: - patch: - content: "def this(y, z):\n return (2 * x)" - location: - row: 7 - column: 4 - end_location: - row: 7 - column: 29 + content: "def this(y, z):\n return (2 * x)" + location: + row: 7 + column: 4 + end_location: + row: 7 + column: 29 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D201_D.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D201_D.py.snap index cf90aca774..1673bcd8d9 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D201_D.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D201_D.py.snap @@ -11,14 +11,13 @@ expression: checks row: 137 column: 24 fix: - patch: - content: "" - location: - row: 136 - column: 0 - end_location: - row: 137 - column: 0 + content: "" + location: + row: 136 + column: 0 + end_location: + row: 137 + column: 0 - kind: NoBlankLineBeforeFunction: 1 location: @@ -28,14 +27,13 @@ expression: checks row: 151 column: 37 fix: - patch: - content: "" - location: - row: 150 - column: 0 - end_location: - row: 151 - column: 0 + content: "" + location: + row: 150 + column: 0 + end_location: + row: 151 + column: 0 - kind: NoBlankLineBeforeFunction: 1 location: @@ -45,14 +43,13 @@ expression: checks row: 549 column: 7 fix: - patch: - content: "" - location: - row: 545 - column: 0 - end_location: - row: 546 - column: 0 + content: "" + location: + row: 545 + column: 0 + end_location: + row: 546 + column: 0 - kind: NoBlankLineBeforeFunction: 1 location: @@ -62,12 +59,11 @@ expression: checks row: 571 column: 7 fix: - patch: - content: "" - location: - row: 567 - column: 0 - end_location: - row: 568 - column: 0 + content: "" + location: + row: 567 + column: 0 + end_location: + row: 568 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D202_D.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D202_D.py.snap index 83b21bf523..eee2fa06fa 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D202_D.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D202_D.py.snap @@ -11,14 +11,13 @@ expression: checks row: 142 column: 24 fix: - patch: - content: "" - location: - row: 143 - column: 0 - end_location: - row: 144 - column: 0 + content: "" + location: + row: 143 + column: 0 + end_location: + row: 144 + column: 0 - kind: NoBlankLineAfterFunction: 1 location: @@ -28,14 +27,13 @@ expression: checks row: 151 column: 37 fix: - patch: - content: "" - location: - row: 152 - column: 0 - end_location: - row: 153 - column: 0 + content: "" + location: + row: 152 + column: 0 + end_location: + row: 153 + column: 0 - kind: NoBlankLineAfterFunction: 1 location: @@ -45,14 +43,13 @@ expression: checks row: 558 column: 7 fix: - patch: - content: "" - location: - row: 559 - column: 0 - end_location: - row: 560 - column: 0 + content: "" + location: + row: 559 + column: 0 + end_location: + row: 560 + column: 0 - kind: NoBlankLineAfterFunction: 1 location: @@ -62,12 +59,11 @@ expression: checks row: 571 column: 7 fix: - patch: - content: "" - location: - row: 572 - column: 0 - end_location: - row: 573 - column: 0 + content: "" + location: + row: 572 + column: 0 + end_location: + row: 573 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D203_D.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D203_D.py.snap index f0bb1ddc65..d08bd7cab1 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D203_D.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D203_D.py.snap @@ -11,14 +11,13 @@ expression: checks row: 161 column: 32 fix: - patch: - content: "\n" - location: - row: 161 - column: 0 - end_location: - row: 161 - column: 0 + content: "\n" + location: + row: 161 + column: 0 + end_location: + row: 161 + column: 0 - kind: OneBlankLineBeforeClass: 0 location: @@ -28,14 +27,13 @@ expression: checks row: 192 column: 45 fix: - patch: - content: "\n" - location: - row: 192 - column: 0 - end_location: - row: 192 - column: 0 + content: "\n" + location: + row: 192 + column: 0 + end_location: + row: 192 + column: 0 - kind: OneBlankLineBeforeClass: 0 location: @@ -45,12 +43,11 @@ expression: checks row: 532 column: 7 fix: - patch: - content: "\n" - location: - row: 526 - column: 0 - end_location: - row: 526 - column: 0 + content: "\n" + location: + row: 526 + column: 0 + end_location: + row: 526 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D204_D.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D204_D.py.snap index c22e054cbe..4ffd5a936c 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D204_D.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D204_D.py.snap @@ -11,14 +11,13 @@ expression: checks row: 181 column: 24 fix: - patch: - content: "\n" - location: - row: 182 - column: 0 - end_location: - row: 182 - column: 0 + content: "\n" + location: + row: 182 + column: 0 + end_location: + row: 182 + column: 0 - kind: OneBlankLineAfterClass: 0 location: @@ -28,12 +27,11 @@ expression: checks row: 192 column: 45 fix: - patch: - content: "\n" - location: - row: 193 - column: 0 - end_location: - row: 193 - column: 0 + content: "\n" + location: + row: 193 + column: 0 + end_location: + row: 193 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D205_D.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D205_D.py.snap index 6aa08f15f0..96e5b8a333 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D205_D.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D205_D.py.snap @@ -10,14 +10,13 @@ expression: checks row: 203 column: 7 fix: - patch: - content: "\n" - location: - row: 201 - column: 0 - end_location: - row: 201 - column: 0 + content: "\n" + location: + row: 201 + column: 0 + end_location: + row: 201 + column: 0 - kind: BlankLineAfterSummary location: row: 210 @@ -26,12 +25,11 @@ expression: checks row: 215 column: 7 fix: - patch: - content: "\n" - location: - row: 211 - column: 0 - end_location: - row: 213 - column: 0 + content: "\n" + location: + row: 211 + column: 0 + end_location: + row: 213 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D207_D.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D207_D.py.snap index 4841db7ac1..f7119ca9b3 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D207_D.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D207_D.py.snap @@ -10,14 +10,13 @@ expression: checks row: 232 column: 0 fix: - patch: - content: " " - location: - row: 232 - column: 0 - end_location: - row: 232 - column: 0 + content: " " + location: + row: 232 + column: 0 + end_location: + row: 232 + column: 0 - kind: NoUnderIndentation location: row: 440 @@ -26,12 +25,11 @@ expression: checks row: 440 column: 0 fix: - patch: - content: " " - location: - row: 440 - column: 0 - end_location: - row: 440 - column: 4 + content: " " + location: + row: 440 + column: 0 + end_location: + row: 440 + column: 4 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D208_D.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D208_D.py.snap index c13acd1d63..419e162a2e 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D208_D.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D208_D.py.snap @@ -10,14 +10,13 @@ expression: checks row: 252 column: 0 fix: - patch: - content: " " - location: - row: 252 - column: 0 - end_location: - row: 252 - column: 7 + content: " " + location: + row: 252 + column: 0 + end_location: + row: 252 + column: 7 - kind: NoOverIndentation location: row: 264 @@ -26,14 +25,13 @@ expression: checks row: 264 column: 0 fix: - patch: - content: " " - location: - row: 264 - column: 0 - end_location: - row: 264 - column: 8 + content: " " + location: + row: 264 + column: 0 + end_location: + row: 264 + column: 8 - kind: NoOverIndentation location: row: 272 @@ -42,12 +40,11 @@ expression: checks row: 272 column: 0 fix: - patch: - content: " " - location: - row: 272 - column: 0 - end_location: - row: 272 - column: 8 + content: " " + location: + row: 272 + column: 0 + end_location: + row: 272 + column: 8 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D209_D.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D209_D.py.snap index 93c5e90420..f6b52c258c 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D209_D.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D209_D.py.snap @@ -10,12 +10,11 @@ expression: checks row: 283 column: 19 fix: - patch: - content: "\n " - location: - row: 283 - column: 16 - end_location: - row: 283 - column: 16 + content: "\n " + location: + row: 283 + column: 16 + end_location: + row: 283 + column: 16 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D210_D.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D210_D.py.snap index 637f6cc386..c451b9cd79 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D210_D.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D210_D.py.snap @@ -10,14 +10,13 @@ expression: checks row: 288 column: 33 fix: - patch: - content: Whitespace at the end. - location: - row: 288 - column: 7 - end_location: - row: 288 - column: 30 + content: Whitespace at the end. + location: + row: 288 + column: 7 + end_location: + row: 288 + column: 30 - kind: NoSurroundingWhitespace location: row: 293 @@ -26,14 +25,13 @@ expression: checks row: 293 column: 37 fix: - patch: - content: Whitespace at everywhere. - location: - row: 293 - column: 7 - end_location: - row: 293 - column: 34 + content: Whitespace at everywhere. + location: + row: 293 + column: 7 + end_location: + row: 293 + column: 34 - kind: NoSurroundingWhitespace location: row: 299 @@ -42,12 +40,11 @@ expression: checks row: 302 column: 7 fix: - patch: - content: Whitespace at the beginning. - location: - row: 299 - column: 7 - end_location: - row: 299 - column: 36 + content: Whitespace at the beginning. + location: + row: 299 + column: 7 + end_location: + row: 299 + column: 36 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D211_D.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D211_D.py.snap index 08478e6789..d66f05d4fe 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D211_D.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D211_D.py.snap @@ -11,14 +11,13 @@ expression: checks row: 170 column: 29 fix: - patch: - content: "" - location: - row: 169 - column: 0 - end_location: - row: 170 - column: 0 + content: "" + location: + row: 169 + column: 0 + end_location: + row: 170 + column: 0 - kind: NoBlankLineBeforeClass: 1 location: @@ -28,12 +27,11 @@ expression: checks row: 181 column: 24 fix: - patch: - content: "" - location: - row: 180 - column: 0 - end_location: - row: 181 - column: 0 + content: "" + location: + row: 180 + column: 0 + end_location: + row: 181 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D214_sections.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D214_sections.py.snap index fa51842ddc..c0d3d79075 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D214_sections.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D214_sections.py.snap @@ -11,12 +11,11 @@ expression: checks row: 141 column: 7 fix: - patch: - content: " " - location: - row: 137 - column: 0 - end_location: - row: 137 - column: 8 + content: " " + location: + row: 137 + column: 0 + end_location: + row: 137 + column: 8 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D215_sections.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D215_sections.py.snap index d71fe7a838..4a3ec38223 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D215_sections.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D215_sections.py.snap @@ -11,14 +11,13 @@ expression: checks row: 153 column: 7 fix: - patch: - content: " " - location: - row: 150 - column: 0 - end_location: - row: 150 - column: 9 + content: " " + location: + row: 150 + column: 0 + end_location: + row: 150 + column: 9 - kind: SectionUnderlineNotOverIndented: Returns location: @@ -28,12 +27,11 @@ expression: checks row: 165 column: 7 fix: - patch: - content: " " - location: - row: 164 - column: 0 - end_location: - row: 164 - column: 9 + content: " " + location: + row: 164 + column: 0 + end_location: + row: 164 + column: 9 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D405_sections.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D405_sections.py.snap index e7e7f77842..fc0530b500 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D405_sections.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D405_sections.py.snap @@ -11,14 +11,13 @@ expression: checks row: 23 column: 7 fix: - patch: - content: Returns - location: - row: 19 - column: 4 - end_location: - row: 19 - column: 11 + content: Returns + location: + row: 19 + column: 4 + end_location: + row: 19 + column: 11 - kind: CapitalizeSectionName: Short summary location: @@ -28,12 +27,11 @@ expression: checks row: 221 column: 7 fix: - patch: - content: Short Summary - location: - row: 209 - column: 4 - end_location: - row: 209 - column: 17 + content: Short Summary + location: + row: 209 + column: 4 + end_location: + row: 209 + column: 17 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D406_sections.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D406_sections.py.snap index 74f156964c..a87ad1628c 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D406_sections.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D406_sections.py.snap @@ -11,14 +11,13 @@ expression: checks row: 36 column: 7 fix: - patch: - content: "" - location: - row: 32 - column: 11 - end_location: - row: 32 - column: 12 + content: "" + location: + row: 32 + column: 11 + end_location: + row: 32 + column: 12 - kind: NewLineAfterSectionName: Raises location: @@ -28,14 +27,13 @@ expression: checks row: 221 column: 7 fix: - patch: - content: "" - location: - row: 218 - column: 10 - end_location: - row: 218 - column: 11 + content: "" + location: + row: 218 + column: 10 + end_location: + row: 218 + column: 11 - kind: NewLineAfterSectionName: Returns location: @@ -45,14 +43,13 @@ expression: checks row: 262 column: 7 fix: - patch: - content: "" - location: - row: 257 - column: 11 - end_location: - row: 257 - column: 12 + content: "" + location: + row: 257 + column: 11 + end_location: + row: 257 + column: 12 - kind: NewLineAfterSectionName: Raises location: @@ -62,12 +59,11 @@ expression: checks row: 262 column: 7 fix: - patch: - content: "" - location: - row: 259 - column: 10 - end_location: - row: 259 - column: 11 + content: "" + location: + row: 259 + column: 10 + end_location: + row: 259 + column: 11 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D407_sections.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D407_sections.py.snap index a366b10bb5..065cfbc47c 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D407_sections.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D407_sections.py.snap @@ -11,14 +11,13 @@ expression: checks row: 47 column: 7 fix: - patch: - content: " -------\n" - location: - row: 45 - column: 0 - end_location: - row: 45 - column: 0 + content: " -------\n" + location: + row: 45 + column: 0 + end_location: + row: 45 + column: 0 - kind: DashedUnderlineAfterSection: Returns location: @@ -28,14 +27,13 @@ expression: checks row: 58 column: 7 fix: - patch: - content: " -------\n" - location: - row: 57 - column: 0 - end_location: - row: 57 - column: 0 + content: " -------\n" + location: + row: 57 + column: 0 + end_location: + row: 57 + column: 0 - kind: DashedUnderlineAfterSection: Raises location: @@ -45,14 +43,13 @@ expression: checks row: 221 column: 7 fix: - patch: - content: " ------\n" - location: - row: 219 - column: 0 - end_location: - row: 219 - column: 0 + content: " ------\n" + location: + row: 219 + column: 0 + end_location: + row: 219 + column: 0 - kind: DashedUnderlineAfterSection: Returns location: @@ -62,14 +59,13 @@ expression: checks row: 262 column: 7 fix: - patch: - content: " -------\n" - location: - row: 258 - column: 0 - end_location: - row: 258 - column: 0 + content: " -------\n" + location: + row: 258 + column: 0 + end_location: + row: 258 + column: 0 - kind: DashedUnderlineAfterSection: Raises location: @@ -79,14 +75,13 @@ expression: checks row: 262 column: 7 fix: - patch: - content: " ------\n" - location: - row: 260 - column: 0 - end_location: - row: 260 - column: 0 + content: " ------\n" + location: + row: 260 + column: 0 + end_location: + row: 260 + column: 0 - kind: DashedUnderlineAfterSection: Args location: @@ -96,14 +91,13 @@ expression: checks row: 274 column: 7 fix: - patch: - content: " ----\n" - location: - row: 272 - column: 0 - end_location: - row: 272 - column: 0 + content: " ----\n" + location: + row: 272 + column: 0 + end_location: + row: 272 + column: 0 - kind: DashedUnderlineAfterSection: Args location: @@ -113,14 +107,13 @@ expression: checks row: 292 column: 11 fix: - patch: - content: " ----\n" - location: - row: 289 - column: 0 - end_location: - row: 289 - column: 0 + content: " ----\n" + location: + row: 289 + column: 0 + end_location: + row: 289 + column: 0 - kind: DashedUnderlineAfterSection: Args location: @@ -130,14 +123,13 @@ expression: checks row: 306 column: 7 fix: - patch: - content: " ----\n" - location: - row: 304 - column: 0 - end_location: - row: 304 - column: 0 + content: " ----\n" + location: + row: 304 + column: 0 + end_location: + row: 304 + column: 0 - kind: DashedUnderlineAfterSection: Args location: @@ -147,14 +139,13 @@ expression: checks row: 319 column: 11 fix: - patch: - content: " ----\n" - location: - row: 316 - column: 0 - end_location: - row: 316 - column: 0 + content: " ----\n" + location: + row: 316 + column: 0 + end_location: + row: 316 + column: 0 - kind: DashedUnderlineAfterSection: Args location: @@ -164,14 +155,13 @@ expression: checks row: 330 column: 11 fix: - patch: - content: " ----\n" - location: - row: 328 - column: 0 - end_location: - row: 328 - column: 0 + content: " ----\n" + location: + row: 328 + column: 0 + end_location: + row: 328 + column: 0 - kind: DashedUnderlineAfterSection: Args location: @@ -181,14 +171,13 @@ expression: checks row: 343 column: 11 fix: - patch: - content: " ----\n" - location: - row: 340 - column: 0 - end_location: - row: 340 - column: 0 + content: " ----\n" + location: + row: 340 + column: 0 + end_location: + row: 340 + column: 0 - kind: DashedUnderlineAfterSection: Args location: @@ -198,14 +187,13 @@ expression: checks row: 355 column: 11 fix: - patch: - content: " ----\n" - location: - row: 353 - column: 0 - end_location: - row: 353 - column: 0 + content: " ----\n" + location: + row: 353 + column: 0 + end_location: + row: 353 + column: 0 - kind: DashedUnderlineAfterSection: Args location: @@ -215,14 +203,13 @@ expression: checks row: 367 column: 11 fix: - patch: - content: " ----\n" - location: - row: 365 - column: 0 - end_location: - row: 365 - column: 0 + content: " ----\n" + location: + row: 365 + column: 0 + end_location: + row: 365 + column: 0 - kind: DashedUnderlineAfterSection: Args location: @@ -232,14 +219,13 @@ expression: checks row: 382 column: 11 fix: - patch: - content: " ----\n" - location: - row: 374 - column: 0 - end_location: - row: 374 - column: 0 + content: " ----\n" + location: + row: 374 + column: 0 + end_location: + row: 374 + column: 0 - kind: DashedUnderlineAfterSection: Args location: @@ -249,12 +235,11 @@ expression: checks row: 497 column: 11 fix: - patch: - content: " ----\n" - location: - row: 495 - column: 0 - end_location: - row: 495 - column: 0 + content: " ----\n" + location: + row: 495 + column: 0 + end_location: + row: 495 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D408_sections.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D408_sections.py.snap index 154646a9ed..25cdd233ae 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D408_sections.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D408_sections.py.snap @@ -11,12 +11,11 @@ expression: checks row: 92 column: 7 fix: - patch: - content: "" - location: - row: 88 - column: 0 - end_location: - row: 89 - column: 0 + content: "" + location: + row: 88 + column: 0 + end_location: + row: 89 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D409_sections.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D409_sections.py.snap index f2ea8afebd..2a9e22a79c 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D409_sections.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D409_sections.py.snap @@ -11,14 +11,13 @@ expression: checks row: 105 column: 7 fix: - patch: - content: " -------\n" - location: - row: 102 - column: 0 - end_location: - row: 103 - column: 0 + content: " -------\n" + location: + row: 102 + column: 0 + end_location: + row: 103 + column: 0 - kind: SectionUnderlineMatchesSectionLength: Returns location: @@ -28,12 +27,11 @@ expression: checks row: 221 column: 7 fix: - patch: - content: " -------\n" - location: - row: 216 - column: 0 - end_location: - row: 217 - column: 0 + content: " -------\n" + location: + row: 216 + column: 0 + end_location: + row: 217 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D410_sections.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D410_sections.py.snap index a92cb97895..9e8e327a0b 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D410_sections.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D410_sections.py.snap @@ -11,14 +11,13 @@ expression: checks row: 78 column: 7 fix: - patch: - content: "\n" - location: - row: 71 - column: 0 - end_location: - row: 71 - column: 0 + content: "\n" + location: + row: 71 + column: 0 + end_location: + row: 71 + column: 0 - kind: BlankLineAfterSection: Returns location: @@ -28,12 +27,11 @@ expression: checks row: 221 column: 7 fix: - patch: - content: "\n" - location: - row: 218 - column: 0 - end_location: - row: 218 - column: 0 + content: "\n" + location: + row: 218 + column: 0 + end_location: + row: 218 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D411_sections.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D411_sections.py.snap index 7ac0cc147b..e0699d5ad3 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D411_sections.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D411_sections.py.snap @@ -11,14 +11,13 @@ expression: checks row: 78 column: 7 fix: - patch: - content: "\n" - location: - row: 71 - column: 0 - end_location: - row: 71 - column: 0 + content: "\n" + location: + row: 71 + column: 0 + end_location: + row: 71 + column: 0 - kind: BlankLineBeforeSection: Returns location: @@ -28,14 +27,13 @@ expression: checks row: 129 column: 7 fix: - patch: - content: "\n" - location: - row: 125 - column: 0 - end_location: - row: 125 - column: 0 + content: "\n" + location: + row: 125 + column: 0 + end_location: + row: 125 + column: 0 - kind: BlankLineBeforeSection: Raises location: @@ -45,12 +43,11 @@ expression: checks row: 221 column: 7 fix: - patch: - content: "\n" - location: - row: 218 - column: 0 - end_location: - row: 218 - column: 0 + content: "\n" + location: + row: 218 + column: 0 + end_location: + row: 218 + column: 0 diff --git a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D412_sections.py.snap b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D412_sections.py.snap index 0e77daf539..807c9806f5 100644 --- a/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D412_sections.py.snap +++ b/src/pydocstyle/snapshots/ruff__pydocstyle__tests__D412_sections.py.snap @@ -11,12 +11,11 @@ expression: checks row: 221 column: 7 fix: - patch: - content: "" - location: - row: 211 - column: 0 - end_location: - row: 212 - column: 0 + content: "" + location: + row: 211 + column: 0 + end_location: + row: 212 + column: 0 diff --git a/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_0.py.snap b/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_0.py.snap index 43a307755e..e895c8a1a4 100644 --- a/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_0.py.snap +++ b/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_0.py.snap @@ -13,14 +13,13 @@ expression: checks row: 2 column: 16 fix: - patch: - content: import os - location: - row: 2 - column: 0 - end_location: - row: 2 - column: 20 + content: import os + location: + row: 2 + column: 0 + end_location: + row: 2 + column: 20 - kind: UnusedImport: - collections.OrderedDict @@ -32,14 +31,13 @@ expression: checks row: 6 column: 15 fix: - patch: - content: "from collections import (\n Counter,\n namedtuple,\n)" - location: - row: 4 - column: 0 - end_location: - row: 8 - column: 1 + content: "from collections import (\n Counter,\n namedtuple,\n)" + location: + row: 4 + column: 0 + end_location: + row: 8 + column: 1 - kind: UnusedImport: - logging.handlers @@ -51,14 +49,13 @@ expression: checks row: 12 column: 23 fix: - patch: - content: "" - location: - row: 12 - column: 0 - end_location: - row: 13 - column: 0 + content: "" + location: + row: 12 + column: 0 + end_location: + row: 13 + column: 0 - kind: UnusedImport: - shelve @@ -70,14 +67,13 @@ expression: checks row: 32 column: 17 fix: - patch: - content: "" - location: - row: 32 - column: 0 - end_location: - row: 33 - column: 0 + content: "" + location: + row: 32 + column: 0 + end_location: + row: 33 + column: 0 - kind: UnusedImport: - importlib @@ -89,14 +85,13 @@ expression: checks row: 33 column: 20 fix: - patch: - content: pass - location: - row: 33 - column: 4 - end_location: - row: 33 - column: 20 + content: pass + location: + row: 33 + column: 4 + end_location: + row: 33 + column: 20 - kind: UnusedImport: - pathlib @@ -108,14 +103,13 @@ expression: checks row: 37 column: 18 fix: - patch: - content: "" - location: - row: 37 - column: 0 - end_location: - row: 38 - column: 0 + content: "" + location: + row: 37 + column: 0 + end_location: + row: 38 + column: 0 - kind: UnusedImport: - pickle @@ -127,12 +121,11 @@ expression: checks row: 52 column: 21 fix: - patch: - content: pass - location: - row: 52 - column: 8 - end_location: - row: 52 - column: 21 + content: pass + location: + row: 52 + column: 8 + end_location: + row: 52 + column: 21 diff --git a/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_5.py.snap b/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_5.py.snap index b9215e7374..6ebe292276 100644 --- a/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_5.py.snap +++ b/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_5.py.snap @@ -13,14 +13,13 @@ expression: checks row: 2 column: 17 fix: - patch: - content: "" - location: - row: 2 - column: 0 - end_location: - row: 3 - column: 0 + content: "" + location: + row: 2 + column: 0 + end_location: + row: 3 + column: 0 - kind: UnusedImport: - d.e.f @@ -32,14 +31,13 @@ expression: checks row: 3 column: 22 fix: - patch: - content: "" - location: - row: 3 - column: 0 - end_location: - row: 4 - column: 0 + content: "" + location: + row: 3 + column: 0 + end_location: + row: 4 + column: 0 - kind: UnusedImport: - h.i @@ -51,14 +49,13 @@ expression: checks row: 4 column: 10 fix: - patch: - content: "" - location: - row: 4 - column: 0 - end_location: - row: 5 - column: 0 + content: "" + location: + row: 4 + column: 0 + end_location: + row: 5 + column: 0 - kind: UnusedImport: - j.k @@ -70,12 +67,11 @@ expression: checks row: 5 column: 15 fix: - patch: - content: "" - location: - row: 5 - column: 0 - end_location: - row: 6 - column: 0 + content: "" + location: + row: 5 + column: 0 + end_location: + row: 6 + column: 0 diff --git a/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_6.py.snap b/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_6.py.snap index 8bdb70a136..23133cb407 100644 --- a/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_6.py.snap +++ b/src/pyflakes/snapshots/ruff__pyflakes__tests__F401_F401_6.py.snap @@ -13,14 +13,13 @@ expression: checks row: 7 column: 39 fix: - patch: - content: "" - location: - row: 7 - column: 0 - end_location: - row: 8 - column: 0 + content: "" + location: + row: 7 + column: 0 + end_location: + row: 8 + column: 0 - kind: UnusedImport: - datastructures.UploadFile @@ -32,14 +31,13 @@ expression: checks row: 10 column: 52 fix: - patch: - content: "" - location: - row: 10 - column: 0 - end_location: - row: 11 - column: 0 + content: "" + location: + row: 10 + column: 0 + end_location: + row: 11 + column: 0 - kind: UnusedImport: - background @@ -51,14 +49,13 @@ expression: checks row: 17 column: 17 fix: - patch: - content: "" - location: - row: 17 - column: 0 - end_location: - row: 18 - column: 0 + content: "" + location: + row: 17 + column: 0 + end_location: + row: 18 + column: 0 - kind: UnusedImport: - datastructures @@ -70,12 +67,11 @@ expression: checks row: 20 column: 35 fix: - patch: - content: "" - location: - row: 20 - column: 0 - end_location: - row: 21 - column: 0 + content: "" + location: + row: 20 + column: 0 + end_location: + row: 21 + column: 0 diff --git a/src/pyflakes/snapshots/ruff__pyflakes__tests__F632_F632.py.snap b/src/pyflakes/snapshots/ruff__pyflakes__tests__F632_F632.py.snap index 327b776e1a..325d08cbfa 100644 --- a/src/pyflakes/snapshots/ruff__pyflakes__tests__F632_F632.py.snap +++ b/src/pyflakes/snapshots/ruff__pyflakes__tests__F632_F632.py.snap @@ -10,14 +10,13 @@ expression: checks row: 1 column: 13 fix: - patch: - content: "x == \"abc\"" - location: - row: 1 - column: 3 - end_location: - row: 1 - column: 13 + content: "x == \"abc\"" + location: + row: 1 + column: 3 + end_location: + row: 1 + column: 13 - kind: IsLiteral location: row: 4 @@ -26,14 +25,13 @@ expression: checks row: 4 column: 15 fix: - patch: - content: 123 != y - location: - row: 4 - column: 3 - end_location: - row: 4 - column: 15 + content: 123 != y + location: + row: 4 + column: 3 + end_location: + row: 4 + column: 15 - kind: IsLiteral location: row: 7 @@ -42,12 +40,11 @@ expression: checks row: 7 column: 17 fix: - patch: - content: "\"123\" == x" - location: - row: 7 - column: 3 - end_location: - row: 7 - column: 13 + content: "\"123\" == x" + location: + row: 7 + column: 3 + end_location: + row: 7 + column: 13 diff --git a/src/pyflakes/snapshots/ruff__pyflakes__tests__F901_F901.py.snap b/src/pyflakes/snapshots/ruff__pyflakes__tests__F901_F901.py.snap index 2ec56318c1..dce57c49ca 100644 --- a/src/pyflakes/snapshots/ruff__pyflakes__tests__F901_F901.py.snap +++ b/src/pyflakes/snapshots/ruff__pyflakes__tests__F901_F901.py.snap @@ -10,14 +10,13 @@ expression: checks row: 2 column: 24 fix: - patch: - content: NotImplementedError - location: - row: 2 - column: 10 - end_location: - row: 2 - column: 24 + content: NotImplementedError + location: + row: 2 + column: 10 + end_location: + row: 2 + column: 24 - kind: RaiseNotImplemented location: row: 6 @@ -26,12 +25,11 @@ expression: checks row: 6 column: 24 fix: - patch: - content: NotImplementedError - location: - row: 6 - column: 10 - end_location: - row: 6 - column: 24 + content: NotImplementedError + location: + row: 6 + column: 10 + end_location: + row: 6 + column: 24 diff --git a/src/pyflakes/snapshots/ruff__pyflakes__tests__future_annotations.snap b/src/pyflakes/snapshots/ruff__pyflakes__tests__future_annotations.snap index 62afcb2bc8..fd63564ff2 100644 --- a/src/pyflakes/snapshots/ruff__pyflakes__tests__future_annotations.snap +++ b/src/pyflakes/snapshots/ruff__pyflakes__tests__future_annotations.snap @@ -13,14 +13,13 @@ expression: checks row: 8 column: 7 fix: - patch: - content: "from models import (\n Fruit,\n)" - location: - row: 6 - column: 0 - end_location: - row: 9 - column: 1 + content: "from models import (\n Fruit,\n)" + location: + row: 6 + column: 0 + end_location: + row: 9 + column: 1 - kind: UndefinedName: Bar location: diff --git a/src/pyupgrade/plugins/unnecessary_future_import.rs b/src/pyupgrade/plugins/unnecessary_future_import.rs index 9e21e8b2a3..7922615213 100644 --- a/src/pyupgrade/plugins/unnecessary_future_import.rs +++ b/src/pyupgrade/plugins/unnecessary_future_import.rs @@ -71,7 +71,7 @@ pub fn unnecessary_future_import(checker: &mut Checker, stmt: &Stmt, names: &[Lo &deleted, ) { Ok(fix) => { - if fix.patch.content.is_empty() || fix.patch.content == "pass" { + if fix.content.is_empty() || fix.content == "pass" { checker.deletions.insert(context.defined_by); } check.amend(fix); diff --git a/src/pyupgrade/plugins/useless_metaclass_type.rs b/src/pyupgrade/plugins/useless_metaclass_type.rs index 121b30a4dd..eb9d0e8046 100644 --- a/src/pyupgrade/plugins/useless_metaclass_type.rs +++ b/src/pyupgrade/plugins/useless_metaclass_type.rs @@ -25,7 +25,7 @@ pub fn useless_metaclass_type(checker: &mut Checker, stmt: &Stmt, value: &Expr, &deleted, ) { Ok(fix) => { - if fix.patch.content.is_empty() || fix.patch.content == "pass" { + if fix.content.is_empty() || fix.content == "pass" { checker.deletions.insert(context.defined_by); } check.amend(fix); diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U001_U001.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U001_U001.py.snap index 17a816aa30..5d82b6d725 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U001_U001.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U001_U001.py.snap @@ -10,14 +10,13 @@ expression: checks row: 2 column: 24 fix: - patch: - content: pass - location: - row: 2 - column: 4 - end_location: - row: 2 - column: 24 + content: pass + location: + row: 2 + column: 4 + end_location: + row: 2 + column: 24 - kind: UselessMetaclassType location: row: 6 @@ -26,12 +25,11 @@ expression: checks row: 6 column: 24 fix: - patch: - content: "" - location: - row: 6 - column: 0 - end_location: - row: 7 - column: 0 + content: "" + location: + row: 6 + column: 0 + end_location: + row: 7 + column: 0 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U003_U003.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U003_U003.py.snap index 6139e092d1..e93fc0f8cc 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U003_U003.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U003_U003.py.snap @@ -11,14 +11,13 @@ expression: checks row: 1 column: 8 fix: - patch: - content: str - location: - row: 1 - column: 0 - end_location: - row: 1 - column: 8 + content: str + location: + row: 1 + column: 0 + end_location: + row: 1 + column: 8 - kind: TypeOfPrimitive: Bytes location: @@ -28,14 +27,13 @@ expression: checks row: 2 column: 9 fix: - patch: - content: bytes - location: - row: 2 - column: 0 - end_location: - row: 2 - column: 9 + content: bytes + location: + row: 2 + column: 0 + end_location: + row: 2 + column: 9 - kind: TypeOfPrimitive: Int location: @@ -45,14 +43,13 @@ expression: checks row: 3 column: 7 fix: - patch: - content: int - location: - row: 3 - column: 0 - end_location: - row: 3 - column: 7 + content: int + location: + row: 3 + column: 0 + end_location: + row: 3 + column: 7 - kind: TypeOfPrimitive: Float location: @@ -62,14 +59,13 @@ expression: checks row: 4 column: 8 fix: - patch: - content: float - location: - row: 4 - column: 0 - end_location: - row: 4 - column: 8 + content: float + location: + row: 4 + column: 0 + end_location: + row: 4 + column: 8 - kind: TypeOfPrimitive: Complex location: @@ -79,12 +75,11 @@ expression: checks row: 5 column: 8 fix: - patch: - content: complex - location: - row: 5 - column: 0 - end_location: - row: 5 - column: 8 + content: complex + location: + row: 5 + column: 0 + end_location: + row: 5 + column: 8 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U004_U004.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U004_U004.py.snap index 62f0b4acf2..a7a2286519 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U004_U004.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U004_U004.py.snap @@ -11,14 +11,13 @@ expression: checks row: 5 column: 14 fix: - patch: - content: "" - location: - row: 5 - column: 7 - end_location: - row: 5 - column: 15 + content: "" + location: + row: 5 + column: 7 + end_location: + row: 5 + column: 15 - kind: UselessObjectInheritance: A location: @@ -28,14 +27,13 @@ expression: checks row: 10 column: 10 fix: - patch: - content: "" - location: - row: 9 - column: 7 - end_location: - row: 11 - column: 1 + content: "" + location: + row: 9 + column: 7 + end_location: + row: 11 + column: 1 - kind: UselessObjectInheritance: A location: @@ -45,14 +43,13 @@ expression: checks row: 16 column: 10 fix: - patch: - content: "" - location: - row: 15 - column: 7 - end_location: - row: 18 - column: 1 + content: "" + location: + row: 15 + column: 7 + end_location: + row: 18 + column: 1 - kind: UselessObjectInheritance: A location: @@ -62,14 +59,13 @@ expression: checks row: 24 column: 10 fix: - patch: - content: "" - location: - row: 22 - column: 7 - end_location: - row: 25 - column: 1 + content: "" + location: + row: 22 + column: 7 + end_location: + row: 25 + column: 1 - kind: UselessObjectInheritance: A location: @@ -79,14 +75,13 @@ expression: checks row: 31 column: 10 fix: - patch: - content: "" - location: - row: 29 - column: 7 - end_location: - row: 32 - column: 1 + content: "" + location: + row: 29 + column: 7 + end_location: + row: 32 + column: 1 - kind: UselessObjectInheritance: A location: @@ -96,14 +91,13 @@ expression: checks row: 37 column: 10 fix: - patch: - content: "" - location: - row: 36 - column: 7 - end_location: - row: 39 - column: 1 + content: "" + location: + row: 36 + column: 7 + end_location: + row: 39 + column: 1 - kind: UselessObjectInheritance: A location: @@ -113,14 +107,13 @@ expression: checks row: 45 column: 10 fix: - patch: - content: "" - location: - row: 43 - column: 7 - end_location: - row: 47 - column: 1 + content: "" + location: + row: 43 + column: 7 + end_location: + row: 47 + column: 1 - kind: UselessObjectInheritance: A location: @@ -130,14 +123,13 @@ expression: checks row: 53 column: 10 fix: - patch: - content: "" - location: - row: 51 - column: 7 - end_location: - row: 55 - column: 1 + content: "" + location: + row: 51 + column: 7 + end_location: + row: 55 + column: 1 - kind: UselessObjectInheritance: A location: @@ -147,14 +139,13 @@ expression: checks row: 61 column: 10 fix: - patch: - content: "" - location: - row: 59 - column: 7 - end_location: - row: 63 - column: 1 + content: "" + location: + row: 59 + column: 7 + end_location: + row: 63 + column: 1 - kind: UselessObjectInheritance: A location: @@ -164,14 +155,13 @@ expression: checks row: 69 column: 10 fix: - patch: - content: "" - location: - row: 67 - column: 7 - end_location: - row: 71 - column: 1 + content: "" + location: + row: 67 + column: 7 + end_location: + row: 71 + column: 1 - kind: UselessObjectInheritance: B location: @@ -181,14 +171,13 @@ expression: checks row: 75 column: 17 fix: - patch: - content: "" - location: - row: 75 - column: 9 - end_location: - row: 75 - column: 17 + content: "" + location: + row: 75 + column: 9 + end_location: + row: 75 + column: 17 - kind: UselessObjectInheritance: B location: @@ -198,14 +187,13 @@ expression: checks row: 79 column: 14 fix: - patch: - content: "" - location: - row: 79 - column: 8 - end_location: - row: 79 - column: 16 + content: "" + location: + row: 79 + column: 8 + end_location: + row: 79 + column: 16 - kind: UselessObjectInheritance: B location: @@ -215,14 +203,13 @@ expression: checks row: 84 column: 10 fix: - patch: - content: "" - location: - row: 84 - column: 4 - end_location: - row: 85 - column: 4 + content: "" + location: + row: 84 + column: 4 + end_location: + row: 85 + column: 4 - kind: UselessObjectInheritance: B location: @@ -232,14 +219,13 @@ expression: checks row: 92 column: 10 fix: - patch: - content: "" - location: - row: 91 - column: 5 - end_location: - row: 92 - column: 10 + content: "" + location: + row: 91 + column: 5 + end_location: + row: 92 + column: 10 - kind: UselessObjectInheritance: B location: @@ -249,14 +235,13 @@ expression: checks row: 98 column: 10 fix: - patch: - content: "" - location: - row: 98 - column: 4 - end_location: - row: 99 - column: 4 + content: "" + location: + row: 98 + column: 4 + end_location: + row: 99 + column: 4 - kind: UselessObjectInheritance: B location: @@ -266,14 +251,13 @@ expression: checks row: 108 column: 10 fix: - patch: - content: "" - location: - row: 107 - column: 5 - end_location: - row: 108 - column: 10 + content: "" + location: + row: 107 + column: 5 + end_location: + row: 108 + column: 10 - kind: UselessObjectInheritance: A location: @@ -283,14 +267,13 @@ expression: checks row: 114 column: 18 fix: - patch: - content: "" - location: - row: 114 - column: 11 - end_location: - row: 114 - column: 19 + content: "" + location: + row: 114 + column: 11 + end_location: + row: 114 + column: 19 - kind: UselessObjectInheritance: A location: @@ -300,14 +283,13 @@ expression: checks row: 119 column: 10 fix: - patch: - content: "" - location: - row: 118 - column: 7 - end_location: - row: 120 - column: 1 + content: "" + location: + row: 118 + column: 7 + end_location: + row: 120 + column: 1 - kind: UselessObjectInheritance: A location: @@ -317,14 +299,13 @@ expression: checks row: 125 column: 10 fix: - patch: - content: "" - location: - row: 124 - column: 7 - end_location: - row: 126 - column: 1 + content: "" + location: + row: 124 + column: 7 + end_location: + row: 126 + column: 1 - kind: UselessObjectInheritance: A location: @@ -334,12 +315,11 @@ expression: checks row: 131 column: 10 fix: - patch: - content: "" - location: - row: 130 - column: 7 - end_location: - row: 133 - column: 1 + content: "" + location: + row: 130 + column: 7 + end_location: + row: 133 + column: 1 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U005_U005.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U005_U005.py.snap index f10a2188c1..e9ebc2eb77 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U005_U005.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U005_U005.py.snap @@ -13,14 +13,13 @@ expression: checks row: 6 column: 25 fix: - patch: - content: self.assertEqual - location: - row: 6 - column: 8 - end_location: - row: 6 - column: 25 + content: self.assertEqual + location: + row: 6 + column: 8 + end_location: + row: 6 + column: 25 - kind: DeprecatedUnittestAlias: - assertEquals @@ -32,14 +31,13 @@ expression: checks row: 7 column: 25 fix: - patch: - content: self.assertEqual - location: - row: 7 - column: 8 - end_location: - row: 7 - column: 25 + content: self.assertEqual + location: + row: 7 + column: 8 + end_location: + row: 7 + column: 25 - kind: DeprecatedUnittestAlias: - failUnlessAlmostEqual @@ -51,14 +49,13 @@ expression: checks row: 9 column: 34 fix: - patch: - content: self.assertAlmostEqual - location: - row: 9 - column: 8 - end_location: - row: 9 - column: 34 + content: self.assertAlmostEqual + location: + row: 9 + column: 8 + end_location: + row: 9 + column: 34 - kind: DeprecatedUnittestAlias: - assertNotRegexpMatches @@ -70,12 +67,11 @@ expression: checks row: 10 column: 35 fix: - patch: - content: self.assertNotRegex - location: - row: 10 - column: 8 - end_location: - row: 10 - column: 35 + content: self.assertNotRegex + location: + row: 10 + column: 8 + end_location: + row: 10 + column: 35 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U006_U006.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U006_U006.py.snap index 482151a5f3..9b0b90021c 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U006_U006.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U006_U006.py.snap @@ -11,14 +11,13 @@ expression: checks row: 4 column: 20 fix: - patch: - content: list - location: - row: 4 - column: 9 - end_location: - row: 4 - column: 20 + content: list + location: + row: 4 + column: 9 + end_location: + row: 4 + column: 20 - kind: UsePEP585Annotation: List location: @@ -28,14 +27,13 @@ expression: checks row: 11 column: 13 fix: - patch: - content: list - location: - row: 11 - column: 9 - end_location: - row: 11 - column: 13 + content: list + location: + row: 11 + column: 9 + end_location: + row: 11 + column: 13 - kind: UsePEP585Annotation: List location: @@ -45,14 +43,13 @@ expression: checks row: 18 column: 15 fix: - patch: - content: list - location: - row: 18 - column: 9 - end_location: - row: 18 - column: 15 + content: list + location: + row: 18 + column: 9 + end_location: + row: 18 + column: 15 - kind: UsePEP585Annotation: List location: @@ -62,12 +59,11 @@ expression: checks row: 25 column: 14 fix: - patch: - content: list - location: - row: 25 - column: 9 - end_location: - row: 25 - column: 14 + content: list + location: + row: 25 + column: 9 + end_location: + row: 25 + column: 14 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U007_U007.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U007_U007.py.snap index 7d901d0231..130b97a183 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U007_U007.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U007_U007.py.snap @@ -10,14 +10,13 @@ expression: checks row: 6 column: 22 fix: - patch: - content: str | None - location: - row: 6 - column: 9 - end_location: - row: 6 - column: 22 + content: str | None + location: + row: 6 + column: 9 + end_location: + row: 6 + column: 22 - kind: UsePEP604Annotation location: row: 10 @@ -26,14 +25,13 @@ expression: checks row: 10 column: 29 fix: - patch: - content: str | None - location: - row: 10 - column: 9 - end_location: - row: 10 - column: 29 + content: str | None + location: + row: 10 + column: 9 + end_location: + row: 10 + column: 29 - kind: UsePEP604Annotation location: row: 14 @@ -42,14 +40,13 @@ expression: checks row: 14 column: 45 fix: - patch: - content: "str | int | Union[float, bytes]" - location: - row: 14 - column: 9 - end_location: - row: 14 - column: 45 + content: "str | int | Union[float, bytes]" + location: + row: 14 + column: 9 + end_location: + row: 14 + column: 45 - kind: UsePEP604Annotation location: row: 14 @@ -58,14 +55,13 @@ expression: checks row: 14 column: 44 fix: - patch: - content: float | bytes - location: - row: 14 - column: 25 - end_location: - row: 14 - column: 44 + content: float | bytes + location: + row: 14 + column: 25 + end_location: + row: 14 + column: 44 - kind: UsePEP604Annotation location: row: 18 @@ -74,14 +70,13 @@ expression: checks row: 18 column: 31 fix: - patch: - content: str | int - location: - row: 18 - column: 9 - end_location: - row: 18 - column: 31 + content: str | int + location: + row: 18 + column: 9 + end_location: + row: 18 + column: 31 - kind: UsePEP604Annotation location: row: 22 @@ -90,14 +85,13 @@ expression: checks row: 22 column: 33 fix: - patch: - content: str | int - location: - row: 22 - column: 9 - end_location: - row: 22 - column: 33 + content: str | int + location: + row: 22 + column: 9 + end_location: + row: 22 + column: 33 - kind: UsePEP604Annotation location: row: 26 @@ -106,12 +100,11 @@ expression: checks row: 26 column: 40 fix: - patch: - content: "(str, int) | float" - location: - row: 26 - column: 9 - end_location: - row: 26 - column: 40 + content: "(str, int) | float" + location: + row: 26 + column: 9 + end_location: + row: 26 + column: 40 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U008_U008.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U008_U008.py.snap index 33e398617c..ad8a4edffd 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U008_U008.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U008_U008.py.snap @@ -10,14 +10,13 @@ expression: checks row: 17 column: 35 fix: - patch: - content: super() - location: - row: 17 - column: 17 - end_location: - row: 17 - column: 35 + content: super() + location: + row: 17 + column: 17 + end_location: + row: 17 + column: 35 - kind: SuperCallWithParameters location: row: 18 @@ -26,14 +25,13 @@ expression: checks row: 18 column: 26 fix: - patch: - content: super() - location: - row: 18 - column: 8 - end_location: - row: 18 - column: 26 + content: super() + location: + row: 18 + column: 8 + end_location: + row: 18 + column: 26 - kind: SuperCallWithParameters location: row: 19 @@ -42,14 +40,13 @@ expression: checks row: 22 column: 9 fix: - patch: - content: super() - location: - row: 19 - column: 8 - end_location: - row: 22 - column: 9 + content: super() + location: + row: 19 + column: 8 + end_location: + row: 22 + column: 9 - kind: SuperCallWithParameters location: row: 36 @@ -58,14 +55,13 @@ expression: checks row: 36 column: 28 fix: - patch: - content: super() - location: - row: 36 - column: 8 - end_location: - row: 36 - column: 28 + content: super() + location: + row: 36 + column: 8 + end_location: + row: 36 + column: 28 - kind: SuperCallWithParameters location: row: 50 @@ -74,12 +70,11 @@ expression: checks row: 50 column: 32 fix: - patch: - content: super() - location: - row: 50 - column: 12 - end_location: - row: 50 - column: 32 + content: super() + location: + row: 50 + column: 12 + end_location: + row: 50 + column: 32 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U009_U009_0.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U009_U009_0.py.snap index 57ec222a86..6b0a05df3e 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U009_U009_0.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U009_U009_0.py.snap @@ -10,12 +10,11 @@ expression: checks row: 2 column: 0 fix: - patch: - content: "" - location: - row: 1 - column: 0 - end_location: - row: 2 - column: 0 + content: "" + location: + row: 1 + column: 0 + end_location: + row: 2 + column: 0 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U009_U009_1.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U009_U009_1.py.snap index 38da9578b2..d4ad09f5bb 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U009_U009_1.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U009_U009_1.py.snap @@ -10,12 +10,11 @@ expression: checks row: 3 column: 0 fix: - patch: - content: "" - location: - row: 2 - column: 0 - end_location: - row: 3 - column: 0 + content: "" + location: + row: 2 + column: 0 + end_location: + row: 3 + column: 0 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U010_U010.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U010_U010.py.snap index 389e393fcd..525a1373f3 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U010_U010.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U010_U010.py.snap @@ -13,14 +13,13 @@ expression: checks row: 1 column: 48 fix: - patch: - content: "" - location: - row: 1 - column: 0 - end_location: - row: 2 - column: 0 + content: "" + location: + row: 1 + column: 0 + end_location: + row: 2 + column: 0 - kind: UnnecessaryFutureImport: - unicode_literals @@ -32,14 +31,13 @@ expression: checks row: 2 column: 55 fix: - patch: - content: "" - location: - row: 2 - column: 0 - end_location: - row: 3 - column: 0 + content: "" + location: + row: 2 + column: 0 + end_location: + row: 3 + column: 0 - kind: UnnecessaryFutureImport: - absolute_import @@ -51,14 +49,13 @@ expression: checks row: 3 column: 48 fix: - patch: - content: "" - location: - row: 3 - column: 0 - end_location: - row: 4 - column: 0 + content: "" + location: + row: 3 + column: 0 + end_location: + row: 4 + column: 0 - kind: UnnecessaryFutureImport: - generator_stop @@ -69,14 +66,13 @@ expression: checks row: 4 column: 37 fix: - patch: - content: "" - location: - row: 4 - column: 0 - end_location: - row: 5 - column: 0 + content: "" + location: + row: 4 + column: 0 + end_location: + row: 5 + column: 0 - kind: UnnecessaryFutureImport: - generator_stop @@ -88,14 +84,13 @@ expression: checks row: 5 column: 53 fix: - patch: - content: "" - location: - row: 5 - column: 0 - end_location: - row: 6 - column: 0 + content: "" + location: + row: 5 + column: 0 + end_location: + row: 6 + column: 0 - kind: UnnecessaryFutureImport: - generators @@ -106,14 +101,13 @@ expression: checks row: 6 column: 49 fix: - patch: - content: from __future__ import invalid_module - location: - row: 6 - column: 0 - end_location: - row: 6 - column: 49 + content: from __future__ import invalid_module + location: + row: 6 + column: 0 + end_location: + row: 6 + column: 49 - kind: UnnecessaryFutureImport: - generator_stop @@ -124,14 +118,13 @@ expression: checks row: 9 column: 41 fix: - patch: - content: "" - location: - row: 9 - column: 0 - end_location: - row: 10 - column: 0 + content: "" + location: + row: 9 + column: 0 + end_location: + row: 10 + column: 0 - kind: UnnecessaryFutureImport: - generators @@ -142,14 +135,13 @@ expression: checks row: 10 column: 37 fix: - patch: - content: pass - location: - row: 10 - column: 4 - end_location: - row: 10 - column: 37 + content: pass + location: + row: 10 + column: 4 + end_location: + row: 10 + column: 37 - kind: UnnecessaryFutureImport: - generator_stop @@ -160,14 +152,13 @@ expression: checks row: 13 column: 41 fix: - patch: - content: "" - location: - row: 13 - column: 0 - end_location: - row: 14 - column: 0 + content: "" + location: + row: 13 + column: 0 + end_location: + row: 14 + column: 0 - kind: UnnecessaryFutureImport: - generators @@ -178,12 +169,11 @@ expression: checks row: 14 column: 53 fix: - patch: - content: from __future__ import invalid_module - location: - row: 14 - column: 4 - end_location: - row: 14 - column: 53 + content: from __future__ import invalid_module + location: + row: 14 + column: 4 + end_location: + row: 14 + column: 53 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U011_U011_0.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U011_U011_0.py.snap index 091da0df25..7718c1de12 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U011_U011_0.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U011_U011_0.py.snap @@ -10,14 +10,13 @@ expression: checks row: 5 column: 12 fix: - patch: - content: "" - location: - row: 5 - column: 10 - end_location: - row: 5 - column: 12 + content: "" + location: + row: 5 + column: 10 + end_location: + row: 5 + column: 12 - kind: UnnecessaryLRUCacheParams location: row: 11 @@ -26,14 +25,13 @@ expression: checks row: 11 column: 22 fix: - patch: - content: "" - location: - row: 11 - column: 20 - end_location: - row: 11 - column: 22 + content: "" + location: + row: 11 + column: 20 + end_location: + row: 11 + column: 22 - kind: UnnecessaryLRUCacheParams location: row: 16 @@ -42,14 +40,13 @@ expression: checks row: 16 column: 24 fix: - patch: - content: "" - location: - row: 16 - column: 10 - end_location: - row: 16 - column: 24 + content: "" + location: + row: 16 + column: 10 + end_location: + row: 16 + column: 24 - kind: UnnecessaryLRUCacheParams location: row: 21 @@ -58,14 +55,13 @@ expression: checks row: 21 column: 34 fix: - patch: - content: "" - location: - row: 21 - column: 20 - end_location: - row: 21 - column: 34 + content: "" + location: + row: 21 + column: 20 + end_location: + row: 21 + column: 34 - kind: UnnecessaryLRUCacheParams location: row: 27 @@ -74,14 +70,13 @@ expression: checks row: 28 column: 1 fix: - patch: - content: "" - location: - row: 27 - column: 10 - end_location: - row: 28 - column: 1 + content: "" + location: + row: 27 + column: 10 + end_location: + row: 28 + column: 1 - kind: UnnecessaryLRUCacheParams location: row: 33 @@ -90,14 +85,13 @@ expression: checks row: 35 column: 1 fix: - patch: - content: "" - location: - row: 33 - column: 10 - end_location: - row: 35 - column: 1 + content: "" + location: + row: 33 + column: 10 + end_location: + row: 35 + column: 1 - kind: UnnecessaryLRUCacheParams location: row: 40 @@ -106,14 +100,13 @@ expression: checks row: 42 column: 19 fix: - patch: - content: "" - location: - row: 40 - column: 20 - end_location: - row: 42 - column: 19 + content: "" + location: + row: 40 + column: 20 + end_location: + row: 42 + column: 19 - kind: UnnecessaryLRUCacheParams location: row: 47 @@ -122,14 +115,13 @@ expression: checks row: 51 column: 1 fix: - patch: - content: "" - location: - row: 47 - column: 20 - end_location: - row: 51 - column: 1 + content: "" + location: + row: 47 + column: 20 + end_location: + row: 51 + column: 1 - kind: UnnecessaryLRUCacheParams location: row: 56 @@ -138,14 +130,13 @@ expression: checks row: 62 column: 1 fix: - patch: - content: "" - location: - row: 56 - column: 20 - end_location: - row: 62 - column: 1 + content: "" + location: + row: 56 + column: 20 + end_location: + row: 62 + column: 1 - kind: UnnecessaryLRUCacheParams location: row: 67 @@ -154,12 +145,11 @@ expression: checks row: 72 column: 1 fix: - patch: - content: "" - location: - row: 67 - column: 20 - end_location: - row: 72 - column: 1 + content: "" + location: + row: 67 + column: 20 + end_location: + row: 72 + column: 1 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U012_U012.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U012_U012.py.snap index 8cdeb6106b..89ad531db6 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U012_U012.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U012_U012.py.snap @@ -10,14 +10,13 @@ expression: checks row: 2 column: 21 fix: - patch: - content: "b\"foo\"" - location: - row: 2 - column: 0 - end_location: - row: 2 - column: 21 + content: "b\"foo\"" + location: + row: 2 + column: 0 + end_location: + row: 2 + column: 21 - kind: UnnecessaryEncodeUTF8 location: row: 3 @@ -26,14 +25,13 @@ expression: checks row: 3 column: 18 fix: - patch: - content: "b\"foo\"" - location: - row: 3 - column: 0 - end_location: - row: 3 - column: 18 + content: "b\"foo\"" + location: + row: 3 + column: 0 + end_location: + row: 3 + column: 18 - kind: UnnecessaryEncodeUTF8 location: row: 4 @@ -42,14 +40,13 @@ expression: checks row: 4 column: 14 fix: - patch: - content: "b\"foo\"" - location: - row: 4 - column: 0 - end_location: - row: 4 - column: 14 + content: "b\"foo\"" + location: + row: 4 + column: 0 + end_location: + row: 4 + column: 14 - kind: UnnecessaryEncodeUTF8 location: row: 5 @@ -58,14 +55,13 @@ expression: checks row: 5 column: 20 fix: - patch: - content: "b\"foo\"" - location: - row: 5 - column: 0 - end_location: - row: 5 - column: 20 + content: "b\"foo\"" + location: + row: 5 + column: 0 + end_location: + row: 5 + column: 20 - kind: UnnecessaryEncodeUTF8 location: row: 6 @@ -74,14 +70,13 @@ expression: checks row: 6 column: 22 fix: - patch: - content: "b\"foo\"" - location: - row: 6 - column: 0 - end_location: - row: 6 - column: 22 + content: "b\"foo\"" + location: + row: 6 + column: 0 + end_location: + row: 6 + column: 22 - kind: UnnecessaryEncodeUTF8 location: row: 7 @@ -90,14 +85,13 @@ expression: checks row: 7 column: 30 fix: - patch: - content: "b\"foo\"" - location: - row: 7 - column: 0 - end_location: - row: 7 - column: 30 + content: "b\"foo\"" + location: + row: 7 + column: 0 + end_location: + row: 7 + column: 30 - kind: UnnecessaryEncodeUTF8 location: row: 8 @@ -106,14 +100,13 @@ expression: checks row: 14 column: 1 fix: - patch: - content: "b\"\"\"\nLorem\n\nIpsum\n\"\"\"" - location: - row: 8 - column: 0 - end_location: - row: 14 - column: 1 + content: "b\"\"\"\nLorem\n\nIpsum\n\"\"\"" + location: + row: 8 + column: 0 + end_location: + row: 14 + column: 1 - kind: UnnecessaryEncodeUTF8 location: row: 26 @@ -122,14 +115,13 @@ expression: checks row: 26 column: 27 fix: - patch: - content: "" - location: - row: 26 - column: 19 - end_location: - row: 26 - column: 26 + content: "" + location: + row: 26 + column: 19 + end_location: + row: 26 + column: 26 - kind: UnnecessaryEncodeUTF8 location: row: 44 @@ -138,14 +130,13 @@ expression: checks row: 44 column: 31 fix: - patch: - content: "" - location: - row: 44 - column: 23 - end_location: - row: 44 - column: 30 + content: "" + location: + row: 44 + column: 23 + end_location: + row: 44 + column: 30 - kind: UnnecessaryEncodeUTF8 location: row: 46 @@ -154,14 +145,13 @@ expression: checks row: 46 column: 39 fix: - patch: - content: "" - location: - row: 46 - column: 23 - end_location: - row: 46 - column: 38 + content: "" + location: + row: 46 + column: 23 + end_location: + row: 46 + column: 38 - kind: UnnecessaryEncodeUTF8 location: row: 48 @@ -170,14 +160,13 @@ expression: checks row: 48 column: 23 fix: - patch: - content: "br\"fo\\o\"" - location: - row: 48 - column: 0 - end_location: - row: 48 - column: 23 + content: "br\"fo\\o\"" + location: + row: 48 + column: 0 + end_location: + row: 48 + column: 23 - kind: UnnecessaryEncodeUTF8 location: row: 49 @@ -186,14 +175,13 @@ expression: checks row: 49 column: 22 fix: - patch: - content: "b\"foo\"" - location: - row: 49 - column: 0 - end_location: - row: 49 - column: 22 + content: "b\"foo\"" + location: + row: 49 + column: 0 + end_location: + row: 49 + column: 22 - kind: UnnecessaryEncodeUTF8 location: row: 50 @@ -202,14 +190,13 @@ expression: checks row: 50 column: 23 fix: - patch: - content: "bR\"fo\\o\"" - location: - row: 50 - column: 0 - end_location: - row: 50 - column: 23 + content: "bR\"fo\\o\"" + location: + row: 50 + column: 0 + end_location: + row: 50 + column: 23 - kind: UnnecessaryEncodeUTF8 location: row: 51 @@ -218,14 +205,13 @@ expression: checks row: 51 column: 22 fix: - patch: - content: "b\"foo\"" - location: - row: 51 - column: 0 - end_location: - row: 51 - column: 22 + content: "b\"foo\"" + location: + row: 51 + column: 0 + end_location: + row: 51 + column: 22 - kind: UnnecessaryEncodeUTF8 location: row: 52 @@ -234,12 +220,11 @@ expression: checks row: 52 column: 20 fix: - patch: - content: "b\"foo\"" - location: - row: 52 - column: 6 - end_location: - row: 52 - column: 20 + content: "b\"foo\"" + location: + row: 52 + column: 6 + end_location: + row: 52 + column: 20 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U013_U013.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U013_U013.py.snap index 76405cb9cd..3202f0e3a2 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U013_U013.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U013_U013.py.snap @@ -11,14 +11,13 @@ expression: checks row: 5 column: 52 fix: - patch: - content: "class MyType1(TypedDict):\n a: int\n b: str" - location: - row: 5 - column: 0 - end_location: - row: 5 - column: 52 + content: "class MyType1(TypedDict):\n a: int\n b: str" + location: + row: 5 + column: 0 + end_location: + row: 5 + column: 52 - kind: ConvertTypedDictFunctionalToClass: MyType2 location: @@ -28,14 +27,13 @@ expression: checks row: 8 column: 50 fix: - patch: - content: "class MyType2(TypedDict):\n a: int\n b: str" - location: - row: 8 - column: 0 - end_location: - row: 8 - column: 50 + content: "class MyType2(TypedDict):\n a: int\n b: str" + location: + row: 8 + column: 0 + end_location: + row: 8 + column: 50 - kind: ConvertTypedDictFunctionalToClass: MyType3 location: @@ -45,14 +43,13 @@ expression: checks row: 11 column: 44 fix: - patch: - content: "class MyType3(TypedDict):\n a: int\n b: str" - location: - row: 11 - column: 0 - end_location: - row: 11 - column: 44 + content: "class MyType3(TypedDict):\n a: int\n b: str" + location: + row: 11 + column: 0 + end_location: + row: 11 + column: 44 - kind: ConvertTypedDictFunctionalToClass: MyType4 location: @@ -62,14 +59,13 @@ expression: checks row: 14 column: 30 fix: - patch: - content: "class MyType4(TypedDict):\n pass" - location: - row: 14 - column: 0 - end_location: - row: 14 - column: 30 + content: "class MyType4(TypedDict):\n pass" + location: + row: 14 + column: 0 + end_location: + row: 14 + column: 30 - kind: ConvertTypedDictFunctionalToClass: MyType5 location: @@ -79,14 +75,13 @@ expression: checks row: 17 column: 46 fix: - patch: - content: "class MyType5(TypedDict):\n a: 'hello'" - location: - row: 17 - column: 0 - end_location: - row: 17 - column: 46 + content: "class MyType5(TypedDict):\n a: 'hello'" + location: + row: 17 + column: 0 + end_location: + row: 17 + column: 46 - kind: ConvertTypedDictFunctionalToClass: MyType6 location: @@ -96,14 +91,13 @@ expression: checks row: 18 column: 41 fix: - patch: - content: "class MyType6(TypedDict):\n a: 'hello'" - location: - row: 18 - column: 0 - end_location: - row: 18 - column: 41 + content: "class MyType6(TypedDict):\n a: 'hello'" + location: + row: 18 + column: 0 + end_location: + row: 18 + column: 41 - kind: ConvertTypedDictFunctionalToClass: MyType7 location: @@ -113,14 +107,13 @@ expression: checks row: 21 column: 56 fix: - patch: - content: "class MyType7(TypedDict):\n a: NotRequired[dict]" - location: - row: 21 - column: 0 - end_location: - row: 21 - column: 56 + content: "class MyType7(TypedDict):\n a: NotRequired[dict]" + location: + row: 21 + column: 0 + end_location: + row: 21 + column: 56 - kind: ConvertTypedDictFunctionalToClass: MyType8 location: @@ -130,14 +123,13 @@ expression: checks row: 24 column: 65 fix: - patch: - content: "class MyType8(TypedDict, total=False):\n x: int\n y: int" - location: - row: 24 - column: 0 - end_location: - row: 24 - column: 65 + content: "class MyType8(TypedDict, total=False):\n x: int\n y: int" + location: + row: 24 + column: 0 + end_location: + row: 24 + column: 65 - kind: ConvertTypedDictFunctionalToClass: MyType10 location: @@ -147,14 +139,13 @@ expression: checks row: 30 column: 59 fix: - patch: - content: "class MyType10(TypedDict):\n key: Literal['value']" - location: - row: 30 - column: 0 - end_location: - row: 30 - column: 59 + content: "class MyType10(TypedDict):\n key: Literal['value']" + location: + row: 30 + column: 0 + end_location: + row: 30 + column: 59 - kind: ConvertTypedDictFunctionalToClass: MyType11 location: @@ -164,12 +155,11 @@ expression: checks row: 33 column: 53 fix: - patch: - content: "class MyType11(typing.TypedDict):\n key: int" - location: - row: 33 - column: 0 - end_location: - row: 33 - column: 53 + content: "class MyType11(typing.TypedDict):\n key: int" + location: + row: 33 + column: 0 + end_location: + row: 33 + column: 53 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U014_U014.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U014_U014.py.snap index 4d6b9e7ac6..77827eb686 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U014_U014.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U014_U014.py.snap @@ -11,14 +11,13 @@ expression: checks row: 5 column: 61 fix: - patch: - content: "class NT1(NamedTuple):\n a: int\n b: tuple[str, ...]" - location: - row: 5 - column: 0 - end_location: - row: 5 - column: 61 + content: "class NT1(NamedTuple):\n a: int\n b: tuple[str, ...]" + location: + row: 5 + column: 0 + end_location: + row: 5 + column: 61 - kind: ConvertNamedTupleFunctionalToClass: NT2 location: @@ -28,14 +27,13 @@ expression: checks row: 12 column: 1 fix: - patch: - content: "class NT2(NamedTuple):\n a: int\n b: str = 'foo'\n c: list[bool] = [True]" - location: - row: 8 - column: 0 - end_location: - row: 12 - column: 1 + content: "class NT2(NamedTuple):\n a: int\n b: str = 'foo'\n c: list[bool] = [True]" + location: + row: 8 + column: 0 + end_location: + row: 12 + column: 1 - kind: ConvertNamedTupleFunctionalToClass: NT3 location: @@ -45,12 +43,11 @@ expression: checks row: 15 column: 56 fix: - patch: - content: "class NT3(typing.NamedTuple):\n a: int\n b: str" - location: - row: 15 - column: 0 - end_location: - row: 15 - column: 56 + content: "class NT3(typing.NamedTuple):\n a: int\n b: str" + location: + row: 15 + column: 0 + end_location: + row: 15 + column: 56 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U015_U015.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U015_U015.py.snap index 03ab605147..87be59e5ac 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U015_U015.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__U015_U015.py.snap @@ -10,14 +10,13 @@ expression: checks row: 1 column: 16 fix: - patch: - content: "" - location: - row: 1 - column: 10 - end_location: - row: 1 - column: 15 + content: "" + location: + row: 1 + column: 10 + end_location: + row: 1 + column: 15 - kind: RedundantOpenModes location: row: 2 @@ -26,14 +25,13 @@ expression: checks row: 2 column: 17 fix: - patch: - content: "" - location: - row: 2 - column: 10 - end_location: - row: 2 - column: 16 + content: "" + location: + row: 2 + column: 10 + end_location: + row: 2 + column: 16 - kind: RedundantOpenModes location: row: 3 @@ -42,14 +40,13 @@ expression: checks row: 3 column: 17 fix: - patch: - content: "\"rb\"" - location: - row: 3 - column: 12 - end_location: - row: 3 - column: 16 + content: "\"rb\"" + location: + row: 3 + column: 12 + end_location: + row: 3 + column: 16 - kind: RedundantOpenModes location: row: 4 @@ -58,14 +55,13 @@ expression: checks row: 4 column: 18 fix: - patch: - content: "\"rb\"" - location: - row: 4 - column: 12 - end_location: - row: 4 - column: 17 + content: "\"rb\"" + location: + row: 4 + column: 12 + end_location: + row: 4 + column: 17 - kind: RedundantOpenModes location: row: 5 @@ -74,14 +70,13 @@ expression: checks row: 5 column: 16 fix: - patch: - content: "" - location: - row: 5 - column: 10 - end_location: - row: 5 - column: 15 + content: "" + location: + row: 5 + column: 10 + end_location: + row: 5 + column: 15 - kind: RedundantOpenModes location: row: 6 @@ -90,14 +85,13 @@ expression: checks row: 6 column: 17 fix: - patch: - content: "" - location: - row: 6 - column: 10 - end_location: - row: 6 - column: 16 + content: "" + location: + row: 6 + column: 10 + end_location: + row: 6 + column: 16 - kind: RedundantOpenModes location: row: 7 @@ -106,14 +100,13 @@ expression: checks row: 7 column: 32 fix: - patch: - content: "" - location: - row: 7 - column: 8 - end_location: - row: 7 - column: 13 + content: "" + location: + row: 7 + column: 8 + end_location: + row: 7 + column: 13 - kind: RedundantOpenModes location: row: 8 @@ -122,14 +115,13 @@ expression: checks row: 8 column: 15 fix: - patch: - content: "\"w\"" - location: - row: 8 - column: 10 - end_location: - row: 8 - column: 14 + content: "\"w\"" + location: + row: 8 + column: 10 + end_location: + row: 8 + column: 14 - kind: RedundantOpenModes location: row: 10 @@ -138,14 +130,13 @@ expression: checks row: 10 column: 21 fix: - patch: - content: "" - location: - row: 10 - column: 15 - end_location: - row: 10 - column: 20 + content: "" + location: + row: 10 + column: 15 + end_location: + row: 10 + column: 20 - kind: RedundantOpenModes location: row: 12 @@ -154,14 +145,13 @@ expression: checks row: 12 column: 22 fix: - patch: - content: "" - location: - row: 12 - column: 15 - end_location: - row: 12 - column: 21 + content: "" + location: + row: 12 + column: 15 + end_location: + row: 12 + column: 21 - kind: RedundantOpenModes location: row: 14 @@ -170,14 +160,13 @@ expression: checks row: 14 column: 22 fix: - patch: - content: "\"rb\"" - location: - row: 14 - column: 17 - end_location: - row: 14 - column: 21 + content: "\"rb\"" + location: + row: 14 + column: 17 + end_location: + row: 14 + column: 21 - kind: RedundantOpenModes location: row: 16 @@ -186,14 +175,13 @@ expression: checks row: 16 column: 23 fix: - patch: - content: "\"rb\"" - location: - row: 16 - column: 17 - end_location: - row: 16 - column: 22 + content: "\"rb\"" + location: + row: 16 + column: 17 + end_location: + row: 16 + column: 22 - kind: RedundantOpenModes location: row: 18 @@ -202,14 +190,13 @@ expression: checks row: 18 column: 21 fix: - patch: - content: "" - location: - row: 18 - column: 15 - end_location: - row: 18 - column: 20 + content: "" + location: + row: 18 + column: 15 + end_location: + row: 18 + column: 20 - kind: RedundantOpenModes location: row: 20 @@ -218,14 +205,13 @@ expression: checks row: 20 column: 22 fix: - patch: - content: "" - location: - row: 20 - column: 15 - end_location: - row: 20 - column: 21 + content: "" + location: + row: 20 + column: 15 + end_location: + row: 20 + column: 21 - kind: RedundantOpenModes location: row: 22 @@ -234,14 +220,13 @@ expression: checks row: 22 column: 39 fix: - patch: - content: "" - location: - row: 22 - column: 15 - end_location: - row: 22 - column: 20 + content: "" + location: + row: 22 + column: 15 + end_location: + row: 22 + column: 20 - kind: RedundantOpenModes location: row: 24 @@ -250,14 +235,13 @@ expression: checks row: 24 column: 22 fix: - patch: - content: "\"w\"" - location: - row: 24 - column: 17 - end_location: - row: 24 - column: 21 + content: "\"w\"" + location: + row: 24 + column: 17 + end_location: + row: 24 + column: 21 - kind: RedundantOpenModes location: row: 27 @@ -266,14 +250,13 @@ expression: checks row: 27 column: 27 fix: - patch: - content: "" - location: - row: 27 - column: 21 - end_location: - row: 27 - column: 26 + content: "" + location: + row: 27 + column: 21 + end_location: + row: 27 + column: 26 - kind: RedundantOpenModes location: row: 28 @@ -282,14 +265,13 @@ expression: checks row: 28 column: 28 fix: - patch: - content: "\"rb\"" - location: - row: 28 - column: 23 - end_location: - row: 28 - column: 27 + content: "\"rb\"" + location: + row: 28 + column: 23 + end_location: + row: 28 + column: 27 - kind: RedundantOpenModes location: row: 30 @@ -298,14 +280,13 @@ expression: checks row: 30 column: 32 fix: - patch: - content: "" - location: - row: 30 - column: 26 - end_location: - row: 30 - column: 31 + content: "" + location: + row: 30 + column: 26 + end_location: + row: 30 + column: 31 - kind: RedundantOpenModes location: row: 32 @@ -314,14 +295,13 @@ expression: checks row: 32 column: 33 fix: - patch: - content: "\"rb\"" - location: - row: 32 - column: 28 - end_location: - row: 32 - column: 32 + content: "\"rb\"" + location: + row: 32 + column: 28 + end_location: + row: 32 + column: 32 - kind: RedundantOpenModes location: row: 35 @@ -330,14 +310,13 @@ expression: checks row: 35 column: 21 fix: - patch: - content: "" - location: - row: 35 - column: 15 - end_location: - row: 35 - column: 20 + content: "" + location: + row: 35 + column: 15 + end_location: + row: 35 + column: 20 - kind: RedundantOpenModes location: row: 35 @@ -346,14 +325,13 @@ expression: checks row: 35 column: 45 fix: - patch: - content: "" - location: - row: 35 - column: 39 - end_location: - row: 35 - column: 44 + content: "" + location: + row: 35 + column: 39 + end_location: + row: 35 + column: 44 - kind: RedundantOpenModes location: row: 37 @@ -362,14 +340,13 @@ expression: checks row: 37 column: 22 fix: - patch: - content: "\"rb\"" - location: - row: 37 - column: 17 - end_location: - row: 37 - column: 21 + content: "\"rb\"" + location: + row: 37 + column: 17 + end_location: + row: 37 + column: 21 - kind: RedundantOpenModes location: row: 37 @@ -378,14 +355,13 @@ expression: checks row: 37 column: 47 fix: - patch: - content: "\"rb\"" - location: - row: 37 - column: 42 - end_location: - row: 37 - column: 46 + content: "\"rb\"" + location: + row: 37 + column: 42 + end_location: + row: 37 + column: 46 - kind: RedundantOpenModes location: row: 40 @@ -394,14 +370,13 @@ expression: checks row: 40 column: 21 fix: - patch: - content: "" - location: - row: 40 - column: 10 - end_location: - row: 40 - column: 20 + content: "" + location: + row: 40 + column: 10 + end_location: + row: 40 + column: 20 - kind: RedundantOpenModes location: row: 41 @@ -410,14 +385,13 @@ expression: checks row: 41 column: 26 fix: - patch: - content: "" - location: - row: 41 - column: 15 - end_location: - row: 41 - column: 25 + content: "" + location: + row: 41 + column: 15 + end_location: + row: 41 + column: 25 - kind: RedundantOpenModes location: row: 42 @@ -426,14 +400,13 @@ expression: checks row: 42 column: 26 fix: - patch: - content: "" - location: - row: 42 - column: 5 - end_location: - row: 42 - column: 15 + content: "" + location: + row: 42 + column: 5 + end_location: + row: 42 + column: 15 - kind: RedundantOpenModes location: row: 44 @@ -442,14 +415,13 @@ expression: checks row: 44 column: 26 fix: - patch: - content: "" - location: - row: 44 - column: 15 - end_location: - row: 44 - column: 25 + content: "" + location: + row: 44 + column: 15 + end_location: + row: 44 + column: 25 - kind: RedundantOpenModes location: row: 46 @@ -458,14 +430,13 @@ expression: checks row: 46 column: 31 fix: - patch: - content: "" - location: - row: 46 - column: 20 - end_location: - row: 46 - column: 30 + content: "" + location: + row: 46 + column: 20 + end_location: + row: 46 + column: 30 - kind: RedundantOpenModes location: row: 48 @@ -474,14 +445,13 @@ expression: checks row: 48 column: 31 fix: - patch: - content: "" - location: - row: 48 - column: 10 - end_location: - row: 48 - column: 20 + content: "" + location: + row: 48 + column: 10 + end_location: + row: 48 + column: 20 - kind: RedundantOpenModes location: row: 51 @@ -490,14 +460,13 @@ expression: checks row: 51 column: 22 fix: - patch: - content: "\"rb\"" - location: - row: 51 - column: 17 - end_location: - row: 51 - column: 21 + content: "\"rb\"" + location: + row: 51 + column: 17 + end_location: + row: 51 + column: 21 - kind: RedundantOpenModes location: row: 52 @@ -506,14 +475,13 @@ expression: checks row: 52 column: 27 fix: - patch: - content: "\"rb\"" - location: - row: 52 - column: 22 - end_location: - row: 52 - column: 26 + content: "\"rb\"" + location: + row: 52 + column: 22 + end_location: + row: 52 + column: 26 - kind: RedundantOpenModes location: row: 53 @@ -522,14 +490,13 @@ expression: checks row: 53 column: 27 fix: - patch: - content: "\"rb\"" - location: - row: 53 - column: 10 - end_location: - row: 53 - column: 14 + content: "\"rb\"" + location: + row: 53 + column: 10 + end_location: + row: 53 + column: 14 - kind: RedundantOpenModes location: row: 55 @@ -538,14 +505,13 @@ expression: checks row: 55 column: 27 fix: - patch: - content: "\"rb\"" - location: - row: 55 - column: 22 - end_location: - row: 55 - column: 26 + content: "\"rb\"" + location: + row: 55 + column: 22 + end_location: + row: 55 + column: 26 - kind: RedundantOpenModes location: row: 57 @@ -554,14 +520,13 @@ expression: checks row: 57 column: 32 fix: - patch: - content: "\"rb\"" - location: - row: 57 - column: 27 - end_location: - row: 57 - column: 31 + content: "\"rb\"" + location: + row: 57 + column: 27 + end_location: + row: 57 + column: 31 - kind: RedundantOpenModes location: row: 59 @@ -570,14 +535,13 @@ expression: checks row: 59 column: 32 fix: - patch: - content: "\"rb\"" - location: - row: 59 - column: 15 - end_location: - row: 59 - column: 19 + content: "\"rb\"" + location: + row: 59 + column: 15 + end_location: + row: 59 + column: 19 - kind: RedundantOpenModes location: row: 62 @@ -586,14 +550,13 @@ expression: checks row: 62 column: 110 fix: - patch: - content: "" - location: - row: 62 - column: 15 - end_location: - row: 62 - column: 25 + content: "" + location: + row: 62 + column: 15 + end_location: + row: 62 + column: 25 - kind: RedundantOpenModes location: row: 63 @@ -602,14 +565,13 @@ expression: checks row: 63 column: 110 fix: - patch: - content: "" - location: - row: 63 - column: 99 - end_location: - row: 63 - column: 109 + content: "" + location: + row: 63 + column: 99 + end_location: + row: 63 + column: 109 - kind: RedundantOpenModes location: row: 64 @@ -618,14 +580,13 @@ expression: checks row: 64 column: 110 fix: - patch: - content: "" - location: - row: 64 - column: 58 - end_location: - row: 64 - column: 68 + content: "" + location: + row: 64 + column: 58 + end_location: + row: 64 + column: 68 - kind: RedundantOpenModes location: row: 65 @@ -634,14 +595,13 @@ expression: checks row: 65 column: 110 fix: - patch: - content: "" - location: - row: 65 - column: 5 - end_location: - row: 65 - column: 15 + content: "" + location: + row: 65 + column: 5 + end_location: + row: 65 + column: 15 - kind: RedundantOpenModes location: row: 67 @@ -650,14 +610,13 @@ expression: checks row: 67 column: 111 fix: - patch: - content: "\"rb\"" - location: - row: 67 - column: 22 - end_location: - row: 67 - column: 26 + content: "\"rb\"" + location: + row: 67 + column: 22 + end_location: + row: 67 + column: 26 - kind: RedundantOpenModes location: row: 68 @@ -666,14 +625,13 @@ expression: checks row: 68 column: 111 fix: - patch: - content: "\"rb\"" - location: - row: 68 - column: 106 - end_location: - row: 68 - column: 110 + content: "\"rb\"" + location: + row: 68 + column: 106 + end_location: + row: 68 + column: 110 - kind: RedundantOpenModes location: row: 69 @@ -682,14 +640,13 @@ expression: checks row: 69 column: 111 fix: - patch: - content: "\"rb\"" - location: - row: 69 - column: 65 - end_location: - row: 69 - column: 69 + content: "\"rb\"" + location: + row: 69 + column: 65 + end_location: + row: 69 + column: 69 - kind: RedundantOpenModes location: row: 70 @@ -698,12 +655,11 @@ expression: checks row: 70 column: 111 fix: - patch: - content: "\"rb\"" - location: - row: 70 - column: 10 - end_location: - row: 70 - column: 14 + content: "\"rb\"" + location: + row: 70 + column: 10 + end_location: + row: 70 + column: 14 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_585_p37.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_585_p37.snap index b31f7b9656..d76158afeb 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_585_p37.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_585_p37.snap @@ -11,12 +11,11 @@ expression: checks row: 34 column: 21 fix: - patch: - content: list - location: - row: 34 - column: 17 - end_location: - row: 34 - column: 21 + content: list + location: + row: 34 + column: 17 + end_location: + row: 34 + column: 21 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_585_py310.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_585_py310.snap index 37319d2e07..d5daf180a9 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_585_py310.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_585_py310.snap @@ -11,14 +11,13 @@ expression: checks row: 34 column: 21 fix: - patch: - content: list - location: - row: 34 - column: 17 - end_location: - row: 34 - column: 21 + content: list + location: + row: 34 + column: 17 + end_location: + row: 34 + column: 21 - kind: UsePEP585Annotation: List location: @@ -28,12 +27,11 @@ expression: checks row: 35 column: 12 fix: - patch: - content: list - location: - row: 35 - column: 8 - end_location: - row: 35 - column: 12 + content: list + location: + row: 35 + column: 8 + end_location: + row: 35 + column: 12 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_604_p37.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_604_p37.snap index 34b8d8633d..33014759f5 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_604_p37.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_604_p37.snap @@ -10,12 +10,11 @@ expression: checks row: 40 column: 16 fix: - patch: - content: int | None - location: - row: 40 - column: 3 - end_location: - row: 40 - column: 16 + content: int | None + location: + row: 40 + column: 3 + end_location: + row: 40 + column: 16 diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_604_py310.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_604_py310.snap index 34b8d8633d..33014759f5 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_604_py310.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__future_annotations_pep_604_py310.snap @@ -10,12 +10,11 @@ expression: checks row: 40 column: 16 fix: - patch: - content: int | None - location: - row: 40 - column: 3 - end_location: - row: 40 - column: 16 + content: int | None + location: + row: 40 + column: 3 + end_location: + row: 40 + column: 16 diff --git a/src/rules/snapshots/ruff__rules__tests__RUF001_RUF001.py.snap b/src/rules/snapshots/ruff__rules__tests__RUF001_RUF001.py.snap index 03d283e884..2add753cb6 100644 --- a/src/rules/snapshots/ruff__rules__tests__RUF001_RUF001.py.snap +++ b/src/rules/snapshots/ruff__rules__tests__RUF001_RUF001.py.snap @@ -13,12 +13,11 @@ expression: checks row: 1 column: 6 fix: - patch: - content: B - location: - row: 1 - column: 5 - end_location: - row: 1 - column: 6 + content: B + location: + row: 1 + column: 5 + end_location: + row: 1 + column: 6 diff --git a/src/rules/snapshots/ruff__rules__tests__RUF002_RUF002.py.snap b/src/rules/snapshots/ruff__rules__tests__RUF002_RUF002.py.snap index dd63775bb4..6e5a57f1ed 100644 --- a/src/rules/snapshots/ruff__rules__tests__RUF002_RUF002.py.snap +++ b/src/rules/snapshots/ruff__rules__tests__RUF002_RUF002.py.snap @@ -13,12 +13,11 @@ expression: checks row: 5 column: 56 fix: - patch: - content: ) - location: - row: 5 - column: 55 - end_location: - row: 5 - column: 56 + content: ) + location: + row: 5 + column: 55 + end_location: + row: 5 + column: 56 diff --git a/src/rules/snapshots/ruff__rules__tests__RUF003_RUF003.py.snap b/src/rules/snapshots/ruff__rules__tests__RUF003_RUF003.py.snap index 6c588fb055..3dd26d6d3f 100644 --- a/src/rules/snapshots/ruff__rules__tests__RUF003_RUF003.py.snap +++ b/src/rules/snapshots/ruff__rules__tests__RUF003_RUF003.py.snap @@ -13,12 +13,11 @@ expression: checks row: 6 column: 62 fix: - patch: - content: / - location: - row: 6 - column: 61 - end_location: - row: 6 - column: 62 + content: / + location: + row: 6 + column: 61 + end_location: + row: 6 + column: 62 diff --git a/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_1.py.snap b/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_1.py.snap index 1d5659ecff..857b77734c 100644 --- a/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_1.py.snap +++ b/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_1.py.snap @@ -10,14 +10,13 @@ expression: checks row: 3 column: 4 fix: - patch: - content: sys.exit - location: - row: 3 - column: 0 - end_location: - row: 3 - column: 4 + content: sys.exit + location: + row: 3 + column: 0 + end_location: + row: 3 + column: 4 - kind: ConvertExitToSysExit location: row: 7 @@ -26,12 +25,11 @@ expression: checks row: 7 column: 8 fix: - patch: - content: sys.exit - location: - row: 7 - column: 4 - end_location: - row: 7 - column: 8 + content: sys.exit + location: + row: 7 + column: 4 + end_location: + row: 7 + column: 8 diff --git a/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_2.py.snap b/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_2.py.snap index 4acec7d793..3cf435fe80 100644 --- a/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_2.py.snap +++ b/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_2.py.snap @@ -10,14 +10,13 @@ expression: checks row: 3 column: 4 fix: - patch: - content: sys2.exit - location: - row: 3 - column: 0 - end_location: - row: 3 - column: 4 + content: sys2.exit + location: + row: 3 + column: 0 + end_location: + row: 3 + column: 4 - kind: ConvertExitToSysExit location: row: 7 @@ -26,12 +25,11 @@ expression: checks row: 7 column: 8 fix: - patch: - content: sys2.exit - location: - row: 7 - column: 4 - end_location: - row: 7 - column: 8 + content: sys2.exit + location: + row: 7 + column: 4 + end_location: + row: 7 + column: 8 diff --git a/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_4.py.snap b/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_4.py.snap index 6d22eaf9b7..2891261e34 100644 --- a/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_4.py.snap +++ b/src/rules/snapshots/ruff__rules__tests__RUF101_RUF101_4.py.snap @@ -10,14 +10,13 @@ expression: checks row: 3 column: 4 fix: - patch: - content: exit2 - location: - row: 3 - column: 0 - end_location: - row: 3 - column: 4 + content: exit2 + location: + row: 3 + column: 0 + end_location: + row: 3 + column: 4 - kind: ConvertExitToSysExit location: row: 7 @@ -26,12 +25,11 @@ expression: checks row: 7 column: 8 fix: - patch: - content: exit2 - location: - row: 7 - column: 4 - end_location: - row: 7 - column: 8 + content: exit2 + location: + row: 7 + column: 4 + end_location: + row: 7 + column: 8 diff --git a/src/rules/snapshots/ruff__rules__tests__m001.snap b/src/rules/snapshots/ruff__rules__tests__m001.snap index 06a8524131..eafcd7f320 100644 --- a/src/rules/snapshots/ruff__rules__tests__m001.snap +++ b/src/rules/snapshots/ruff__rules__tests__m001.snap @@ -11,14 +11,13 @@ expression: checks row: 9 column: 17 fix: - patch: - content: "" - location: - row: 9 - column: 9 - end_location: - row: 9 - column: 17 + content: "" + location: + row: 9 + column: 9 + end_location: + row: 9 + column: 17 - kind: UnusedNOQA: - E501 @@ -29,14 +28,13 @@ expression: checks row: 13 column: 23 fix: - patch: - content: "" - location: - row: 13 - column: 9 - end_location: - row: 13 - column: 23 + content: "" + location: + row: 13 + column: 9 + end_location: + row: 13 + column: 23 - kind: UnusedNOQA: - F841 @@ -48,14 +46,13 @@ expression: checks row: 16 column: 29 fix: - patch: - content: "" - location: - row: 16 - column: 9 - end_location: - row: 16 - column: 29 + content: "" + location: + row: 16 + column: 9 + end_location: + row: 16 + column: 29 - kind: UnusedNOQA: - F841 @@ -67,14 +64,13 @@ expression: checks row: 19 column: 29 fix: - patch: - content: "" - location: - row: 19 - column: 9 - end_location: - row: 19 - column: 29 + content: "" + location: + row: 19 + column: 9 + end_location: + row: 19 + column: 29 - kind: UnusedNOQA: - F841 @@ -86,14 +82,13 @@ expression: checks row: 22 column: 29 fix: - patch: - content: "" - location: - row: 22 - column: 9 - end_location: - row: 22 - column: 29 + content: "" + location: + row: 22 + column: 9 + end_location: + row: 22 + column: 29 - kind: UnusedNOQA: - E501 @@ -104,14 +99,13 @@ expression: checks row: 26 column: 21 fix: - patch: - content: "" - location: - row: 26 - column: 9 - end_location: - row: 26 - column: 21 + content: "" + location: + row: 26 + column: 9 + end_location: + row: 26 + column: 21 - kind: UnusedVariable: d location: @@ -131,14 +125,13 @@ expression: checks row: 29 column: 44 fix: - patch: - content: "" - location: - row: 29 - column: 9 - end_location: - row: 29 - column: 44 + content: "" + location: + row: 29 + column: 9 + end_location: + row: 29 + column: 44 - kind: UnusedNOQA: - F841 @@ -149,14 +142,13 @@ expression: checks row: 55 column: 23 fix: - patch: - content: "# noqa: E501" - location: - row: 55 - column: 5 - end_location: - row: 55 - column: 23 + content: "# noqa: E501" + location: + row: 55 + column: 5 + end_location: + row: 55 + column: 23 - kind: UnusedNOQA: - E501 @@ -167,14 +159,13 @@ expression: checks row: 63 column: 17 fix: - patch: - content: "" - location: - row: 63 - column: 3 - end_location: - row: 63 - column: 17 + content: "" + location: + row: 63 + column: 3 + end_location: + row: 63 + column: 17 - kind: UnusedNOQA: ~ location: @@ -184,12 +175,11 @@ expression: checks row: 71 column: 11 fix: - patch: - content: "" - location: - row: 71 - column: 3 - end_location: - row: 71 - column: 11 + content: "" + location: + row: 71 + column: 3 + end_location: + row: 71 + column: 11