Open pylint-bot opened 9 years ago
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):
Thanks for the patch! Could you submit it as a pull request? It's much easier to review that way.
Original comment by Czarek Tomczak (BitBucket: Czarek, GitHub: @Czarek?):
@PCManticore Created pull request #208.
Original comment by Czarek Tomczak (BitBucket: Czarek, GitHub: @Czarek?):
Found another related Issue #357. Looks like in the past there were probably many manual fixes required like the one in this commit. The "dynamic-modules" option might be a solution to such issues in the future.
Original comment by Czarek Tomczak (BitBucket: Czarek, GitHub: @Czarek?):
There is another kind of error message that isn't handled by this patch and which is also caused by dynamic names:
#!python
from wx.core import *
Results in error:
#!text
E: 12, 0: No name 'core' in module 'wx' (no-name-in-module)
But it's strange as later it complains about specific things being imported from wx.core, so it must have found that "core" name somewhat:
#!text
W: 12, 0: Wildcard import wx.core (wildcard-import)
W: 12, 0: Unused import wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING from wildcard import (unused-wildcard-import)
W: 12, 0: Unused import wxEVT_COMMAND_CHOICE_SELECTED from wildcard import (unused-wildcard-import)
W: 12, 0: Unused import EVT_COMBOBOX from wildcard import (unused-wildcard-import)
...
Originally reported by: Czarek Tomczak (BitBucket: Czarek, GitHub: @Czarek?)
I have this code that uses the wxPython library:
Pylint will throw an error:
A similar issue for the numpy library was reported in the past, see Issue 58:
58/
That case was fixed for numpy, but there are still similar issues with many other libraries. There is a "ignore-modules" option, but using it is not a good idea, as it will ignore real problems when accessing non existent members. In a comment by Mykola Sakhno it was proposed to add a "dynamic-modules" option as a solution for this problem.
Attaching the "pylint_1.4.0_dynamic_modules.patch" file. It adds "dynamic-modules" option and a new method visit_getattr_dynamic() in pylint/checkers/typecheck.py > TypeChecker class. I know that this code isn't perfect, but it's a good start, it works.
The .pylintrc rcfile looks like this:
The example script I'm using tests two cases: a shared package and a local package. See:
Without the patch this errors appear in pylint:
After applying patch, these errors disappear. All looks to be working fine.
Using pylint 1.4.0 and Python 3.4.2 on Windows 7. The patch should work with Python 2.7 as well.