Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore)
pylint emits a no-member error for tokenize.INDENT. This is happening because tokenize imports the tokens from token.py using star import. In token.py, the __all__ variable is computed dynamically, using this pattern:
#!python
tok_name = {value: name
for name, value in globals().items()
if isinstance(value, int) and not name.startswith('_')}
__all__.extend(tok_name.values())
This pattern is becoming extremely popular lately and it causes quite a lot of false positives when encountered. There are some solutions we could use:
use a transform. This gets quickly out of hand when the number of modules for which
we need to write transforms to fix this problem increases.
in the short term, we could let Module.wildcard_import_names() to return every global in the module if modifications to __all__ are encountered
in the long term, supporting this code is not so hard with astroid. We can understand globals() relatively easily, comprehensions can be as well relatively easy to understand,
the big problem being the filtering with the if statement.
Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore)
pylint emits a no-member error for
tokenize.INDENT
. This is happening because tokenize imports the tokens from token.py using star import. In token.py, the__all__
variable is computed dynamically, using this pattern:This pattern is becoming extremely popular lately and it causes quite a lot of false positives when encountered. There are some solutions we could use:
__all__
are encounteredI'll tackle the last point after 1.5.