Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive for no-member while using torch #3510

Closed
JonOnEarth opened this issue Apr 25, 2020 · 4 comments
Closed

False positive for no-member while using torch #3510

JonOnEarth opened this issue Apr 25, 2020 · 4 comments
Assignees
Labels
Duplicate 🐫 Duplicate of an already existing issue Question

Comments

@JonOnEarth
Copy link

Hi,
I submit this issue in VScode, turn out it should be here.
You can see the discussion: microsoft/vscode-python#11213

Just as the topic said, I have tried lots of methods online, but None is effective.
One suggests add the code in pylint,''generated-members=numpy.,torch.''
Yes, it works for some code(some still have a red line), but other errors can't be marked it out either because of adding the code.
It troubled me a lot, I like VScode, but this is really annoying problem.

@Pierre-Sassoulas
Copy link
Member

@JonOnEarth , in order to fix this you, can add a file called .pylintrc at the root of your project containing this:

[MESSAGES CONTROL]

disable=
    no-member,

You can add other error messages after the comma if you want.

This is why we need to disable false positives by default in #3512

@Pierre-Sassoulas Pierre-Sassoulas self-assigned this Apr 26, 2020
@JonOnEarth
Copy link
Author

Thanks. It absolutely works. But it also can cause some other problems.
For example, some typo errors will not be pointed it out because of this no-member.

The best solution still needs pylint support Pytorch or torch I assume.

@Pierre-Sassoulas
Copy link
Member

You can also disable them one by one with # pylint: disable=no-member, if you want to keep the others.

You're right that no-member should not have false positive. It's complicated to fix because the information is contained in C binding. So the fix is probably not going to be quick. Pull request would be welcome as torch is not the only package affected by this :)

@Pierre-Sassoulas Pierre-Sassoulas changed the title pylint can't recoginize the torch, always have the red line False positive for no-member while using torch May 1, 2020
@Pierre-Sassoulas
Copy link
Member

I'm closing not because it's invalid but because we have multiple tickets regarding false positive with no-member for libraries with C-binding.

@Pierre-Sassoulas Pierre-Sassoulas added the Duplicate 🐫 Duplicate of an already existing issue label May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue Question
Projects
None yet
Development

No branches or pull requests

2 participants