mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-01 09:03:23 +08:00
Export DataclassInstance protocol from _typeshed (#9676)
This commit is contained in:
@@ -8,9 +8,10 @@ import mmap
|
||||
import pickle
|
||||
import sys
|
||||
from collections.abc import Awaitable, Callable, Iterable, Set as AbstractSet
|
||||
from dataclasses import Field
|
||||
from os import PathLike
|
||||
from types import FrameType, TracebackType
|
||||
from typing import Any, AnyStr, Generic, Protocol, TypeVar, Union
|
||||
from typing import Any, AnyStr, ClassVar, Generic, Protocol, TypeVar, Union
|
||||
from typing_extensions import Final, Literal, LiteralString, TypeAlias, final
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
@@ -304,3 +305,10 @@ ProfileFunction: TypeAlias = Callable[[FrameType, str, Any], object]
|
||||
|
||||
# Objects suitable to be passed to sys.settrace, threading.settrace, and similar
|
||||
TraceFunction: TypeAlias = Callable[[FrameType, str, Any], TraceFunction | None]
|
||||
|
||||
# experimental
|
||||
# Might not work as expected for pyright, see
|
||||
# https://github.com/python/typeshed/pull/9362
|
||||
# https://github.com/microsoft/pyright/issues/4339
|
||||
class DataclassInstance(Protocol):
|
||||
__dataclass_fields__: ClassVar[dict[str, Field[Any]]]
|
||||
|
||||
Reference in New Issue
Block a user