[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:
@@ -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],
|
||||
/// ):
|
||||
/// ...
|
||||
|
||||
Reference in New Issue
Block a user