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 invalid-overridden-method with abc.abstractproperty #3150

Closed
vojtechtrefny opened this issue Oct 1, 2019 · 3 comments
Closed
Labels

Comments

@vojtechtrefny
Copy link

Steps to reproduce

import abc

class A():

    @abc.abstractproperty
    def prop(self):
        return

class B(A):

    @property
    def prop(self):
        return

Current behavior

test.py:12:4: W0236: Method 'prop' was expected to be 'method', found it instead as 'property' (invalid-overridden-method)

Expected behavior

No warning.

pylint --version output

$ pylint-3 --version
pylint 2.4.1
astroid 2.3.0
Python 3.8.0b4 (default, Aug 30 2019, 00:00:00) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
@PCManticore PCManticore added this to the Next minor release milestone Oct 3, 2019
@PCManticore
Copy link
Contributor

Thank you, makes sense.

@scop
Copy link
Contributor

scop commented Oct 5, 2019

Hit this myself too, but with a somewhat different (?) scenario involving a nested property, posting here just in case it's not the same:

$ cat t.py 
def my_property(func):
    @property
    def _wrapper(self):
        pass
    return _wrapper

class A:
    @property
    def foo():
        return True

class B(A):
    @my_property
    def foo():
        return False

$ pylint t.py | grep invalid-overridden-method
t.py:14:4: W0236: Method 'foo' was expected to be 'property', found it instead as 'method' (invalid-overridden-method)

balloob pushed a commit to home-assistant/core that referenced this issue Oct 7, 2019
* Upgrade pylint to 2.4.2 and astroid to 2.3.1

https://pylint.readthedocs.io/en/latest/whatsnew/2.4.html
https://pylint.readthedocs.io/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-4-1
https://pylint.readthedocs.io/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-4-2

* unnecessary-comprehension fixes

* invalid-name fixes

* self-assigning-variable fixes

* Re-enable not-an-iterable

* used-before-assignment fix

* invalid-overridden-method fixes

* undefined-variable __class__ workarounds

pylint-dev/pylint#3090

* no-member false positive disabling

* Remove some no longer needed disables

* using-constant-test fix

* Disable import-outside-toplevel for now

* Disable some apparent no-value-for-parameter false positives

* invalid-overridden-method false positive disables

pylint-dev/pylint#3150

* Fix unintentional Entity.force_update override in AfterShipSensor
@PCManticore PCManticore modified the milestones: Next minor release, Next bug fix release Oct 9, 2019
@scop
Copy link
Contributor

scop commented Apr 16, 2021

Hit this myself too, but with a somewhat different (?) scenario involving a nested property, posting here just in case it's not the same:

This one's still open, re-reported as #4368

mtdcr pushed a commit to mtdcr/homeassistant-onkyo-legacy that referenced this issue Sep 14, 2024
* Upgrade pylint to 2.4.2 and astroid to 2.3.1

https://pylint.readthedocs.io/en/latest/whatsnew/2.4.html
https://pylint.readthedocs.io/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-4-1
https://pylint.readthedocs.io/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-4-2

* unnecessary-comprehension fixes

* invalid-name fixes

* self-assigning-variable fixes

* Re-enable not-an-iterable

* used-before-assignment fix

* invalid-overridden-method fixes

* undefined-variable __class__ workarounds

pylint-dev/pylint#3090

* no-member false positive disabling

* Remove some no longer needed disables

* using-constant-test fix

* Disable import-outside-toplevel for now

* Disable some apparent no-value-for-parameter false positives

* invalid-overridden-method false positive disables

pylint-dev/pylint#3150

* Fix unintentional Entity.force_update override in AfterShipSensor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants