Config: Fix branch() return type annotation

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 <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-07-14 14:51:32 +02:00 • committed by janware DevOps
commit 8a7bcfba8e
Signed by: DevOps
SSH key fingerprint: SHA256:cZiw7ExG5q3KAVm7Jse3rGITowu0VjgUgNMPbifmY8g

View file

@ -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: