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:
parent
544d80949f
commit
8a7bcfba8e
1 changed files with 2 additions and 6 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue