microsoft / pyright

Static Type Checker for Python
Other
13.16k stars 1.41k forks source link

Property method "fget" is incompatible #9059

Open Hocnonsense opened 4 hours ago

Hocnonsense commented 4 hours ago

Describe the bug When I use pyright to check each of my file, nothing happened; But when I check the folder, error occurs.

Code or Screenshots runs and outputs from github action:

/home/runner/work/pymummer/pymummer/pymummer/pair.py
  /home/runner/work/pymummer/pymummer/pymummer/pair.py:45:9 - error: "seq2" incorrectly overrides property of same name in class "AlignContig2"
    Property method "fget" is incompatible
      Parameter 1 name mismatch: base parameter is named "self", override parameter is named "cls" (reportIncompatibleMethodOverride)
1 error, 0 warnings, 0 informations 

But the line pyright point out is (45-47):

    def __call__(self, cls):
        self.cls = cls
        return self

all pythin files are in https://github.com/Hocnonsense/pymummer/tree/dd7b5c1a4099aa6ad7846876c08f1e21c6b5a0bf

VS Code extension or command-line Using the command-line tool, version 1.1.381

erictraut commented 2 hours ago

I'll need some additional information from you to repro the problem. I cloned your repo, and I'm not seeing the behavior you're reporting. That means there are some details that I'm missing.

Have you tried to reproduce the behavior with a clean virtual environment? What packages do you have installed?

I don't see any pyproject.toml or pyrightconfig.json file in your repo. Are you using default configuration settings for pyright?

Hocnonsense commented 2 hours ago

Sure, i've used the default settings. I'd just create a new environment with mamba: mamba create -n pyright "python=3.12" pyright, and clone the reposity again git clone https://github.com/Hocnonsense/pymummer; cd pymummer. Then I've got the pair.py:45:9 - error again.

Do you have any idea? Thanks for your help!

erictraut commented 1 hour ago

Thanks, I was able to repro the problem and fix it. Pyright is correct in generating this error, but it's reporting it in the wrong location. It should be associated with the DeltaContig2.seq2 method.

This will be fixed in the next release.