From 0eac740514ba5e08bf5208b430ccc0b23b17c18f Mon Sep 17 00:00:00 2001 From: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> Date: Fri, 12 Jul 2024 17:52:32 -0700 Subject: [PATCH 1/2] Allow mypy to run in vscode (#9239) Seems to require adding an exclude for `build` and an `__init__.py` file in the `properties` directory... --- properties/__init__.py | 0 pyproject.toml | 1 + 2 files changed, 1 insertion(+) create mode 100644 properties/__init__.py diff --git a/properties/__init__.py b/properties/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pyproject.toml b/pyproject.toml index 2ada0c1c171..4704751b445 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,6 +87,7 @@ exclude_lines = ["pragma: no cover", "if TYPE_CHECKING"] [tool.mypy] enable_error_code = "redundant-self" exclude = [ + 'build', 'xarray/util/generate_.*\.py', 'xarray/datatree_/doc/.*\.py', ] From 0f1e4328346d8a0e33e112bbf23de9cd8d358f67 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 13 Jul 2024 10:06:17 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xarray/conventions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xarray/conventions.py b/xarray/conventions.py index 50d066f1f7c..76171c060dd 100644 --- a/xarray/conventions.py +++ b/xarray/conventions.py @@ -387,7 +387,9 @@ def _update_bounds_encoding(variables: T_Variables) -> None: T = TypeVar("T") -def _item_or_default(obj: Mapping[Any, T] | T, key: Hashable, default: T | None = None) -> T: +def _item_or_default( + obj: Mapping[Any, T] | T, key: Hashable, default: T | None = None +) -> T: """ Return item by key if obj is mapping and key is present, else return default value. """