Pylint cannot recognize gmpy2 members

133 views Asked by At

I use pylint and gmpy2 on Kali Linux(WSL2). Pylint makes many complaints about being unable to find gmpy2 members. How can I avoid this?

Here is a little example:

import gmpy2
print(gmpy2.is_even(6))

And the result of pylint is

tst.py:2:6: E1101: Module 'gmpy2' has no 'is_even' member (no-member)

I also tried this on ArchLinux, the result is the same.

1

There are 1 answers

0
FantasqueX On BEST ANSWER

According to the document

If you are getting the dreaded no-member error, there is a possibility that either pylint found a bug in your code or that it actually tries to lint a C extension module.

Linting C extension modules is not supported out of the box, especially since pylint has no way to get an AST object out of the extension module.

You should add extension-pkg-whitelist argument in command line or the pylintrc file.

Here is the original issue I opened in the Github.