Change dict comprehensions to dict() constructors.

This commit is contained in:
Todd Gamblin 2014-08-10 16:04:41 -07:00
parent 5a5da817a1
commit a41a19d14d
4 changed files with 4 additions and 4 deletions

View File

@ -189,7 +189,7 @@ def check(key):
return None
successful = [key for key in parmap(check, checks) if key is not None]
return { (v, p, s) : path for v, p, s, path in successful }
return dict(((v, p, s), path) for v, p, s, path in successful)
@classmethod
def find(cls, *path):

View File

@ -176,7 +176,7 @@ def compilers_for_spec(compiler_spec):
config = _get_config()
def get_compiler(cspec):
items = { k:v for k,v in config.items('compiler "%s"' % cspec) }
items = dict((k,v) for k,v in config.items('compiler "%s"' % cspec))
if not all(n in items for n in _required_instance_vars):
raise InvalidCompilerConfigurationError(cspec)

View File

@ -360,7 +360,7 @@ def sanity_check_dict(attr_name):
# Version-ize the keys in versions dict
try:
self.versions = { Version(v):h for v,h in self.versions.items() }
self.versions = dict((Version(v), h) for v,h in self.versions.items())
except ValueError:
raise ValueError("Keys of versions dict in package %s must be versions!"
% self.name)

View File

@ -35,7 +35,7 @@
hashlib.sha512 ]
"""Index for looking up hasher for a digest."""
_size_to_hash = { h().digest_size : h for h in _acceptable_hashes }
_size_to_hash = dict((h().digest_size, h) for h in _acceptable_hashes)
def checksum(hashlib_algo, filename, **kwargs):