diff --git a/audformat/core/column.py b/audformat/core/column.py index d4d90574..7cfc0f2f 100644 --- a/audformat/core/column.py +++ b/audformat/core/column.py @@ -1,4 +1,4 @@ -from __future__ import annotations # allow typing without string +from __future__ import annotations import typing import warnings diff --git a/audformat/core/typing.py b/audformat/core/typing.py index 08217e25..ab1c00e2 100644 --- a/audformat/core/typing.py +++ b/audformat/core/typing.py @@ -1,32 +1,27 @@ from __future__ import annotations -import typing +from collections.abc import Sequence import numpy as np import pandas as pd -Files = typing.Union[ - str, - typing.Sequence[str], - pd.Index, - pd.Series, -] -Timestamps = typing.Union[ - float, - int, - str, - pd.Timedelta, - typing.Sequence[typing.Union[float, int, str, pd.Timedelta]], - pd.Index, - pd.Series, -] -Values = typing.Union[ - int, - float, - str, - pd.Timedelta, - typing.Sequence[typing.Union[int, float, str, pd.Timedelta],], - np.ndarray, - pd.Series, -] +Files = str | Sequence[str] | pd.Index | pd.Series +Timestamps = ( + float + | int + | str + | pd.Timedelta + | Sequence[float | int | str | pd.Timedelta] + | pd.Index + | pd.Series +) +Values = ( + int + | float + | str + | pd.Timedelta + | Sequence[int | float | str | pd.Timedelta] + | np.ndarray + | pd.Series +)