Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Pylint: false positives on member existence for internal classes #1871

Open
reidpr opened this issue Mar 22, 2024 · 0 comments
Open

Pylint: false positives on member existence for internal classes #1871

reidpr opened this issue Mar 22, 2024 · 0 comments

Comments

@reidpr
Copy link
Collaborator

reidpr commented Mar 22, 2024

Split from #1860. Pylint:

  • E1101 no-member
  • W0201 attribute-defined-outside-init

We get E1101 quite a lot, e.g.:

if ( stat.S_ISREG(fm.mode)
or stat.S_ISLNK(fm.mode)
or stat.S_ISFIFO(fm.mode)):

return super().sid_input + self.src_metadata

In all these cases, the member does exist but it’s set in a strange way. This lint error is very powerful, so I want to make it useful. This issue is to eliminate the false positives so we can enable the message.

Similarly for W0201:

if (not (hasattr(self, "size"))):
self.size = -1

This warning basically says that there is no list of attributes that can be consulted, expecting that in __init__(). For this particular class there is a nice comment explaining all the attributes, but some of them are also set to None in __init__(). Probably should fix all these warnings.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant