From cfd33807fc8628677d0ab5cc38448d833e7321cb Mon Sep 17 00:00:00 2001 From: Alex Hadley Date: Tue, 14 Mar 2023 11:04:13 -0700 Subject: [PATCH] #40 Fix Mypy error --- paramdb/_param_data/_dataclasses.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/paramdb/_param_data/_dataclasses.py b/paramdb/_param_data/_dataclasses.py index f352889..58bdc0e 100644 --- a/paramdb/_param_data/_dataclasses.py +++ b/paramdb/_param_data/_dataclasses.py @@ -13,10 +13,11 @@ class _ParamDataclass(ParamData): """Base class for parameter dataclasses.""" - def __init_subclass__(cls, /, kw_only=True, **kwargs: Any) -> None: + def __init_subclass__(cls, /, kw_only: bool = True, **kwargs: Any) -> None: # Convert subclasses into dataclasses super().__init_subclass__() - dataclass(cls, kw_only=kw_only, **kwargs) + dataclass(kw_only=kw_only, **kwargs)(cls) + dataclass_transform(kw_only_default=True)(cls) def __getitem__(self, name: str) -> Any: # Enable getting attributes via indexing