dataclasses: change hash to unsafe_hash, add a minor overload (#3892)

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-04-03 17:23:05 -07:00
committed by GitHub
parent 591522fb6a
commit e56adddc48
4 changed files with 8 additions and 5 deletions

View File

@@ -20,6 +20,9 @@ def astuple(obj: Any, *, tuple_factory: Callable[[List[Any]], _T]) -> _T: ...
@overload
def dataclass(_cls: Type[_T]) -> Type[_T]: ...
@overload
def dataclass(_cls: None) -> Callable[[Type[_T]], Type[_T]]: ...
@overload
def dataclass(*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ...,
unsafe_hash: bool = ..., frozen: bool = ...) -> Callable[[Type[_T]], Type[_T]]: ...
@@ -65,7 +68,7 @@ class InitVar(Generic[_T]): ...
def make_dataclass(cls_name: str, fields: Iterable[Union[str, Tuple[str, type], Tuple[str, type, Field[Any]]]], *,
bases: Tuple[type, ...] = ..., namespace: Optional[Dict[str, Any]] = ...,
init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., hash: bool = ...,
init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ...,
frozen: bool = ...) -> type: ...
def replace(obj: _T, **changes: Any) -> _T: ...