Add Applicability to pyflakes (#5253)

This commit is contained in:
Evan Rittenhouse 2023-06-21 12:04:55 -05:00 committed by GitHub
parent 0aa21277c6
commit 41ef17b007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 17 deletions

View File

@ -89,8 +89,7 @@ fn fix_f_string_missing_placeholders(
checker: &mut Checker, checker: &mut Checker,
) -> Fix { ) -> Fix {
let content = &checker.locator.contents()[TextRange::new(prefix_range.end(), tok_range.end())]; let content = &checker.locator.contents()[TextRange::new(prefix_range.end(), tok_range.end())];
#[allow(deprecated)] Fix::automatic(Edit::replacement(
Fix::unspecified(Edit::replacement(
unescape_f_string(content), unescape_f_string(content),
prefix_range.start(), prefix_range.start(),
tok_range.end(), tok_range.end(),

View File

@ -11,7 +11,7 @@ F541.py:6:5: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
3 3 | b = f"ghi{'jkl'}" 3 3 | b = f"ghi{'jkl'}"
4 4 | 4 4 |
5 5 | # Errors 5 5 | # Errors
@ -32,7 +32,7 @@ F541.py:7:5: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
4 4 | 4 4 |
5 5 | # Errors 5 5 | # Errors
6 6 | c = f"def" 6 6 | c = f"def"
@ -53,7 +53,7 @@ F541.py:9:5: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
6 6 | c = f"def" 6 6 | c = f"def"
7 7 | d = f"def" + "ghi" 7 7 | d = f"def" + "ghi"
8 8 | e = ( 8 8 | e = (
@ -74,7 +74,7 @@ F541.py:13:5: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
10 10 | "ghi" 10 10 | "ghi"
11 11 | ) 11 11 | )
12 12 | f = ( 12 12 | f = (
@ -95,7 +95,7 @@ F541.py:14:5: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
11 11 | ) 11 11 | )
12 12 | f = ( 12 12 | f = (
13 13 | f"a" 13 13 | f"a"
@ -116,7 +116,7 @@ F541.py:16:5: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
13 13 | f"a" 13 13 | f"a"
14 14 | F"b" 14 14 | F"b"
15 15 | "c" 15 15 | "c"
@ -137,7 +137,7 @@ F541.py:17:5: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
14 14 | F"b" 14 14 | F"b"
15 15 | "c" 15 15 | "c"
16 16 | rf"d" 16 16 | rf"d"
@ -158,7 +158,7 @@ F541.py:19:5: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
16 16 | rf"d" 16 16 | rf"d"
17 17 | fr"e" 17 17 | fr"e"
18 18 | ) 18 18 | )
@ -178,7 +178,7 @@ F541.py:25:13: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
22 22 | g = f"ghi{123:{45}}" 22 22 | g = f"ghi{123:{45}}"
23 23 | 23 23 |
24 24 | # Error 24 24 | # Error
@ -198,7 +198,7 @@ F541.py:34:7: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
31 31 | f"{f'{v:0.2f}'}" 31 31 | f"{f'{v:0.2f}'}"
32 32 | 32 32 |
33 33 | # Errors 33 33 | # Errors
@ -219,7 +219,7 @@ F541.py:35:4: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
32 32 | 32 32 |
33 33 | # Errors 33 33 | # Errors
34 34 | f"{v:{f'0.2f'}}" 34 34 | f"{v:{f'0.2f'}}"
@ -240,7 +240,7 @@ F541.py:36:1: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
33 33 | # Errors 33 33 | # Errors
34 34 | f"{v:{f'0.2f'}}" 34 34 | f"{v:{f'0.2f'}}"
35 35 | f"{f''}" 35 35 | f"{f''}"
@ -261,7 +261,7 @@ F541.py:37:1: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
34 34 | f"{v:{f'0.2f'}}" 34 34 | f"{v:{f'0.2f'}}"
35 35 | f"{f''}" 35 35 | f"{f''}"
36 36 | f"{{test}}" 36 36 | f"{{test}}"
@ -281,7 +281,7 @@ F541.py:38:1: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
35 35 | f"{f''}" 35 35 | f"{f''}"
36 36 | f"{{test}}" 36 36 | f"{{test}}"
37 37 | f'{{ 40 }}' 37 37 | f'{{ 40 }}'
@ -302,7 +302,7 @@ F541.py:39:1: F541 [*] f-string without any placeholders
| |
= help: Remove extraneous `f` prefix = help: Remove extraneous `f` prefix
Suggested fix Fix
36 36 | f"{{test}}" 36 36 | f"{{test}}"
37 37 | f'{{ 40 }}' 37 37 | f'{{ 40 }}'
38 38 | f"{{a {{x}}" 38 38 | f"{{a {{x}}"