From 8a7bcfba8ea5c15ab4b9ba795a07214c15fadf6c Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Tue, 14 Jul 2026 14:51:32 +0200 Subject: [PATCH] Config: Fix branch() return type annotation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The branch() method returns either None or a Config but has no return type annotation — just a "# type: ignore" comment with a FIXME. Add the proper Optional[Config] annotation (written as Config | None in modern syntax) and remove the workaround. Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v Signed-off-by: Jan Lindemann --- src/python/jw/util/Config.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/python/jw/util/Config.py b/src/python/jw/util/Config.py index d98f7f9..d8d2295 100644 --- a/src/python/jw/util/Config.py +++ b/src/python/jw/util/Config.py @@ -153,11 +153,7 @@ class Config(): # export def value(self, key: str, default = None) -> Optional[str]: return self.get(key, default) - def branch( - self, - path: str, - throw: bool = True - ): # type: ignore # Optional[Config]: FIXME: Don't know how to get hold of this type here + def branch(self, path: str, throw: bool = True) -> Config | None: if self.__conf: tree = self.__conf.get(path) if tree is None: @@ -167,7 +163,7 @@ class Config(): # export return None self.dump(ERR, msg) raise Exception(msg) - return Config(tree = tree, parent = self) # type: ignore + return Config(tree = tree, parent = self) return None def dump(self, prio: int, *args, **kwargs) -> None: