Closed suvayu closed 4 months ago
all downstream use looks like this:
instance.values.<dict_method call>
instead ofinstance.<dict_method_call>
Actually, this seems to be mixed! Some parts of the code does use the instance.<dict_method_call>
, and other places use instance.values.<dict_method call>
.
That override seems weird indeed. Somehow we got away with it all those years. I will see what happens if I try to remove the override and fix any upcoming errors, unless @jdswinbank has a different perspective on this problem.
I have no immediate recollection of this. I could dig into the code, but I'm not sure it would teach us much. If you can successfully fix the errors Hanno, please go for it!
Description
Output from mypy
The implementation is inconsistent. While it inherits from
collections.abc.MutableMapping
, it doesn't respect the mapping APIProblem is here (the first error above): https://github.com/transientskp/pyse/blob/1de96f08469410abccd9e7a973f89d963faa4c2a/sourcefinder/extract.py#L244-L255
For example, in the line mentioned in the error above, it should not be overriding the
values()
method. AFAIU, the implementation stores it's data as a regulardict
inParamSet.values
, and all downstream use looks like this:instance.values.<dict_method call>
instead ofinstance.<dict_method_call>
.Resolution
Either
MutableMapping
should be removed.Or the implementation should be fixed to reflect the Python mapping API.