Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Applicability to pyflakes #5253

Merged
merged 2 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ fn fix_f_string_missing_placeholders(
checker: &mut Checker,
) -> Fix {
let content = &checker.locator.contents()[TextRange::new(prefix_range.end(), tok_range.end())];
#[allow(deprecated)]
Fix::unspecified(Edit::replacement(
Fix::automatic(Edit::replacement(
unescape_f_string(content),
prefix_range.start(),
tok_range.end(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ F541.py:6:5: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
3 3 | b = f"ghi{'jkl'}"
4 4 |
5 5 | # Errors
Expand All @@ -32,7 +32,7 @@ F541.py:7:5: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
4 4 |
5 5 | # Errors
6 6 | c = f"def"
Expand All @@ -53,7 +53,7 @@ F541.py:9:5: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
6 6 | c = f"def"
7 7 | d = f"def" + "ghi"
8 8 | e = (
Expand All @@ -74,7 +74,7 @@ F541.py:13:5: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
10 10 | "ghi"
11 11 | )
12 12 | f = (
Expand All @@ -95,7 +95,7 @@ F541.py:14:5: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
11 11 | )
12 12 | f = (
13 13 | f"a"
Expand All @@ -116,7 +116,7 @@ F541.py:16:5: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
13 13 | f"a"
14 14 | F"b"
15 15 | "c"
Expand All @@ -137,7 +137,7 @@ F541.py:17:5: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
14 14 | F"b"
15 15 | "c"
16 16 | rf"d"
Expand All @@ -158,7 +158,7 @@ F541.py:19:5: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
16 16 | rf"d"
17 17 | fr"e"
18 18 | )
Expand All @@ -178,7 +178,7 @@ F541.py:25:13: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
22 22 | g = f"ghi{123:{45}}"
23 23 |
24 24 | # Error
Expand All @@ -198,7 +198,7 @@ F541.py:34:7: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
31 31 | f"{f'{v:0.2f}'}"
32 32 |
33 33 | # Errors
Expand All @@ -219,7 +219,7 @@ F541.py:35:4: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
32 32 |
33 33 | # Errors
34 34 | f"{v:{f'0.2f'}}"
Expand All @@ -240,7 +240,7 @@ F541.py:36:1: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
33 33 | # Errors
34 34 | f"{v:{f'0.2f'}}"
35 35 | f"{f''}"
Expand All @@ -261,7 +261,7 @@ F541.py:37:1: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
34 34 | f"{v:{f'0.2f'}}"
35 35 | f"{f''}"
36 36 | f"{{test}}"
Expand All @@ -281,7 +281,7 @@ F541.py:38:1: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
35 35 | f"{f''}"
36 36 | f"{{test}}"
37 37 | f'{{ 40 }}'
Expand All @@ -302,7 +302,7 @@ F541.py:39:1: F541 [*] f-string without any placeholders
|
= help: Remove extraneous `f` prefix

Suggested fix
Fix
36 36 | f"{{test}}"
37 37 | f'{{ 40 }}'
38 38 | f"{{a {{x}}"
Expand Down