-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move rule to pyupgrade, test based on Python version
- Loading branch information
Showing
12 changed files
with
110 additions
and
19 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...ff/resources/test/fixtures/ruff/RUF017.py → ...esources/test/fixtures/pyupgrade/UP100.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
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
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
4 changes: 4 additions & 0 deletions
4
...ade/snapshots/ruff__rules__pyupgrade__tests__non_pep695_type_alias_not_applied_py311.snap
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
source: crates/ruff/src/rules/pyupgrade/mod.rs | ||
--- | ||
|
61 changes: 61 additions & 0 deletions
61
...rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__non_pep695_type_alias_py312.snap
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
source: crates/ruff/src/rules/pyupgrade/mod.rs | ||
--- | ||
UP100.py:5:1: UP100 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | ||
| | ||
4 | # UP100 | ||
5 | x: typing.TypeAlias = int | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ UP100 | ||
6 | x: TypeAlias = int | ||
| | ||
= help: Replace with the `type` keyword | ||
|
||
ℹ Fix | ||
2 2 | from typing import TypeAlias | ||
3 3 | | ||
4 4 | # UP100 | ||
5 |-x: typing.TypeAlias = int | ||
5 |+type x = int | ||
6 6 | x: TypeAlias = int | ||
7 7 | | ||
8 8 | | ||
|
||
UP100.py:6:1: UP100 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | ||
| | ||
4 | # UP100 | ||
5 | x: typing.TypeAlias = int | ||
6 | x: TypeAlias = int | ||
| ^^^^^^^^^^^^^^^^^^ UP100 | ||
| | ||
= help: Replace with the `type` keyword | ||
ℹ Fix | ||
3 3 | | ||
4 4 | # UP100 | ||
5 5 | x: typing.TypeAlias = int | ||
6 |-x: TypeAlias = int | ||
6 |+type x = int | ||
7 7 | | ||
8 8 | | ||
9 9 | # UP100 with generics (todo) | ||
UP100.py:11:1: UP100 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | ||
| | ||
9 | # UP100 with generics (todo) | ||
10 | T = typing.TypeVar["T"] | ||
11 | x: typing.TypeAlias = list[T] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP100 | ||
| | ||
= help: Replace with the `type` keyword | ||
ℹ Fix | ||
8 8 | | ||
9 9 | # UP100 with generics (todo) | ||
10 10 | T = typing.TypeVar["T"] | ||
11 |-x: typing.TypeAlias = list[T] | ||
11 |+type x = list[T] | ||
12 12 | | ||
13 13 | | ||
14 14 | # OK | ||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.