Solver/dnf.py: simplify the code a bit

Since the `with_sbom` variable was used only in a single place, we can
simplify the code (and remove one extra line of it) to just directly use
the if condition.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-09-17 13:39:20 +02:00 committed by Simon de Vlieger
parent 9510e88c0f
commit 02ca5722f6

View file

@ -243,7 +243,6 @@ class DNF(SolverBase):
return packages
def depsolve(self, arguments):
want_sbom = "sbom" in arguments
# Return an empty list when 'transactions' key is missing or when it is None
transactions = arguments.get("transactions") or []
# collect repo IDs from the request so we know whether to translate gpg key paths
@ -325,7 +324,7 @@ class DNF(SolverBase):
"repos": repositories,
}
if want_sbom:
if "sbom" in arguments:
response["sbom"] = self._sbom_for_pkgset(last_transaction)
return response