Enable flake8-comprehension code style check and fix issues#3989
Enable flake8-comprehension code style check and fix issues#3989Flamefire wants to merge 7 commits intoeasybuilders:developfrom
Conversation
E.g.: > C419 Unnecessary list comprehension in <any/all>() prevents short-circuiting - rewrite as a generator. See https://pypi.org/project/flake8-comprehensions
|
@boegel Looks good with recent develop |
|
Test report by @boegel Overview of tested easyconfigs (in order)
Build succeeded for 4 out of 6 (total: 1 hour 30 mins 2 secs) (6 easyconfigs in total) |
easybuild/easyblocks/p/petsc.py
Outdated
| 'papi', 'ScaLAPACK', 'SciPy-bundle', 'SCOTCH', 'SuiteSparse'] | ||
|
|
||
| for dep in [dep['name'] for dep in self.cfg.dependencies(runtime_only=True) if dep['name'] not in sep_deps]: | ||
| for dep in (name for name in self.cfg.dependencies(runtime_only=True) if name not in sep_deps): |
There was a problem hiding this comment.
@Flamefire I guess you wanted to use self.cfg.dependency_names here?
There was a problem hiding this comment.
That was the intention, not sure what happened. Fixed
|
Test report by @boegel Overview of tested easyconfigs (in order)
Build succeeded for 2 out of 2 (total: 2 hours 43 mins 27 secs) (2 easyconfigs in total) |
https://pypi.org/project/flake8-comprehensions/ has various useful checks, most importantly:
I.e. things like any([expensive_check(x) for x in collection]) runs the check after processing the full collection instead of stopping after the first "match" which costs performance.
To me the whole collection of checks look useful for performance and readability so enable them all.
See easybuilders/easybuild-framework#5043
Requires:
runtime_onlyoptions toEasyConfig.dependency_namesmethod easybuild-framework#5044 fordependency_name(runtime_only=True)I used as some issues involved emulating this function