Skip to content

Commit 37ba185

Browse files
[flake8-pyi] Make example error out-of-the-box (PYI059) (astral-sh#19080)
Co-authored-by: Alex Waygood <[email protected]>
1 parent 93413d3 commit 37ba185

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

crates/ruff_linter/src/rules/flake8_pyi/rules/generic_not_last_base_class.rs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,47 @@ use crate::{Fix, FixAvailability, Violation};
2121
///
2222
/// For example:
2323
/// ```python
24+
/// from collections.abc import Container, Iterable, Sized
25+
/// from typing import Generic, TypeVar
26+
///
27+
///
28+
/// T = TypeVar("T")
29+
/// K = TypeVar("K")
30+
/// V = TypeVar("V")
31+
///
32+
///
2433
/// class LinkedList(Generic[T], Sized):
2534
/// def push(self, item: T) -> None:
2635
/// self._items.append(item)
2736
///
37+
///
2838
/// class MyMapping(
2939
/// Generic[K, V],
30-
/// Iterable[Tuple[K, V]],
31-
/// Container[Tuple[K, V]],
40+
/// Iterable[tuple[K, V]],
41+
/// Container[tuple[K, V]],
3242
/// ):
3343
/// ...
3444
/// ```
3545
///
3646
/// Use instead:
3747
/// ```python
48+
/// from collections.abc import Container, Iterable, Sized
49+
/// from typing import Generic, TypeVar
50+
///
51+
///
52+
/// T = TypeVar("T")
53+
/// K = TypeVar("K")
54+
/// V = TypeVar("V")
55+
///
56+
///
3857
/// class LinkedList(Sized, Generic[T]):
3958
/// def push(self, item: T) -> None:
4059
/// self._items.append(item)
4160
///
61+
///
4262
/// class MyMapping(
43-
/// Iterable[Tuple[K, V]],
44-
/// Container[Tuple[K, V]],
63+
/// Iterable[tuple[K, V]],
64+
/// Container[tuple[K, V]],
4565
/// Generic[K, V],
4666
/// ):
4767
/// ...

0 commit comments

Comments
 (0)