Skip to content

Conversation

@jl-wynen
Copy link
Member

No description provided.

DataArray.drop_attrs = _deprecated_drop_attrs
DataArray.attrs = property(_deprecated_attrs) # type: ignore[assignment, method-assign]
DataArray.meta = property(_deprecated_meta) # type: ignore[assignment, method-assign]
DataArray.drop_attrs = _deprecated_drop_attrs # type: ignore[assignment, method-assign]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mypy doesn't like this because cpp_classes.pyi lists all methods of Dataarray, etc. and we are not allowed to assign to methods. However, at runtime, these methods don't exist before the assignments here. So we just need to silence mypy and make it use the stubs instead.

structured, # type: ignore[name-defined]
trigonometry, # type: ignore[name-defined]
unary, # type: ignore[name-defined]
variable, # type: ignore[name-defined]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mypy doesn't like that we delete modules here. But it's fine at runtime.

Copy link
Member

@SimonHeybrock SimonHeybrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

Comment on lines +198 to +199
meta: dict[str, dict[str, Variable]] = {"coords": {}, "masks": {}, "attrs": {}}
for key in meta.keys():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting we are still using the deprecated attribute meta here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aren't? meta is a local variable. But we do still use attrs which we should now remove.

@jl-wynen jl-wynen enabled auto-merge December 20, 2024 08:24
@jl-wynen jl-wynen merged commit 7b209d6 into main Dec 20, 2024
4 checks passed
@jl-wynen jl-wynen deleted the appease-mypy branch December 20, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants