forked from Mirror/pmbootstrap
pmb: Replace list(...)[0] with next(iter(...)) (MR 2525)
See https://docs.astral.sh/ruff/rules/unnecessary-iterable-allocation-for-first-element
This commit is contained in:
parent
752c1df039
commit
c2787aa76f
2 changed files with 3 additions and 3 deletions
|
@ -399,7 +399,7 @@ def ask_for_device_kernel(config: Config, device: str) -> str:
|
|||
# Get default
|
||||
default = config.kernel
|
||||
if default not in kernels:
|
||||
default = list(kernels.keys())[0]
|
||||
default = next(iter(kernels.keys()))
|
||||
|
||||
# Ask for kernel (extra message when downstream and upstream are available)
|
||||
logging.info("Which kernel do you want to use with your device?")
|
||||
|
|
|
@ -27,7 +27,7 @@ def package_provider(
|
|||
# 1. Only one provider
|
||||
logging.verbose(f"{pkgname}: provided by: {', '.join(providers)}")
|
||||
if len(providers) == 1:
|
||||
return list(providers.values())[0]
|
||||
return next(iter(providers.values()))
|
||||
|
||||
# 2. Provider with the same package name
|
||||
if pkgname in providers:
|
||||
|
@ -66,7 +66,7 @@ def package_provider(
|
|||
# 6. Pick the provider(s) with the highest priority
|
||||
providers = pmb.parse.apkindex.provider_highest_priority(providers, pkgname)
|
||||
if len(providers) == 1:
|
||||
return list(providers.values())[0]
|
||||
return next(iter(providers.values()))
|
||||
|
||||
# 7. Pick the shortest provider. (Note: Normally apk would fail here!)
|
||||
return pmb.parse.apkindex.provider_shortest(providers, pkgname)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue