ruff: format (MR 2344)

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-07-08 16:09:42 +02:00
parent 71646f0a1d
commit 0e62eaac67
No known key found for this signature in database
GPG key ID: 0583312B195F64B6
8 changed files with 23 additions and 17 deletions

View file

@ -102,6 +102,7 @@ def warn_if_chroots_outdated():
" 'pmbootstrap zap'."
)
@Cache("chroot")
def init(chroot: Chroot, usr_merge=UsrMerge.AUTO):
"""

View file

@ -204,8 +204,14 @@ def switch_to_channel_branch(channel_new):
channels_cfg = pmb.helpers.git.parse_channels_cfg(aports)
branch_new = channels_cfg["channels"][channel_new]["branch_pmaports"]
branch_current = pmb.helpers.git.rev_parse(aports, extra_args=["--abbrev-ref"])
if branch_current == "master_staging_systemd" and channel_new == "edge" and pmb.config.is_systemd_selected():
logging.info("NOTE: systemd enabled and currently on the master_staging_systemd branch, not switching to edge")
if (
branch_current == "master_staging_systemd"
and channel_new == "edge"
and pmb.config.is_systemd_selected()
):
logging.info(
"NOTE: systemd enabled and currently on the master_staging_systemd branch, not switching to edge"
)
return False
logging.info(

View file

@ -41,13 +41,11 @@ def chroot_save_init(suffix: Chroot):
@overload
def chroots_outdated() -> list[Chroot]:
...
def chroots_outdated() -> list[Chroot]: ...
@overload
def chroots_outdated(chroot: Chroot) -> bool:
...
def chroots_outdated(chroot: Chroot) -> bool: ...
def chroots_outdated(chroot: Optional[Chroot] = None):

View file

@ -182,6 +182,7 @@ def warning(msg: object, *args, **kwargs):
def warn_once(msg: str):
logging.warning(msg)
def info(msg: object, *args, **kwargs):
logging.info(msg, *args, **kwargs)

View file

@ -28,14 +28,15 @@ def remove_operators(package):
break
return package
@overload
def get(pkgname: str, arch: Arch, replace_subpkgnames: bool=False) -> dict[str, Any]:
...
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:
...
def get(
pkgname: str, arch: Arch, replace_subpkgnames: bool = False, must_exist: bool = True
) -> dict[str, Any] | None: ...
@Cache("pkgname", "arch", "replace_subpkgnames")

View file

@ -9,6 +9,7 @@ import inspect
FuncArgs = TypeVar("FuncArgs")
FuncReturn = TypeVar("FuncReturn")
class Wrapper(Generic[FuncArgs, FuncReturn]):
def __init__(self, cache: "Cache", func: Callable[[FuncArgs], FuncReturn]):
self.cache = cache
@ -126,12 +127,10 @@ class Cache:
return key
@overload
def __call__(self, func: Callable[..., FuncReturn]) -> Wrapper[None, FuncReturn]:
...
def __call__(self, func: Callable[..., FuncReturn]) -> Wrapper[None, FuncReturn]: ...
@overload
def __call__(self, func: Callable[[FuncArgs], FuncReturn]) -> Wrapper[FuncArgs, FuncReturn]:
...
def __call__(self, func: Callable[[FuncArgs], FuncReturn]) -> Wrapper[FuncArgs, FuncReturn]: ...
def __call__(self, func: Callable[[FuncArgs], FuncReturn]) -> Wrapper[FuncArgs, FuncReturn]:
argnames = func.__code__.co_varnames

View file

@ -297,7 +297,7 @@ def extract_version(config_path):
return "unknown"
def check_file(config_path, components_list: list[str]=[], details=False):
def check_file(config_path, components_list: list[str] = [], details=False):
"""
Check for necessary kernel config options in a kconfig file.