PSMList.__setitem__ is typed to accept Sequence[...], but np.ndarray does not formally implement collections.abc.Sequence. This causes type checkers (ty, pyright) to flag valid assignments like:
psm_list["retention_time"] = np.array(predictions, dtype=np.float32)
with:
Argument of type "NDArray[floating[_32Bit]]" cannot be assigned to parameter "values"
of type "Sequence[Unknown]"
This works fine at runtime. The fix would be to widen the type annotation to accept ArrayLike, np.ndarray, or Sequence in __setitem__.
PSMList.__setitem__is typed to acceptSequence[...], butnp.ndarraydoes not formally implementcollections.abc.Sequence. This causes type checkers (ty, pyright) to flag valid assignments like:with:
This works fine at runtime. The fix would be to widen the type annotation to accept
ArrayLike,np.ndarray, orSequencein__setitem__.