Skip to content

PSMList.__setitem__ should accept np.ndarray values #144

@RalfG

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

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