From a47363cf94e3f2d74fe2e2d2b960f0f3064e1e24 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 22:47:07 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xarray/conventions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xarray/conventions.py b/xarray/conventions.py index acbba4b839d..f92c2691943 100644 --- a/xarray/conventions.py +++ b/xarray/conventions.py @@ -2,7 +2,7 @@ from collections import defaultdict from collections.abc import Hashable, Iterable, Mapping, MutableMapping -from typing import TYPE_CHECKING, Any, Literal, Union, TypeVar +from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union import numpy as np import pandas as pd @@ -383,7 +383,10 @@ def _update_bounds_encoding(variables: T_Variables) -> None: if "calendar" in encoding: bounds_encoding.setdefault("calendar", encoding["calendar"]) + T = TypeVar("T") + + def _item_or_default(obj: Mapping[Any, T] | T, key: Hashable, default: T = None) -> T: """ Return item by key if obj is mapping and key is present, else return default value.