From 2669a9ce402192bf593c20505f6ee80e6a8e79ba Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Fri, 17 Jan 2025 19:02:55 +0100 Subject: [PATCH] Revert "Remove more typing" This reverts commit d5c39ca5bafd6bffff624cdcb1f53605e791bf8a. --- audformat/core/column.py | 2 +- audformat/core/typing.py | 45 ++++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/audformat/core/column.py b/audformat/core/column.py index 7cfc0f2f..d4d90574 100644 --- a/audformat/core/column.py +++ b/audformat/core/column.py @@ -1,4 +1,4 @@ -from __future__ import annotations +from __future__ import annotations # allow typing without string import typing import warnings diff --git a/audformat/core/typing.py b/audformat/core/typing.py index ab1c00e2..08217e25 100644 --- a/audformat/core/typing.py +++ b/audformat/core/typing.py @@ -1,27 +1,32 @@ from __future__ import annotations -from collections.abc import Sequence +import typing import numpy as np import pandas as pd -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 -) +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, +]