60 deps = [f".[{extra}]"] if extra else ["."]
61 deps += [f"git+https://github.com/hyriver/{p}.git" for p in gh_deps[package]]
62 if version_limit:
63 deps += [p for p in version_limit] 64 session.install(*deps)
65 dirs = [".pytest_cache", "build", "dist", ".eggs"]
66 for d in dirs:
It is unnecessary to use a comprehension just to loop over the iterable
and create a list
/set
/dict
out of it.
Python has a specialized set of tools for this task: the list
/set
/dict
constructors, which are faster and more readable.
states = [
('AL', 'Alabama'),
('AK', 'Alaska'),
('AZ', 'Arizona'),
('AR', 'Arkansas'),
('CA', 'California'),
# ...
]
abbreviations_to_names = {
abbreviation: name
for abbreviation, name in states
}
states = [
('AL', 'Alabama'),
('AK', 'Alaska'),
('AZ', 'Arizona'),
('AR', 'Arkansas'),
('CA', 'California'),
# ...
]
abbreviations_to_names = dict(states)