-
For variables are defined in another notebook and imported via %run. flake8_nb still gives me the variable is undefined error. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@jencake This is a general limitation when using Pretty much the same issue was opened and closed for nbQA and I have the same suggestion as @MarcoGorelli to use The other way to solve this would be to convert the notebook you run with |
Beta Was this translation helpful? Give feedback.
@jencake This is a general limitation when using
jupyter magic
syntax that manipulates the ipython kernel state at runtime and using static linters.The problem is that magic commands aren't regular python code, so it does not translate to the equivalent python AST that
flake8
uses to lint code.The only way to fix this would require
flake8
to use a different AST parser that supportsjupyter magic
syntax, which I'm not aware even exists and even if I don't seeflake8
changing to it.Pretty much the same issue was opened and closed for nbQA and I have the same suggestion as @MarcoGorelli to use
# noqa
either as comment inline or via cell tags.The other way to solve this would be to conver…