transientskp / pyse

Python Source Extractor
BSD 2-Clause "Simplified" License
11 stars 5 forks source link

Errors highlighted by `mypy` #82

Closed suvayu closed 3 weeks ago

suvayu commented 1 month ago
$ hatch run lint:mypy --install-types --non-interactive --pretty 
sourcefinder/utility/containers.py:55: error: Signatures of "__iadd__" and "__add__" are incompatible  [misc]
        def __iadd__(self, y):
        ^
sourcefinder/accessors/lofarhdf5image.py:61: error: "LofarHdf5Image" has no attribute "header"  [attr-defined]
            return self.header
                   ^~~~~~~~~~~
sourcefinder/image.py:1181: error: "ParamSet" has no attribute "sig"  [attr-defined]
                    param.sig = maxis[count] / self.rmsmap.data[tuple(maxposs[count])]
                    ^~~~~~~~~
Found 3 errors in 3 files (checked 30 source files)
HannoSpreeuw commented 1 month ago

Allright. The latter error is from a snippet of code that converts source measurements as floats in Numpy.ndarrays into extract.Detection instances which is the format that our unit tests accept. As long as we have not adapted the unit tests to accept a new format for the source measurements, this conversion has to stay in place.

But for now I can probably fix it using

param["sig"] = maxis[count] / self.rmsmap.data[tuple(maxposs[count])]
HannoSpreeuw commented 1 month ago

The first and second one I could fix by removing the corresponding methods.

HannoSpreeuw commented 3 weeks ago

Fixed through PR #85