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

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

Open
4 of 5 tasks
gmishkin opened this issue Dec 11, 2024 · 3 comments
Open
4 of 5 tasks

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

gmishkin opened this issue Dec 11, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@gmishkin
Copy link

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

@gmishkin gmishkin added the bug Something isn't working label Dec 11, 2024
@bdraco
Copy link
Member

bdraco commented Dec 11, 2024

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

@gmishkin
Copy link
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.

@Dreamsorcerer
Copy link
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
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants