Skip to content

pyright: operator not supported for NDArray #41

Open
@swarn

Description

@swarn

Given this code:

# pyright: reportInvalidTypeArguments=false

from numpydantic import NDArray, Shape


def f(
    x: NDArray[Shape["2"], float],  # noqa: F722
    y: NDArray[Shape["2"], float],  # noqa: F722
):
    return x + y

Pyright warns for the return x + y statement:

Diagnostics:
1. Operator "+" not supported for types "NDArray" and "NDArray"
     Operator "+" not supported for types "H5ArrayPath" and "H5Proxy"
     Operator "+" not supported for types "Tuple[Path | str, str]" and "H5Proxy"
     Operator "+" not supported for types "H5Proxy" and "H5ArrayPath"
     Operator "+" not supported for types "H5Proxy" and "Tuple[Path | str, str]"
     Operator "+" not supported for types "H5Proxy" and "H5Proxy" [reportOperatorIssue]

Have I missed some obvious documentation?

numpydantic 1.6.6
pyright 1.1.391
pydantic 2.9.2
python 3.12.6

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