mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-10 18:36:31 +08:00
fix up some C signatures (#14624)
a few issues exposed after https://github.com/python/mypy/pull/18259 was merged
This commit is contained in:
@@ -4,6 +4,7 @@ from _typeshed import SupportsLenAndGetItem
|
||||
from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set as AbstractSet
|
||||
from fractions import Fraction
|
||||
from typing import Any, ClassVar, NoReturn, TypeVar
|
||||
from typing_extensions import Self
|
||||
|
||||
__all__ = [
|
||||
"Random",
|
||||
@@ -44,6 +45,10 @@ class Random(_random.Random):
|
||||
# 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, 10):
|
||||
# this is a workaround for pyright correctly flagging an inconsistent inherited constructor, see #14624
|
||||
def __new__(cls, x: int | float | str | bytes | bytearray | None = None) -> Self: ... # noqa: Y041
|
||||
|
||||
def seed(self, a: int | float | str | bytes | bytearray | None = None, version: int = 2) -> None: ... # type: ignore[override] # noqa: Y041
|
||||
def getstate(self) -> tuple[Any, ...]: ...
|
||||
def setstate(self, state: tuple[Any, ...]) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user