mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-13 11:31:38 +00:00
britney.py: Use defaultdict instead of "{}.setdefault"
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
12691baa87
commit
4383fe93a5
@ -189,6 +189,7 @@ import urllib
|
|||||||
|
|
||||||
import apt_pkg
|
import apt_pkg
|
||||||
|
|
||||||
|
from collections import defaultdict
|
||||||
from functools import reduce, partial
|
from functools import reduce, partial
|
||||||
from itertools import chain, ifilter, product
|
from itertools import chain, ifilter, product
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
@ -678,7 +679,7 @@ class Britney(object):
|
|||||||
The method returns a dictionary where the key is the binary package
|
The method returns a dictionary where the key is the binary package
|
||||||
name and the value is the list of open RC bugs for it.
|
name and the value is the list of open RC bugs for it.
|
||||||
"""
|
"""
|
||||||
bugs = {}
|
bugs = defaultdict(list)
|
||||||
filename = os.path.join(basedir, "BugsV")
|
filename = os.path.join(basedir, "BugsV")
|
||||||
self.__log("Loading RC bugs data from %s" % filename)
|
self.__log("Loading RC bugs data from %s" % filename)
|
||||||
for line in open(filename):
|
for line in open(filename):
|
||||||
@ -687,7 +688,6 @@ class Britney(object):
|
|||||||
self.__log("Malformed line found in line %s" % (line), type='W')
|
self.__log("Malformed line found in line %s" % (line), type='W')
|
||||||
continue
|
continue
|
||||||
pkg = l[0]
|
pkg = l[0]
|
||||||
bugs.setdefault(pkg, [])
|
|
||||||
bugs[pkg] += l[1].split(",")
|
bugs[pkg] += l[1].split(",")
|
||||||
return bugs
|
return bugs
|
||||||
|
|
||||||
@ -2783,10 +2783,10 @@ class Britney(object):
|
|||||||
|
|
||||||
def nuninst_arch_report(self, nuninst, arch):
|
def nuninst_arch_report(self, nuninst, arch):
|
||||||
"""Print a report of uninstallable packages for one architecture."""
|
"""Print a report of uninstallable packages for one architecture."""
|
||||||
all = {}
|
all = defaultdict(set)
|
||||||
for p in nuninst[arch]:
|
for p in nuninst[arch]:
|
||||||
pkg = self.binaries['testing'][arch][0][p]
|
pkg = self.binaries['testing'][arch][0][p]
|
||||||
all.setdefault((pkg[SOURCE], pkg[SOURCEVER]), set()).add(p)
|
all[pkg].add(p)
|
||||||
|
|
||||||
print '* %s' % (arch,)
|
print '* %s' % (arch,)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user