mirror of https://github.com/astral-sh/ruff
expand `use instead` examples
This commit is contained in:
parent
2caf2987c0
commit
e3d26e1a62
|
|
@ -20,11 +20,23 @@ use crate::{FixAvailability, Violation};
|
|||
/// from typing import ByteString
|
||||
/// ```
|
||||
///
|
||||
/// Use instead:
|
||||
/// On Python versions after 3.12, use the `Buffer` type from the standard library instead:
|
||||
/// ```python
|
||||
/// from collections.abc import Buffer
|
||||
/// ```
|
||||
///
|
||||
/// For earlier Python versions, you can use `typing_extensions`:
|
||||
/// ```python
|
||||
/// from typing_extensions import Buffer
|
||||
/// ```
|
||||
///
|
||||
/// or a union:
|
||||
/// ```python
|
||||
/// from typing import Union
|
||||
///
|
||||
/// x: Union[bytes, bytearray, memoryview]
|
||||
/// ```
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: The `ByteString` type](https://docs.python.org/3/library/typing.html#typing.ByteString)
|
||||
#[derive(ViolationMetadata)]
|
||||
|
|
|
|||
Loading…
Reference in New Issue