-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
945e923
commit 5a256f4
Showing
25 changed files
with
1,382 additions
and
209 deletions.
There are no files selected for viewing
25 changes: 16 additions & 9 deletions
25
crates/ruff/resources/test/fixtures/flake8_comprehensions/C401.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
x = set(x for x in range(3)) | ||
x = set( | ||
x for x in range(3) | ||
) | ||
y = f'{set(a if a < 6 else 0 for a in range(3))}' | ||
_ = '{}'.format(set(a if a < 6 else 0 for a in range(3))) | ||
print(f'Hello {set(a for a in range(3))} World') | ||
x = set(x for x in range(3)) | ||
y = f"{set(a if a < 6 else 0 for a in range(3))}" | ||
_ = "{}".format(set(a if a < 6 else 0 for a in range(3))) | ||
print(f"Hello {set(a for a in range(3))} World") | ||
|
||
|
||
def f(x): | ||
return x | ||
|
||
def set(*args, **kwargs): | ||
return None | ||
|
||
print(f'Hello {set(a for a in "abc")} World') | ||
print(f"Hello {set(a for a in 'abc')} World") | ||
print(f"Hello {set(f(a) for a in 'abc')} World") | ||
print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") | ||
print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") | ||
|
||
set(x for x in range(3)) | ||
# The fix generated for this diagnostic is incorrect, as we add additional space | ||
# around the set comprehension. | ||
print(f"{ {set(a for a in 'abc')} }") |
This file contains 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
This file contains 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
11 changes: 11 additions & 0 deletions
11
crates/ruff/resources/test/fixtures/flake8_comprehensions/C404.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
dict([(i, i) for i in range(3)]) | ||
dict([(i, i) for i in range(3)], z=4) | ||
|
||
def f(x): | ||
return x | ||
|
||
f'{dict([(s,s) for s in "ab"])}' | ||
f"{dict([(s,s) for s in 'ab'])}" | ||
f"{dict([(s, s) for s in 'ab'])}" | ||
f"{dict([(s,f(s)) for s in 'ab'])}" | ||
|
||
f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' | ||
f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.