Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion stdlib/dataclasses.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import sys
from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar, Union, overload
from typing_extensions import Protocol

if sys.version_info >= (3, 9):
from types import GenericAlias

_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)

class _MISSING_TYPE: ...

Expand Down Expand Up @@ -63,11 +65,15 @@ else:
*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ...
) -> Callable[[Type[_T]], Type[_T]]: ...

# See https://github.com/python/mypy/issues/10750
class _DefaultFactory(Protocol[_T_co]):
def __call__(self) -> _T_co: ...

class Field(Generic[_T]):
name: str
type: Type[_T]
default: _T
default_factory: Callable[[], _T]
default_factory: _DefaultFactory[_T]
repr: bool
hash: Optional[bool]
init: bool
Expand Down