You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand you might not want to support the sys.modules[__name__] = newmod hack, but it seems to me that just parsing the __ALL__ line (and using it as a heuristic for what can be imported, I know it can be different) might go a long way here.
The text was updated successfully, but these errors were encountered:
This library is using a dynamic expression to define __ALL__ — one that static type checkers like pylance do not understand. There are a limited number of forms of __ALL__ that static type checkers honor. The list can be found here. The maintainers of pygments will need to stick to this list if they want their library to work with static type checkers.
In the meantime, you can work around the problem by importing the module one level deeper: from pygments.lexers.diff import DiffLexer
Environment data
Expected behaviour
Typechecking pygments code (
pip install pygments
) should work:Actual behaviour
prints DiffLexer is unknow import symbol
Code Snippet / Additional information
See the pygments/lexers/init.py:
I understand you might not want to support the
sys.modules[__name__] = newmod
hack, but it seems to me that just parsing the__ALL__
line (and using it as a heuristic for what can be imported, I know it can be different) might go a long way here.The text was updated successfully, but these errors were encountered: