Skip to content
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

Fix polyval overloads #7315

Merged
merged 2 commits into from
Nov 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Bug fixes

- Import ``nc_time_axis`` when needed (:issue:`7275`, :pull:`7276`).
By `Michael Niklas <https://github.com/headtr1ck>`_.
- Fix static typing of :py:meth:`xr.polyval` (:issue:`7312`, :pull:`7315`).
By `Michael Niklas <https://github.com/headtr1ck>`_.

Documentation
~~~~~~~~~~~~~
Expand Down
16 changes: 12 additions & 4 deletions xarray/core/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1876,22 +1876,30 @@ def where(cond, x, y, keep_attrs=None):


@overload
def polyval(coord: DataArray, coeffs: DataArray, degree_dim: Hashable) -> DataArray:
def polyval(
coord: DataArray, coeffs: DataArray, degree_dim: Hashable = "degree"
) -> DataArray:
...


@overload
def polyval(coord: DataArray, coeffs: Dataset, degree_dim: Hashable) -> Dataset:
def polyval(
coord: DataArray, coeffs: Dataset, degree_dim: Hashable = "degree"
) -> Dataset:
...


@overload
def polyval(coord: Dataset, coeffs: DataArray, degree_dim: Hashable) -> Dataset:
def polyval(
coord: Dataset, coeffs: DataArray, degree_dim: Hashable = "degree"
) -> Dataset:
...


@overload
def polyval(coord: Dataset, coeffs: Dataset, degree_dim: Hashable) -> Dataset:
def polyval(
coord: Dataset, coeffs: Dataset, degree_dim: Hashable = "degree"
) -> Dataset:
...


Expand Down