Pylint 2 fixes#15487
Conversation
| import sys | ||
| import threading | ||
|
|
||
| from typing import Optional, List, Dict, Any # noqa #pylint: disable=unused-import |
There was a problem hiding this comment.
Is this needed?
From PyLint changelog:
Don't emit unused-import anymore for typing imports used in type comments.
There was a problem hiding this comment.
Yes, it's still needed. Note used in type comments in the pylint changelog -- in this case, Optional, Dict, and Any are not used anywhere. (In my opinion, these cases should be fixed for real by just dropping the actually unused imports, but that's slightly off topic for this particular PR.)
There was a problem hiding this comment.
I think that dropping the unused ones should be appropriate. What's the use of importing something and not using it? Isn't that exactly what PyLint is checking?
There was a problem hiding this comment.
I suppose it's just an oversight in many places. I'll modify this PR to drop the import-error changes and will take a look at addressing them in a separate one.
There was a problem hiding this comment.
I've pushed a "Revert pylint 2 inline disable syntax fixes addressing unused-imports" commit to the source branch, but it seems github is having issues at the moment and that commit doesn't show up here yet. Not sure if I should do something about it, but will wait at least a bit first.
Will have a go at removing more unused imports altogether first.
* pylint 2 inline disable syntax fixes * pylint 2 logging-not-lazy fixes * pylint 2 consider-using-in fixes * Revert pylint 2 inline disable syntax fixes addressing unused-imports Will have a go at removing more unused imports altogether first.
* pylint 2 inline disable syntax fixes * pylint 2 logging-not-lazy fixes * pylint 2 consider-using-in fixes * Revert pylint 2 inline disable syntax fixes addressing unused-imports Will have a go at removing more unused imports altogether first.
Description:
I'm working on upgrading pylint to 2.0.0. It reports quite a few new things (more on that later in a separate PR), but here are some easliy fixable low hanging fruits.
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: