Skip to content

Commit 195b9ce

Browse files
committed
Arrrrrrr Pyright!
1 parent 6f24ea7 commit 195b9ce

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

modules/packages/vendored/dnf.mustache

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,12 @@ def _resolve_spec(pkg: Dict[str, str]) -> Optional[str]:
307307
if not name:
308308
return None
309309
spec = name
310-
if pkg.get("version"):
311-
spec += "-" + pkg.get("version")
312-
if pkg.get("arch"):
313-
spec += "." + pkg.get("arch")
310+
version = pkg.get("version")
311+
if version:
312+
spec += "-" + version
313+
arch = pkg.get("arch")
314+
if arch:
315+
spec += "." + arch
314316
return spec
315317

316318

@@ -377,9 +379,9 @@ def list_updates(online: bool) -> int:
377379
_apply_options(base, options)
378380
try:
379381
base.upgrade_all()
380-
if base.resolve():
382+
if base.resolve() and base.transaction:
381383
for tsi in base.transaction:
382-
if tsi.action == dnf.transaction.PKG_UPGRADE:
384+
if tsi.action == dnf.transaction.PKG_UPGRADE: # type: ignore[attr-defined]
383385
v_str = f"{tsi.pkg.version}-{tsi.pkg.release}"
384386
sys.stdout.write(
385387
f"{KEY_NAME}={tsi.pkg.name}\n{KEY_VERSION}={v_str}\n{KEY_ARCHITECTURE}={tsi.pkg.arch}\n"

0 commit comments

Comments
 (0)