Update W605 to check in f-strings#7329
Merged
dhruvmanila merged 2 commits intodhruv/pep-701from Sep 19, 2023
Merged
Conversation
This was referenced Sep 13, 2023
Member
Author
13b6442 to
6af8fb4
Compare
ac7c897 to
16e1e56
Compare
6af8fb4 to
4a0ad8c
Compare
16e1e56 to
b6144d0
Compare
4a0ad8c to
4d05889
Compare
3b1328f to
a0496ef
Compare
b00eb68 to
59bebae
Compare
59bebae to
7142a7b
Compare
cc91933 to
a43448c
Compare
7142a7b to
b24fc31
Compare
CodSpeed Performance ReportMerging #7329 will improve performances by 2.38%Falling back to comparing Summary
Benchmarks breakdown
|
MichaReiser
approved these changes
Sep 18, 2023
a43448c to
c98c9c4
Compare
b24fc31 to
0e6a5c9
Compare
0e6a5c9 to
b88d5a0
Compare
dhruvmanila
added a commit
that referenced
this pull request
Sep 20, 2023
This PR updates the `W605` (invalid-escape-sequence) to check inside
f-strings. It also adds support to report violation on invalid escape
sequence within f-strings w.r.t. the curly braces. So, the following
cases will be identified:
```python
f"\{1}"
f"\{{1}}"
f"{1:\}"
```
The new CPython parser also gives out a syntax warning for such cases:
```
fstring.py:1: SyntaxWarning: invalid escape sequence '\{'
f"\{1}"
fstring.py:2: SyntaxWarning: invalid escape sequence '\{'
f"\{{1}}"
fstring.py:3: SyntaxWarning: invalid escape sequence '\}'
f"{1:\}"
```
Nested f-strings are supported here, so the generated fix is aware of that
and will create an edit for the proper f-string.
Add new test cases for f-strings.
fixes: #7295
dhruvmanila
added a commit
that referenced
this pull request
Sep 21, 2023
This PR updates the `W605` (invalid-escape-sequence) to check inside
f-strings. It also adds support to report violation on invalid escape
sequence within f-strings w.r.t. the curly braces. So, the following
cases will be identified:
```python
f"\{1}"
f"\{{1}}"
f"{1:\}"
```
The new CPython parser also gives out a syntax warning for such cases:
```
fstring.py:1: SyntaxWarning: invalid escape sequence '\{'
f"\{1}"
fstring.py:2: SyntaxWarning: invalid escape sequence '\{'
f"\{{1}}"
fstring.py:3: SyntaxWarning: invalid escape sequence '\}'
f"{1:\}"
```
Nested f-strings are supported here, so the generated fix is aware of that
and will create an edit for the proper f-string.
Add new test cases for f-strings.
fixes: #7295
dhruvmanila
added a commit
that referenced
this pull request
Sep 22, 2023
This PR updates the `W605` (invalid-escape-sequence) to check inside
f-strings. It also adds support to report violation on invalid escape
sequence within f-strings w.r.t. the curly braces. So, the following
cases will be identified:
```python
f"\{1}"
f"\{{1}}"
f"{1:\}"
```
The new CPython parser also gives out a syntax warning for such cases:
```
fstring.py:1: SyntaxWarning: invalid escape sequence '\{'
f"\{1}"
fstring.py:2: SyntaxWarning: invalid escape sequence '\{'
f"\{{1}}"
fstring.py:3: SyntaxWarning: invalid escape sequence '\}'
f"{1:\}"
```
Nested f-strings are supported here, so the generated fix is aware of that
and will create an edit for the proper f-string.
Add new test cases for f-strings.
fixes: #7295
dhruvmanila
added a commit
that referenced
this pull request
Sep 22, 2023
This PR updates the `W605` (invalid-escape-sequence) to check inside
f-strings. It also adds support to report violation on invalid escape
sequence within f-strings w.r.t. the curly braces. So, the following
cases will be identified:
```python
f"\{1}"
f"\{{1}}"
f"{1:\}"
```
The new CPython parser also gives out a syntax warning for such cases:
```
fstring.py:1: SyntaxWarning: invalid escape sequence '\{'
f"\{1}"
fstring.py:2: SyntaxWarning: invalid escape sequence '\{'
f"\{{1}}"
fstring.py:3: SyntaxWarning: invalid escape sequence '\}'
f"{1:\}"
```
Nested f-strings are supported here, so the generated fix is aware of that
and will create an edit for the proper f-string.
Add new test cases for f-strings.
fixes: #7295
This was referenced Sep 22, 2023
dhruvmanila
added a commit
that referenced
this pull request
Sep 22, 2023
This PR updates the `W605` (invalid-escape-sequence) to check inside
f-strings. It also adds support to report violation on invalid escape
sequence within f-strings w.r.t. the curly braces. So, the following
cases will be identified:
```python
f"\{1}"
f"\{{1}}"
f"{1:\}"
```
The new CPython parser also gives out a syntax warning for such cases:
```
fstring.py:1: SyntaxWarning: invalid escape sequence '\{'
f"\{1}"
fstring.py:2: SyntaxWarning: invalid escape sequence '\{'
f"\{{1}}"
fstring.py:3: SyntaxWarning: invalid escape sequence '\}'
f"{1:\}"
```
Nested f-strings are supported here, so the generated fix is aware of that
and will create an edit for the proper f-string.
Add new test cases for f-strings.
fixes: #7295
dhruvmanila
added a commit
that referenced
this pull request
Sep 26, 2023
This PR updates the `W605` (invalid-escape-sequence) to check inside
f-strings. It also adds support to report violation on invalid escape
sequence within f-strings w.r.t. the curly braces. So, the following
cases will be identified:
```python
f"\{1}"
f"\{{1}}"
f"{1:\}"
```
The new CPython parser also gives out a syntax warning for such cases:
```
fstring.py:1: SyntaxWarning: invalid escape sequence '\{'
f"\{1}"
fstring.py:2: SyntaxWarning: invalid escape sequence '\{'
f"\{{1}}"
fstring.py:3: SyntaxWarning: invalid escape sequence '\}'
f"{1:\}"
```
Nested f-strings are supported here, so the generated fix is aware of that
and will create an edit for the proper f-string.
Add new test cases for f-strings.
fixes: #7295
dhruvmanila
added a commit
that referenced
this pull request
Sep 27, 2023
This PR updates the `W605` (invalid-escape-sequence) to check inside
f-strings. It also adds support to report violation on invalid escape
sequence within f-strings w.r.t. the curly braces. So, the following
cases will be identified:
```python
f"\{1}"
f"\{{1}}"
f"{1:\}"
```
The new CPython parser also gives out a syntax warning for such cases:
```
fstring.py:1: SyntaxWarning: invalid escape sequence '\{'
f"\{1}"
fstring.py:2: SyntaxWarning: invalid escape sequence '\{'
f"\{{1}}"
fstring.py:3: SyntaxWarning: invalid escape sequence '\}'
f"{1:\}"
```
Nested f-strings are supported here, so the generated fix is aware of that
and will create an edit for the proper f-string.
Add new test cases for f-strings.
fixes: #7295
dhruvmanila
added a commit
that referenced
this pull request
Sep 28, 2023
This PR updates the `W605` (invalid-escape-sequence) to check inside
f-strings. It also adds support to report violation on invalid escape
sequence within f-strings w.r.t. the curly braces. So, the following
cases will be identified:
```python
f"\{1}"
f"\{{1}}"
f"{1:\}"
```
The new CPython parser also gives out a syntax warning for such cases:
```
fstring.py:1: SyntaxWarning: invalid escape sequence '\{'
f"\{1}"
fstring.py:2: SyntaxWarning: invalid escape sequence '\{'
f"\{{1}}"
fstring.py:3: SyntaxWarning: invalid escape sequence '\}'
f"{1:\}"
```
Nested f-strings are supported here, so the generated fix is aware of that
and will create an edit for the proper f-string.
Add new test cases for f-strings.
fixes: #7295
dhruvmanila
added a commit
that referenced
this pull request
Sep 29, 2023
This PR updates the `W605` (invalid-escape-sequence) to check inside
f-strings. It also adds support to report violation on invalid escape
sequence within f-strings w.r.t. the curly braces. So, the following
cases will be identified:
```python
f"\{1}"
f"\{{1}}"
f"{1:\}"
```
The new CPython parser also gives out a syntax warning for such cases:
```
fstring.py:1: SyntaxWarning: invalid escape sequence '\{'
f"\{1}"
fstring.py:2: SyntaxWarning: invalid escape sequence '\{'
f"\{{1}}"
fstring.py:3: SyntaxWarning: invalid escape sequence '\}'
f"{1:\}"
```
Nested f-strings are supported here, so the generated fix is aware of that
and will create an edit for the proper f-string.
Add new test cases for f-strings.
fixes: #7295
dhruvmanila
added a commit
that referenced
this pull request
Sep 29, 2023
This PR updates the `W605` (invalid-escape-sequence) to check inside
f-strings. It also adds support to report violation on invalid escape
sequence within f-strings w.r.t. the curly braces. So, the following
cases will be identified:
```python
f"\{1}"
f"\{{1}}"
f"{1:\}"
```
The new CPython parser also gives out a syntax warning for such cases:
```
fstring.py:1: SyntaxWarning: invalid escape sequence '\{'
f"\{1}"
fstring.py:2: SyntaxWarning: invalid escape sequence '\{'
f"\{{1}}"
fstring.py:3: SyntaxWarning: invalid escape sequence '\}'
f"{1:\}"
```
Nested f-strings are supported here, so the generated fix is aware of that
and will create an edit for the proper f-string.
Add new test cases for f-strings.
fixes: #7295
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This PR updates the
W605(invalid-escape-sequence) to check inside f-strings. It also adds support to report violation on invalid escape sequence within f-strings w.r.t. the curly braces. So, the following cases will be identified:The new CPython parser also gives out a syntax warning for such cases:
Nested f-strings are supported here, so the generated fix is aware of that and will create an edit for the proper f-string.
Test Plan
Add new test cases for f-strings.
fixes: #7295