From 32f4909ad66b544ab43fcf25fc9acc9907af55ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20Behrmann?= Date: Mon, 16 Feb 2026 13:17:26 +0100 Subject: [PATCH] config: annotate json object before assignment This makes comments from type checkers clearer in this case, since the type is clear before it is first assignment, but what is assigned to the object comes from different functions. --- mkosi/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mkosi/config.py b/mkosi/config.py index 93c06166e..ed0f9d25c 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -1903,6 +1903,7 @@ class Args: def from_json(cls, s: Union[str, dict[str, Any], SupportsRead[str], SupportsRead[bytes]]) -> "Args": """Instantiate a Args object from a (partial) JSON dump.""" + j: dict[str, Any] if isinstance(s, str): j = json.loads(s) elif isinstance(s, dict): @@ -2477,6 +2478,8 @@ class Config: s: Union[str, dict[str, Any], SupportsRead[str], SupportsRead[bytes]], ) -> dict[str, Any]: """Instantiate a Config object from a (partial) JSON dump.""" + + j: dict[str, Any] if isinstance(s, str): j = json.loads(s) elif isinstance(s, dict): -- 2.47.3