From 0e382f71d0eec610241e57628cea43ac201f4d9d Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Mon, 4 Dec 2023 22:39:59 -0700 Subject: [PATCH] fixes --- cf_xarray/accessor.py | 4 ++-- cf_xarray/criteria.py | 2 +- cf_xarray/tests/test_accessor.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cf_xarray/accessor.py b/cf_xarray/accessor.py index 78673d77..7d249871 100644 --- a/cf_xarray/accessor.py +++ b/cf_xarray/accessor.py @@ -108,7 +108,7 @@ def apply_mapper( """ if not isinstance(key, Hashable): - if default is None: + if default is None: # type: ignore[unreachable] raise ValueError( "`default` must be provided when `key` is not not a valid DataArray name (of hashable type)." ) @@ -858,7 +858,7 @@ def check_results(names, key): ds = ds.reset_coords()[varnames + coords] if isinstance(obj, DataArray): if scalar_key: - if len(ds.variables) == 1: + if len(ds.variables) == 1: # type: ignore[unreachable] # single dimension coordinates assert coords assert not varnames diff --git a/cf_xarray/criteria.py b/cf_xarray/criteria.py index f287e5de..76299520 100644 --- a/cf_xarray/criteria.py +++ b/cf_xarray/criteria.py @@ -7,7 +7,7 @@ try: import regex as re except ImportError: - import re # type: ignore + import re # type: ignore[no-redef] from collections.abc import Mapping, MutableMapping from typing import Any diff --git a/cf_xarray/tests/test_accessor.py b/cf_xarray/tests/test_accessor.py index ea3dfbc6..05cdeb2f 100644 --- a/cf_xarray/tests/test_accessor.py +++ b/cf_xarray/tests/test_accessor.py @@ -1489,7 +1489,7 @@ def test_new_standard_name_mappers() -> None: ) assert_identical(forecast.cf.chunk({"realization": 1}), forecast.chunk({"M": 1})) assert_identical(forecast.cf.isel({"realization": 1}), forecast.isel({"M": 1})) - assert_identical(forecast.cf.isel(**{"realization": 1}), forecast.isel(**{"M": 1})) + assert_identical(forecast.cf.isel(realization=1), forecast.isel(M=1)) assert_identical( forecast.cf.groupby("forecast_reference_time.month").mean(), forecast.groupby("S.month").mean(),