]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
config: use typing.get_args instead of private fields
authorJörg Behrmann <behrmann@physik.fu-berlin.de>
Mon, 16 Feb 2026 12:14:24 +0000 (13:14 +0100)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Mon, 16 Feb 2026 12:14:24 +0000 (13:14 +0100)
This allows us to get rid of one type ignore comment.

mkosi/config.py

index f10f64d213b41c286a933983dd2d1fd22076454d..3f1bc19e47e64caf083e3cdd188b16a2bf342300 100644 (file)
@@ -5950,7 +5950,7 @@ def json_type_transformer(refcls: Union[type[Args], type[Config]]) -> Callable[[
         return typing.get_args(fieldtype)[0](enumval) if enumval is not None else None
 
     def enum_list_transformer(enumlist: list[str], fieldtype: type[list[E]]) -> list[E]:
-        enumtype = fieldtype.__args__[0]  # type: ignore
+        enumtype = typing.get_args(fieldtype)[0]
         return [enumtype(e) for e in enumlist]
 
     def config_drive_transformer(drives: list[dict[str, Any]], fieldtype: type[Drive]) -> list[Drive]: