Skip to content

PSMList.__setitem__ should accept np.ndarray values #144

Description

@RalfG

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__.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions