4

I am using pylint for code linting (inside VS Code with pylint 2.3.1, astroid 2.2.5, Python 3.6.2).

The behavior can be reproduced with the following snippet:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from http import HTTPStatus

print(HTTPStatus.NOT_ACCEPTABLE.phrase)

Linting this snippet by calling

$ pylint snippet.py 

gives the following error message:

E1101: Instance of 'NOT_ACCEPTABLE' has no 'phrase' member (no-member)

However, I think .phrase is a member of the given instance since the code is working, prints the desired result and .phrase is referenced in the docs. Which leads to the assumption that the error message is a false positive.

I then had a look at the pylint configuration options in its own documentation and in the VS Code docs and generated a .pylintrc file by executing

pylint --generate-rcfile > .pylintrc

Inside this configuration file I was able to find the following line:

enable=c-extension-no-member

Commenting out this line and thus disabling the c-extension-no-member checks, the false positive E1101 error message is suppressed. However, I am still wondering whether this is just a workaround or a real false positive, since it disables all c-extension-no-member checks and seems to be unsuitable for a general approach. For sure, one can specify specific modules to ignore on performing the checks, but I just want to know the reason for this error message.

albert
  • 8,027
  • 10
  • 48
  • 84

0 Answers0