mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-26 04:46:46 +08:00
Add typeshed aliases to the types accepted by int and float constructors (#10707)
Ref https://github.com/python/typeshed/pull/10630#discussion_r1321646168
This commit is contained in:
@@ -7,8 +7,8 @@ from collections.abc import Awaitable, Callable, Iterable, Sequence, Set as Abst
|
||||
from dataclasses import Field
|
||||
from os import PathLike
|
||||
from types import FrameType, TracebackType
|
||||
from typing import Any, AnyStr, ClassVar, Generic, Protocol, TypeVar, overload
|
||||
from typing_extensions import Buffer, Final, Literal, LiteralString, TypeAlias, final
|
||||
from typing import Any, AnyStr, ClassVar, Generic, Protocol, SupportsFloat, SupportsInt, TypeVar, overload
|
||||
from typing_extensions import Buffer, Final, Literal, LiteralString, SupportsIndex, TypeAlias, final
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_KT_co = TypeVar("_KT_co", covariant=True)
|
||||
@@ -312,3 +312,7 @@ TraceFunction: TypeAlias = Callable[[FrameType, str, Any], TraceFunction | None]
|
||||
# https://github.com/microsoft/pyright/issues/4339
|
||||
class DataclassInstance(Protocol):
|
||||
__dataclass_fields__: ClassVar[dict[str, Field[Any]]]
|
||||
|
||||
# Anything that can be passed to the int/float constructors
|
||||
ConvertibleToInt: TypeAlias = str | ReadableBuffer | SupportsInt | SupportsIndex | SupportsTrunc
|
||||
ConvertibleToFloat: TypeAlias = str | ReadableBuffer | SupportsFloat | SupportsIndex
|
||||
|
||||
Reference in New Issue
Block a user