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

typing annotations #692

Merged
merged 25 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,21 @@ repos:
rev: v5.6.4
hooks:
- id: isort

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
hooks:
- id: mypy
# `asv_bench` are copied from setup.cfg.
# `_typed_ops.py` is added since otherwise mypy will complain (but notably only in pre-commit)
exclude: "asv_bench"
additional_dependencies: [
# Type stubs
types-python-dateutil,
types-pkg_resources,
types-PyYAML,
types-pytz,
typing-extensions==3.10.0.0,
# Dependencies that are typed
numpy,
]
4 changes: 1 addition & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ New Features
:py:meth:`~climpred.classes.PerfectModelEnsemble.bootstrap` to group skill by
initializations seasonality. (:issue:`635`, :pr:`690`) `Aaron Spring`_.

Documentation
-------------

Internals/Minor Fixes
---------------------
- Reduce dependencies (:pr:`686`) `Aaron Spring`_.
- Add `typing <https://docs.python.org/3/library/typing.html>`_ (:issue:`685`, :pr:`692`) `Aaron Spring`_.


climpred v2.1.6 (2021-08-31)
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/climpred-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies:
- black==19.10b0
- coveralls
- flake8
#- importlib_metadata
- mypy
- isort
- pre-commit
- pylint
Expand Down
5 changes: 4 additions & 1 deletion climpred/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,10 @@ def warn_if_chunking_would_increase_performance(ds, crit_size_in_MB=100):
)


def _check_valid_reference(reference):
from typing import List, Optional, Union


def _check_valid_reference(reference: Optional[Union[List[str], str]]) -> List:
"""Enforce reference as list and check for valid entries."""
if reference is None:
reference = []
Expand Down
Loading