How do I get PyLint to recognize numpy members?

前端 未结 22 1120
南旧
南旧 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:57

    I was getting the same error for a small numpy project I was working on and decided that ignoring the numpy modules would do just fine. I created a .pylintrc file with:

    $ pylint --generate-rcfile > ~/.pylintrc

    and following paduwan's and j_houg's advice I modified the following sectors:

    [MASTER]
    
    # A comma-separated list of package or module names from where C extensions may
    # be loaded. Extensions are loading into the active Python interpreter and may
    # run arbitrary code
    extension-pkg-whitelist=numpy
    

    and

    [TYPECHECK]
    
    # List of module names for which member attributes should not be checked
    # (useful for modules/projects where namespaces are manipulated during runtime
    # and thus existing member attributes cannot be deduced by static analysis. It
    # supports qualified module names, as well as Unix pattern matching.
    ignored-modules=numpy
    
    # List of classes names for which member attributes should not be checked
    # (useful for classes with attributes dynamically set). This supports can work
    # with qualified names.
    ignored-classes=numpy
    

    and it "fixed" my issue.

提交回复
热议问题