Make TC010 docs example more realistic (#19356)

This commit is contained in:
Alex Waygood 2025-07-15 13:52:21 +01:00 committed by GitHub
parent e9b0c33703
commit 7b8161e80d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 3 deletions

View File

@ -23,17 +23,28 @@ use crate::checkers::ast::Checker;
///
/// ## Example
/// ```python
/// var: str | "int"
/// var: "Foo" | None
///
///
/// class Foo: ...
/// ```
///
/// Use instead:
/// ```python
/// var: str | int
/// from __future__ import annotations
///
/// var: Foo | None
///
///
/// class Foo: ...
/// ```
///
/// Or, extend the quotes to include the entire union:
/// ```python
/// var: "str | int"
/// var: "Foo | None"
///
///
/// class Foo: ...
/// ```
///
/// ## References