-
Notifications
You must be signed in to change notification settings - Fork 21
Appease mypy some more #3624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Appease mypy some more #3624
Conversation
| 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] |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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.
SimonHeybrock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 👍
| meta: dict[str, dict[str, Variable]] = {"coords": {}, "masks": {}, "attrs": {}} | ||
| for key in meta.keys(): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
a73406c to
aff8c8a
Compare
No description provided.