-
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.
- Loading branch information
1 parent
784eb52
commit 98e1a85
Showing
158 changed files
with
4,137 additions
and
3,853 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
doc-valid-idents = [ | ||
"StackOverflow", | ||
"..", | ||
"CodeQL", | ||
"FastAPI", | ||
"IPython", | ||
"NumPy", | ||
"LangChain", | ||
"LibCST", | ||
"McCabe", | ||
"NumPy", | ||
"SCREAMING_SNAKE_CASE", | ||
"SQLAlchemy", | ||
"McCabe", | ||
"FastAPI", | ||
"..", | ||
"StackOverflow", | ||
] |
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
54 changes: 54 additions & 0 deletions
54
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI059.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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from typing import Container, Generic, Iterable, List, Sized, Tuple, TypeVar | ||
import typing as t | ||
|
||
T = TypeVar('T') | ||
K = TypeVar('K') | ||
V = TypeVar('V') | ||
|
||
class LinkedList(Generic[T], Sized): # PYI059 | ||
def __init__(self) -> None: | ||
self._items: List[T] = [] | ||
|
||
def push(self, item: T) -> None: | ||
self._items.append(item) | ||
|
||
class MyMapping( # PYI059 | ||
t.Generic[K, V], | ||
Iterable[Tuple[K, V]], | ||
Container[Tuple[K, V]], | ||
): | ||
... | ||
|
||
|
||
# Inheriting from just `Generic` is a TypeError, but it's probably fine | ||
# to flag this issue in this case as well, since after fixing the error | ||
# the Generic's position issue persists. | ||
class Foo(Generic, LinkedList): # PYI059 | ||
pass | ||
|
||
|
||
class Foo( # comment about the bracket | ||
# Part 1 of multiline comment 1 | ||
# Part 2 of multiline comment 1 | ||
Generic[T] # comment about Generic[T] # PYI059 | ||
# another comment? | ||
, # comment about the comma? | ||
# part 1 of multiline comment 2 | ||
# part 2 of multiline comment 2 | ||
int, # comment about int | ||
# yet another comment? | ||
): # and another one for good measure | ||
... | ||
|
||
|
||
# in case of multiple Generic[] inheritance, don't fix it. | ||
class C(Generic[T], Generic[K, V]): ... # PYI059 | ||
|
||
|
||
# Negative cases | ||
class MyList(Sized, Generic[T]): # Generic already in last place | ||
def __init__(self) -> None: | ||
self._items: List[T] = [] | ||
|
||
class SomeGeneric(Generic[T]): # Only one generic | ||
pass |
48 changes: 48 additions & 0 deletions
48
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI059.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,48 @@ | ||
from typing import Container, Generic, Iterable, Sized, Tuple, TypeVar | ||
import typing as t | ||
|
||
T = TypeVar('T') | ||
K = TypeVar('K') | ||
V = TypeVar('V') | ||
|
||
class LinkedList(Generic[T], Sized): # PYI059 | ||
def __init__(self) -> None: ... | ||
def push(self, item: T) -> None: ... | ||
|
||
class MyMapping( # PYI059 | ||
t.Generic[K, V], | ||
Iterable[Tuple[K, V]], | ||
Container[Tuple[K, V]], | ||
): | ||
... | ||
|
||
# Inheriting from just `Generic` is a TypeError, but it's probably fine | ||
# to flag this issue in this case as well, since after fixing the error | ||
# the Generic's position issue persists. | ||
class Foo(Generic, LinkedList): ... # PYI059 | ||
|
||
|
||
class Foo( # comment about the bracket | ||
# Part 1 of multiline comment 1 | ||
# Part 2 of multiline comment 1 | ||
Generic[T] # comment about Generic[T] # PYI059 | ||
# another comment? | ||
, # comment about the comma? | ||
# part 1 of multiline comment 2 | ||
# part 2 of multiline comment 2 | ||
int, # comment about int | ||
# yet another comment? | ||
): # and another one for good measure | ||
... | ||
|
||
|
||
# in case of multiple Generic[] inheritance, don't fix it. | ||
class C(Generic[T], Generic[K, V]): ... # PYI059 | ||
|
||
|
||
# Negative cases | ||
class MyList(Sized, Generic[T]): # Generic already in last place | ||
def __init__(self) -> None: ... | ||
|
||
class SomeGeneric(Generic[T]): # Only one generic | ||
... |
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.