@@ -45,20 +45,14 @@ async def run(self) -> None: ...
45
45
46
46
47
47
def option (* param_decls : str , ** kwargs : Any ) -> Any :
48
- if sys .version_info >= (3 , 10 ):
49
- default_default = MISSING
50
- else : # versions < 3.10 don't know about kw_only and they complain about lacks of defaults
51
- # Can't get coverage on this because we only test on one version
52
- default_default = None # pragma: no cover
53
-
54
48
return field (
55
49
metadata = dict (
56
50
option_args = dict (
57
51
param_decls = tuple (param_decls ),
58
52
** kwargs ,
59
53
),
60
54
),
61
- default = kwargs .get ("default" , default_default ),
55
+ default = kwargs .get ("default" , MISSING ),
62
56
)
63
57
64
58
@@ -270,16 +264,10 @@ def chia_command(
270
264
def _chia_command (cls : type [ChiaCommand ]) -> type [ChiaCommand ]:
271
265
# The type ignores here are largely due to the fact that the class information is not preserved after being
272
266
# passed through the dataclass wrapper. Not sure what to do about this right now.
273
- if sys .version_info >= (3 , 10 ):
274
- wrapped_cls : type [ChiaCommand ] = dataclass (
275
- frozen = True ,
276
- kw_only = True ,
277
- )(cls )
278
- else : # pragma: no cover
279
- # stuff below 3.10 doesn't know about kw_only
280
- wrapped_cls : type [ChiaCommand ] = dataclass (
281
- frozen = True ,
282
- )(cls )
267
+ wrapped_cls : type [ChiaCommand ] = dataclass (
268
+ frozen = True ,
269
+ kw_only = True ,
270
+ )(cls )
283
271
284
272
metadata = Metadata (
285
273
command = click .command (
@@ -316,9 +304,6 @@ def get_chia_command_metadata(cls: type[ChiaCommand]) -> Metadata:
316
304
317
305
@dataclass_transform (frozen_default = True )
318
306
def command_helper (cls : type [Any ]) -> type [Any ]:
319
- if sys .version_info >= (3 , 10 ):
320
- new_cls = dataclass (frozen = True , kw_only = True )(cls )
321
- else : # stuff below 3.10 doesn't support kw_only
322
- new_cls = dataclass (frozen = True )(cls ) # pragma: no cover
307
+ new_cls = dataclass (frozen = True , kw_only = True )(cls )
323
308
setattr (new_cls , COMMAND_HELPER_ATTRIBUTE_NAME , True )
324
309
return new_cls
0 commit comments