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

[unused-private-member] False positives for cls used in __new__ and in __get__ #4763

Closed
stanislavlevin opened this issue Jul 28, 2021 · 1 comment
Assignees
Labels
Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code

Comments

@stanislavlevin
Copy link
Contributor

stanislavlevin commented Jul 28, 2021

Bug description

# pylint: disable=missing-docstring,invalid-name,too-few-public-methods
# pylint: disable=no-value-for-parameter,unused-argument,no-self-use
class A:
    def __new__(cls):
        print(cls.__x())

    @classmethod
    def __x(cls):
        return "__x"

class MyMeta(type):
    def __get__(cls, obj, obj_type):
        print(cls.__x(obj_type))

    def __x(cls, obj_type):
        return "__x"

Configuration

No response

Command used

python3 -m pylint a.py

Pylint output

************* Module a
a.py:8:4: W0238: Unused private member `A.__x(cls)` (unused-private-member)
a.py:15:4: W0238: Unused private member `MyMeta.__x(cls, obj_type)` (unused-private-member)

------------------------------------------------------------------

Expected behavior

There should be no error.

Pylint version

pylint 2.9.0+ (including today's main)

OS / Environment

ALTLinux

Additional dependencies

No response

@stanislavlevin stanislavlevin added Bug 🪲 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jul 28, 2021
@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jul 30, 2021
@Pierre-Sassoulas Pierre-Sassoulas changed the title [unused-private-member] bunch of another false negatives [unused-private-member] False positives for cls used in __new__ and in __get__ Jul 30, 2021
@yushao2 yushao2 self-assigned this Aug 1, 2021
@Pierre-Sassoulas
Copy link
Member

Closing as it's been fixed at some point before 2.15 or I can't reproduce anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

No branches or pull requests

3 participants