Skip to content

Commit

Permalink
Make sure we use initialized variable.
Browse files Browse the repository at this point in the history
Addressing
pylint-3 --disable=R --disable=C --indent-string="\t" --extension-pkg-whitelist=rpm,lxml lib/*/*.py
************* Module swidtags
lib/dnf-plugins/swidtags.py:312:11: E0606: Possibly using variable 'ts' before assignment (possibly-used-before-assignment)
  • Loading branch information
adelton committed May 29, 2024
1 parent 2c917e8 commit 5d0b4ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/dnf-plugins/swidtags.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ def run_rpm2swidtag_for(self, pkgs):

def get_nevra_checksum(self, nevra, verbose=True):
if not self.ts:
ts = rpm.transaction.initReadOnlyTransaction(root=self.base.conf.installroot)
rpms = ( ts.dbMatch(2, str(nevra)) )
self.ts = rpm.transaction.initReadOnlyTransaction(root=self.base.conf.installroot)
rpms = ( self.ts.dbMatch(2, str(nevra)) )
if len(rpms) > 1:
if verbose:
logger.warning("Multiple rpms %s found installed for package %s.", str(rpms), str(nevra))
Expand Down

0 comments on commit 5d0b4ee

Please sign in to comment.