Skip to content

Decorator doesn't look like a property decorator to pylint #81

Closed

Description

@gmishkin

Please confirm the following

  • I understand this is open source software provided for free and that I might not receive a timely response.
  • I am positive I am NOT reporting a (potential) security
    vulnerability, to the best of my knowledge. (These must be shared by
    submitting this report form instead, if
    any hesitation exists.)
  • I am willing to submit a pull request with reporoducers as xfailing test cases or even entire fix. (Assign this issue to me.)

Describe the bug

With pylint 3.3.2, the following comparison-with-callable warning is fired when using propcache'd properties, presumably because although it tries to exclude property decorators, the propcache decorator doesn't look enough like one (doesn't inherit it?) to exclude it.

To Reproduce

  1. With the expression in the latest yarl which uses propcache: url.scheme == "https" and url.host == "github.com"
  2. When running pylint
  3. You get the error: Comparing against a callable, did you omit the parenthesis? : *comparison-with-callable*

Expected behavior

I don't know if this is on you or pylint to fix but I figure it's not reasonable to expect pylint to know about non-standard property decorators. Is there anything you can do on your end to make it look like a regular property decorator to pylint, or do I just need to suppress this check when using

Logs/tracebacks

************* Module deployment_helper
R: 35,0: DeploymentHelper: Too few public methods (1/2) : *too-few-public-methods*
W:182,15: DroneHelper._get_owner_repo: Comparing against a callable, did you omit the parenthesis? : *comparison-with-callable*
W:182,41: DroneHelper._get_owner_repo: Comparing against a callable, did you omit the parenthesis? : *comparison-with-callable*


### Python Version

```console
$ python --version
3.12.1

propcache Version

$ python -m pip show propcache
0.2.1

OS

macOS, Linux

Additional context

https://github.com/pylint-dev/pylint/blob/cb125773cfd83005455ed55d0710e375720b1ff9/pylint/checkers/base/comparison_checker.py#L280 presumably

Activity

  1. added
    bug
    on Dec 11, 2024
  2. bdraco commented on Dec 11, 2024

    @bdraco
    Member

    Looks like its related to this issue pylint-dev/pylint#3484

  3. gmishkin commented on Dec 11, 2024

    @gmishkin
    Author

    Ah thanks, I knew I should've searched pylint issues for that "constant" keyword too since I saw it referenced in the problematic looking block of code. Dunno why I missed it. Thanks for looking and feel free to resolve then.

  4. Dreamsorcerer commented on Dec 12, 2024

    @Dreamsorcerer
    Member

    Isn't that issue just because the library wasn't installed? Sounds to me like it should work if propcache is installed while type checking..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions