-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code cleanup with pylint #3203
Code cleanup with pylint #3203
Conversation
For wildcard imports, use the tuple import syntax (PEP 328). Pylint rules: W0401,W0611,W0614
Remove unused variables/arguments and superfluous parentheses, merge chained calls to `isinstance()`, merge value checks via `in`, make optional argument values immutable, iterate dict keys directly, class methods take `cls` instead of `self` as first argument, use raw strings in regex patterns, etc. Pylint rules: R1701,R1714,C0201,C0202,C0325,C1801,W0102,W0612,W0613,W1401,W1505
Remove trailing whitespaces and fix indentation. Pylint rules: W0311,C0303,C0321,C0330
Codecov Report
@@ Coverage Diff @@
## python #3203 +/- ##
======================================
Coverage 85% 85%
======================================
Files 530 530
Lines 25795 25795
======================================
Hits 22168 22168
Misses 3627 3627 Continue to review full report at Codecov.
|
are you sure we want to defer to 5.0? I think backporting bugfixes after the 4.1 release could be harder... |
Please defer. Otherwise all tutorials have to be rechecked
|
Yes we should defer it to espresso 5. The bugs found here are not executed in our CI pipeline otherwise we would have got syntax errors. I've also not fixed bugs that require more than a one-liner change. In espresso 4.1, the sources of syntax errors and runtime errors are:
edit: fixes for the following bugs have been backported to 4.1 in f8e36f0:
|
Patch potential sources of syntax error and runtime errors already fixed in espresso 5. Pylint rules: E0602,W0102.
I'm not opposed to the code changes in this PR. This is particularly so for future autmated lint checking in PRs. There, rules should be added on an individual basis, only. |
I agree. New formatting rules should have limited impact on existing code. However, the changes in this pull request are rather small, increase code legibility and unlikely to cause major merge conflicts. So I think it should be merged. |
@RudolfWeeber thanks for your feedback! Here is my perspective:
|
maybe we should add a |
I suggest we merge this PR in priority after the end of the summer school. |
@KaiSzuttor @christophlohrmann the NPT thermostat checkpointing might be broken too: espresso/src/python/espressomd/thermostat.pyx Lines 108 to 110 in 9dc1e06
does not match the function signature: espresso/src/python/espressomd/thermostat.pyx Line 419 in 9dc1e06
|
alright, fixing NPT revealed other bugs in the checkpointing mechanism for integrators. I'll have to open a separate PR, here is not the right place. |
The checkpointing bugfixes have their own PR now. The only relevant bugfix commit left in this PR for 4.1.1 (3b716e5) was cherry-picked in the release candidate. This is now ready for review. |
bors r=KaiSzuttor |
3203: Code cleanup with pylint r=KaiSzuttor a=jngrad Follow-up to #3194 Description of changes: - remove unused imports - rewrite wildcard imports as explicit imports - replace mutable optional parameters by immutable equivalents - fix LB thermostat checkpointing mechanism - cleanup and simplify conditional statements - refactor code with numpy and new espresso methods - remove unused variables/arguments - rename unused loop variables from `i` to `_` - fix broken numpy commands in parts of the testsuite that aren't executed - remove trailling whitespaces Co-authored-by: Jean-Noël Grad <[email protected]> Co-authored-by: Kai Szuttor <[email protected]>
Build succeeded |
Follow-up to #3194
Description of changes:
i
to_