home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 1137623370

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/6142#issuecomment-1137623370 https://api.github.com/repos/pydata/xarray/issues/6142 1137623370 IC_kwDOAMm_X85DzsFK 43316012 2022-05-25T17:40:16Z 2022-05-25T17:40:16Z COLLABORATOR

I have encountered another problem that is related to this: DataArray.argmins dim argument is: Hashable | Sequence[Hashable] | None, where None is a special case that will apply over all dimensions.

So I tried to overload this: ```python @overload def argmin( self, dim: Hashable, *, axis: int | None = None, keep_attrs: bool | None = None, skipna: bool | None = None, ) -> DataArray: ...

@overload
def argmin(
    self,
    dim: Sequence[Hashable] | None = None,
    axis: int | None = None,
    keep_attrs: bool | None = None,
    skipna: bool | None = None,
) -> dict[Hashable, DataArray]:
    ...

``` but mypy complains:

Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]

I suspect that this is due to the fact that None is actually Hashable and therefore a valid dimension.

Unfortunately, using this proposal of str | Sequence[Hashable] won't work since str is actually a Sequence of Hashables... (I know that this proposal is meant for functions that always expect multiple dims and the str is only a lazy mans shortcut)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1094725752
Powered by Datasette · Queries took 0.435ms · About: xarray-datasette