-
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.
Update
non-pep695-type-alias
to require --unsafe-fixes
outside of…
- Loading branch information
Showing
5 changed files
with
69 additions
and
13 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
crates/ruff_linter/resources/test/fixtures/pyupgrade/UP040.pyi
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,7 @@ | ||
import typing | ||
from typing import TypeAlias | ||
|
||
# UP040 | ||
# Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change | ||
x: typing.TypeAlias = int | ||
x: TypeAlias = int |
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
38 changes: 38 additions & 0 deletions
38
...linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.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,38 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs | ||
--- | ||
UP040.pyi:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | ||
| | ||
4 | # UP040 | ||
5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change | ||
6 | x: typing.TypeAlias = int | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ UP040 | ||
7 | x: TypeAlias = int | ||
| | ||
= help: Use the `type` keyword | ||
ℹ Fix | ||
3 3 | | ||
4 4 | # UP040 | ||
5 5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change | ||
6 |-x: typing.TypeAlias = int | ||
6 |+type x = int | ||
7 7 | x: TypeAlias = int | ||
UP040.pyi:7:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | ||
| | ||
5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change | ||
6 | x: typing.TypeAlias = int | ||
7 | x: TypeAlias = int | ||
| ^^^^^^^^^^^^^^^^^^ UP040 | ||
| | ||
= help: Use the `type` keyword | ||
ℹ Fix | ||
4 4 | # UP040 | ||
5 5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change | ||
6 6 | x: typing.TypeAlias = int | ||
7 |-x: TypeAlias = int | ||
7 |+type x = int | ||