mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:26 +00:00
[flake8-pyi
] Make example error out-of-the-box (PYI059
) (#19080)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
93413d3631
commit
37ba185c04
1 changed files with 24 additions and 4 deletions
|
@ -21,27 +21,47 @@ use crate::{Fix, FixAvailability, Violation};
|
|||
///
|
||||
/// For example:
|
||||
/// ```python
|
||||
/// from collections.abc import Container, Iterable, Sized
|
||||
/// from typing import Generic, TypeVar
|
||||
///
|
||||
///
|
||||
/// T = TypeVar("T")
|
||||
/// K = TypeVar("K")
|
||||
/// V = TypeVar("V")
|
||||
///
|
||||
///
|
||||
/// class LinkedList(Generic[T], Sized):
|
||||
/// def push(self, item: T) -> None:
|
||||
/// self._items.append(item)
|
||||
///
|
||||
///
|
||||
/// class MyMapping(
|
||||
/// Generic[K, V],
|
||||
/// Iterable[Tuple[K, V]],
|
||||
/// Container[Tuple[K, V]],
|
||||
/// Iterable[tuple[K, V]],
|
||||
/// Container[tuple[K, V]],
|
||||
/// ):
|
||||
/// ...
|
||||
/// ```
|
||||
///
|
||||
/// Use instead:
|
||||
/// ```python
|
||||
/// from collections.abc import Container, Iterable, Sized
|
||||
/// from typing import Generic, TypeVar
|
||||
///
|
||||
///
|
||||
/// T = TypeVar("T")
|
||||
/// K = TypeVar("K")
|
||||
/// V = TypeVar("V")
|
||||
///
|
||||
///
|
||||
/// class LinkedList(Sized, Generic[T]):
|
||||
/// def push(self, item: T) -> None:
|
||||
/// self._items.append(item)
|
||||
///
|
||||
///
|
||||
/// class MyMapping(
|
||||
/// Iterable[Tuple[K, V]],
|
||||
/// Container[Tuple[K, V]],
|
||||
/// Iterable[tuple[K, V]],
|
||||
/// Container[tuple[K, V]],
|
||||
/// Generic[K, V],
|
||||
/// ):
|
||||
/// ...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue