Skip to content

Commit

Permalink
_apt.py : Used setdefault method to initialize sections dictionary (#60)
Browse files Browse the repository at this point in the history
Simplifies the code and avoids the need for an explicit try-except block.

Co-authored-by: Michael Webster <[email protected]>
  • Loading branch information
SoumyaRoy311000 and mtwebster authored Nov 25, 2024
1 parent dddfca2 commit 9b5466e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions usr/lib/python3/dist-packages/mintcommon/installer/_apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ def process_full_apt_cache(cache):
else:
section = section_string

try:
sections[section].append(pkg_hash)
except Exception:
sections[section] = []
sections[section].append(pkg_hash)
sections.setdefault(section, []).append(pkg_hash)

cache[pkg_hash] = AptPkgInfo(pkg_hash, pkg)

Expand Down

0 comments on commit 9b5466e

Please sign in to comment.