mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
random: explicitly mention int for seed (#7916)
https://github.com/python/typeshed/pull/7906#discussion_r878750404 I felt this better documents how seed is used in practice Co-authored-by: hauntsaninja <>
This commit is contained in:
@@ -67,8 +67,10 @@ class Random(_random.Random):
|
||||
VERSION: ClassVar[int]
|
||||
def __init__(self, x: Any = ...) -> None: ...
|
||||
# Using other `seed` types is deprecated since 3.9 and removed in 3.11
|
||||
# Ignore Y041, since random.seed doesn't treat int like a float subtype. Having an explicit
|
||||
# int better documents conventional usage of random.seed.
|
||||
if sys.version_info >= (3, 9):
|
||||
def seed(self, a: float | str | bytes | bytearray | None = ..., version: int = ...) -> None: ... # type: ignore[override]
|
||||
def seed(self, a: int | float | str | bytes | bytearray | None = ..., version: int = ...) -> None: ... # type: ignore[override] # noqa: Y041
|
||||
else:
|
||||
def seed(self, a: Any = ..., version: int = ...) -> None: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user