Skip to content

Conversation

@Thijss
Copy link
Member

@Thijss Thijss commented Oct 24, 2025

In projects that use power-grid-model-ds as a dependency, I noticed that the type inferred by pyright when using e.g.node_array['id'] is NodeArray, whereas NDArray[int] is expected.

This change seems to fix that, while I don't really understand why:

Reason I don't fully understand it:

If I change

    @overload
    def __getitem__(self: Self, item: str | list | tuple) -> NDArray[Any]: ...

to:

    @overload
    def __getitem__(self: Self, item: str | list | tuple) -> None: ...

(or any other output type)

then:
pyright is also happy...

Also in both cases (with and without this PR)
reveal_type(node['id']) results in np.ndarray

Seems strange to me...

@sonarqubecloud
Copy link

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants