Refactor some local expressions

Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
Niels Thykier 2016-03-24 07:51:36 +00:00
parent 7e475cd9f9
commit e2b98872cf

View File

@ -1583,10 +1583,9 @@ class Britney(object):
This method returns a dictionary where the keys are the package names This method returns a dictionary where the keys are the package names
and the values are the excuse names which depend on it. and the values are the excuse names which depend on it.
""" """
res = {} res = defaultdict(list)
for exc in self.excuses: for exc in self.excuses:
for d in exc.deps: for d in exc.deps:
if d not in res: res[d] = []
res[d].append(exc.name) res[d].append(exc.name)
return res return res
@ -1598,9 +1597,7 @@ class Britney(object):
`valid' and `invalid' excuses. `valid' and `invalid' excuses.
""" """
# build a lookup-by-name map # build a lookup-by-name map
exclookup = {} exclookup = {e.name: e for e in self.excuses}
for e in self.excuses:
exclookup[e.name] = e
# build the reverse dependencies # build the reverse dependencies
revdeps = self.reversed_exc_deps() revdeps = self.reversed_exc_deps()