From b14fbd9394a6195680150327d3c10fcb176bbc5f Mon Sep 17 00:00:00 2001 From: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> Date: Sat, 23 Sep 2023 12:38:05 -0700 Subject: [PATCH] Add a `Literal` typing (#8227) * Add a `Literal` typing --- xarray/core/computation.py | 2 +- xarray/tests/test_computation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xarray/core/computation.py b/xarray/core/computation.py index 971f036b394..bae779af652 100644 --- a/xarray/core/computation.py +++ b/xarray/core/computation.py @@ -893,7 +893,7 @@ def apply_ufunc( dataset_fill_value: object = _NO_FILL_VALUE, keep_attrs: bool | str | None = None, kwargs: Mapping | None = None, - dask: str = "forbidden", + dask: Literal["forbidden", "allowed", "parallelized"] = "forbidden", output_dtypes: Sequence | None = None, output_sizes: Mapping[Any, int] | None = None, meta: Any = None, diff --git a/xarray/tests/test_computation.py b/xarray/tests/test_computation.py index b75e80db2da..87f8328e441 100644 --- a/xarray/tests/test_computation.py +++ b/xarray/tests/test_computation.py @@ -1190,7 +1190,7 @@ def test_apply_dask() -> None: # unknown setting for dask array handling with pytest.raises(ValueError): - apply_ufunc(identity, array, dask="unknown") + apply_ufunc(identity, array, dask="unknown") # type: ignore def dask_safe_identity(x): return apply_ufunc(identity, x, dask="allowed")