Skip to content

Commit b825379

Browse files
author
hauntsaninja
committed
dataclasses: various fixes
1 parent 8de9b85 commit b825379

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

stdlib/3.7/dataclasses.pyi

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def astuple(obj: Any) -> Tuple[Any, ...]: ...
1818
@overload
1919
def astuple(obj: Any, *, tuple_factory: Callable[[List[Any]], _T]) -> _T: ...
2020
@overload
21-
def dataclass(_cls: Type[_T]) -> Type[_T]: ...
21+
def dataclass(__cls: Type[_T]) -> Type[_T]: ...
2222
@overload
23-
def dataclass(_cls: None) -> Callable[[Type[_T]], Type[_T]]: ...
23+
def dataclass(__cls: None) -> Callable[[Type[_T]], Type[_T]]: ...
2424
@overload
2525
def dataclass(
2626
*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ...
@@ -36,6 +36,16 @@ class Field(Generic[_T]):
3636
init: bool
3737
compare: bool
3838
metadata: Mapping[str, Any]
39+
def __init__(
40+
self,
41+
default: _T,
42+
default_factory: Callable[[], _T],
43+
init: bool,
44+
repr: bool,
45+
hash: Optional[bool],
46+
compare: bool,
47+
metadata: Mapping[str, Any],
48+
) -> None: ...
3949
if sys.version_info >= (3, 9):
4050
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
4151

@@ -76,6 +86,8 @@ def is_dataclass(obj: Any) -> bool: ...
7686
class FrozenInstanceError(AttributeError): ...
7787

7888
class InitVar(Generic[_T]):
89+
type: Type
90+
def __init__(self, type: Type) -> None: ...
7991
if sys.version_info >= (3, 9):
8092
def __class_getitem__(cls, type: Any) -> GenericAlias: ...
8193

@@ -92,4 +104,4 @@ def make_dataclass(
92104
unsafe_hash: bool = ...,
93105
frozen: bool = ...,
94106
) -> type: ...
95-
def replace(obj: _T, **changes: Any) -> _T: ...
107+
def replace(__obj: _T, **changes: Any) -> _T: ...

0 commit comments

Comments
 (0)