How do I get PyLint to recognize numpy members?

前端 未结 22 1044
南旧
南旧 2020-11-28 20:29

I am running PyLint on a Python project. PyLint makes many complaints about being unable to find numpy members. How can I avoid this while avoiding skipping membership check

22条回答
  •  温柔的废话
    2020-11-28 20:54

    I had the same problem with a different module (kivy.properties) which is a wrapped C module like numpy.

    Using VSCode V1.38.0, the accepted solution stopped all linting for the project. So, while it did indeed remove the false-positive no-name-in-module, it didn't really improve the situation.

    The best workaround for me was to use the --ignored-modules argument on the offending module. Trouble is, passing any argument via python.linting.pylintArgs wipes out the default VSCode settings, so you need to re-set those also. That left me with the following settings.json file:

    {
        "python.pythonPath": "C:\\Python\\Python37\\python.exe",
        "python.linting.pylintEnabled": true,
        "python.linting.enabled": true,
        "python.linting.pylintArgs": [
            "--ignored-modules=kivy.properties",
            "--disable=all",
            "--enable=F,E,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode"
        ]
    }
    

提交回复
热议问题