Coverage for src/scores/typing.py: 100%
7 statements
« prev ^ index » next coverage.py v7.3.2, created at 2024-02-28 12:51 +1100
« prev ^ index » next coverage.py v7.3.2, created at 2024-02-28 12:51 +1100
1"""
2This module contains various compound or union types which can be used across the codebase to ensure
3a consistent approach to typing is handled.
4"""
5from collections.abc import Hashable, Iterable
6from typing import Optional, Union
8import pandas as pd
9import xarray as xr
11# Flexible Dimension Types should be used for preserve_dims and reduce_dims in all
12# cases across the repository
13FlexibleDimensionTypes = Optional[Iterable[Hashable]]
15# Xarraylike data types should be used for all forecast, observed and weights
16# However currently some are specified as DataArray only
17XarrayLike = Union[xr.DataArray, xr.Dataset]
19# These type hint values *may* be used for various arguments across the
20# scores repository but are not establishing a standard or expectation beyond
21# the function they are used in
23FlexibleArrayType = Union[XarrayLike, pd.Series]