---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI059 [*] `Generic[]` should always be the last base class
  --> PYI059.pyi:8:17
   |
 6 | V = TypeVar('V')
 7 |
 8 | class LinkedList(Generic[T], Sized):  # PYI059
   |                 ^^^^^^^^^^^^^^^^^^^
 9 |     def __init__(self) -> None: ...
10 |     def push(self, item: T) -> None: ...
   |
help: Move `Generic[]` to the end
  |
7 |
  - class LinkedList(Generic[T], Sized):  # PYI059
8 + class LinkedList(Sized, Generic[T]):  # PYI059
9 |     def __init__(self) -> None: ...
  |
note: This is an unsafe fix and may change runtime behavior

PYI059 [*] `Generic[]` should always be the last base class
  --> PYI059.pyi:12:16
   |
10 |       def push(self, item: T) -> None: ...
11 |
12 |   class MyMapping(  # PYI059
   |  ________________^
13 | |     t.Generic[K, V],
14 | |     Iterable[Tuple[K, V]],
15 | |     Container[Tuple[K, V]],
16 | | ):
   | |_^
17 |       ...
   |
help: Move `Generic[]` to the end
   |
12 | class MyMapping(  # PYI059
   -     t.Generic[K, V],
13 |     Iterable[Tuple[K, V]],
   -     Container[Tuple[K, V]],
14 +     Container[Tuple[K, V]], t.Generic[K, V],
15 | ):
   |
note: This is an unsafe fix and may change runtime behavior

PYI059 [*] `Generic[]` should always be the last base class
  --> PYI059.pyi:22:10
   |
20 | # to flag this issue in this case as well, since after fixing the error
21 | # the Generic's position issue persists.
22 | class Foo(Generic, LinkedList): ...  # PYI059
   |          ^^^^^^^^^^^^^^^^^^^^^
   |
help: Move `Generic[]` to the end
   |
21 | # the Generic's position issue persists.
   - class Foo(Generic, LinkedList): ...  # PYI059
22 + class Foo(LinkedList, Generic): ...  # PYI059
23 |
   |
note: This is an unsafe fix and may change runtime behavior

PYI059 [*] `Generic[]` should always be the last base class
  --> PYI059.pyi:25:10
   |
25 |   class Foo(  # comment about the bracket
   |  __________^
26 | |     # Part 1 of multiline comment 1
27 | |     # Part 2 of multiline comment 1
28 | |     Generic[T]  # comment about Generic[T]  # PYI059
29 | |     # another comment?
30 | |     ,  # comment about the comma?
31 | |     # part 1 of multiline comment 2
32 | |     # part 2 of multiline comment 2
33 | |     int,  # comment about int
34 | |     # yet another comment?
35 | | ):  # and another one for good measure
   | |_^
36 |       ...
   |
help: Move `Generic[]` to the end
   |
27 |     # Part 2 of multiline comment 1
   -     Generic[T]  # comment about Generic[T]  # PYI059
   -     # another comment?
   -     ,  # comment about the comma?
28 +     # comment about the comma?
29 |     # part 1 of multiline comment 2
30 |     # part 2 of multiline comment 2
   -     int,  # comment about int
31 +     int, Generic[T],  # comment about int
32 |     # yet another comment?
   |
note: This is an unsafe fix and may change runtime behavior

PYI059 `Generic[]` should always be the last base class
  --> PYI059.pyi:40:8
   |
39 | # in case of multiple Generic[] inheritance, don't fix it.
40 | class C(Generic[T], Generic[K, V]): ...  # PYI059
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Move `Generic[]` to the end
