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 type hints for Python versions < 3.10 #1897

Merged
merged 14 commits into from
Feb 2, 2023
1 change: 1 addition & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
push:
branches:
- main
- mypy-python-version
# run the test only if the PR is to main
# turn it on if required
#pull_request:
Expand Down
6 changes: 3 additions & 3 deletions esmvalcore/_recipe/from_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import re
from copy import deepcopy
from functools import partial
from typing import TYPE_CHECKING, Any, Iterable, Mapping, Sequence
from typing import TYPE_CHECKING, Any, Dict, Iterable, Mapping, Sequence

from nested_lookup import nested_delete

Expand All @@ -17,8 +17,8 @@

logger = logging.getLogger(__name__)

Recipe = dict[str, Any]
Facets = dict[str, Any]
Recipe = Dict[str, Any]
Facets = Dict[str, Any]


def _datasets_to_raw_recipe(datasets: Iterable[Dataset]) -> Recipe:
Expand Down
4 changes: 2 additions & 2 deletions esmvalcore/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from copy import deepcopy
from fnmatch import fnmatchcase
from pathlib import Path
from typing import Any, Iterator, Sequence
from typing import Any, Iterator, Sequence, Union

from iris.cube import Cube

Expand Down Expand Up @@ -39,7 +39,7 @@

logger = logging.getLogger(__name__)

File = esgf.ESGFFile | local.LocalFile
File = Union[esgf.ESGFFile, local.LocalFile]


def _augment(base: dict, update: dict):
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ include_trailing_comma = true

[mypy]
# see mypy.readthedocs.io/en/stable/command_line.html
python_version = 3.9
ignore_missing_imports = True
files = esmvalcore, tests

Expand Down