Skip to content

Commit 9b5466e

Browse files
_apt.py : Used setdefault method to initialize sections dictionary (#60)
Simplifies the code and avoids the need for an explicit try-except block. Co-authored-by: Michael Webster <[email protected]>
1 parent dddfca2 commit 9b5466e

File tree

1 file changed

+1
-5
lines changed
  • usr/lib/python3/dist-packages/mintcommon/installer

1 file changed

+1
-5
lines changed

usr/lib/python3/dist-packages/mintcommon/installer/_apt.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,7 @@ def process_full_apt_cache(cache):
117117
else:
118118
section = section_string
119119

120-
try:
121-
sections[section].append(pkg_hash)
122-
except Exception:
123-
sections[section] = []
124-
sections[section].append(pkg_hash)
120+
sections.setdefault(section, []).append(pkg_hash)
125121

126122
cache[pkg_hash] = AptPkgInfo(pkg_hash, pkg)
127123

0 commit comments

Comments
 (0)