helpers: package: overload types (MR 2344)

Correct return types based on arguments

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-07-08 15:58:13 +02:00
parent afbecb7184
commit 852efe1f8e
No known key found for this signature in database
GPG key ID: 0583312B195F64B6

View file

@ -10,7 +10,7 @@ See also:
"""
import copy
from typing import Any
from typing import Any, overload
from pmb.core.arch import Arch
from pmb.core.context import get_context
from pmb.helpers import logging
@ -28,6 +28,15 @@ def remove_operators(package):
break
return package
@overload
def get(pkgname: str, arch: Arch, replace_subpkgnames: bool=False) -> dict[str, Any]:
...
@overload
def get(pkgname: str, arch: Arch, replace_subpkgnames: bool=False, must_exist: bool=True) -> dict[str, Any] | None:
...
@Cache("pkgname", "arch", "replace_subpkgnames")
def get(pkgname, arch, replace_subpkgnames=False, must_exist=True):