diff --git a/src/airflow_serde_polars/main.py b/src/airflow_serde_polars/main.py index 790af80..6b37967 100644 --- a/src/airflow_serde_polars/main.py +++ b/src/airflow_serde_polars/main.py @@ -5,12 +5,11 @@ if TYPE_CHECKING: import polars as pl - from airflow.serialization.serde import U from airflow_serde_polars.utils.typing import AirflowSerdeResponse class Serializer(Protocol): - def __call__(self, o: object) -> AirflowSerdeResponse[U]: ... # pyright: ignore[reportUnknownParameterType] + def __call__(self, o: object) -> AirflowSerdeResponse: ... class Deserializer(Protocol): def __call__( diff --git a/src/airflow_serde_polars/utils/typing.py b/src/airflow_serde_polars/utils/typing.py index 0251e17..77a0464 100644 --- a/src/airflow_serde_polars/utils/typing.py +++ b/src/airflow_serde_polars/utils/typing.py @@ -1,12 +1,21 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Tuple +from typing import TYPE_CHECKING, Any, Dict, List, Set, Tuple, Union if TYPE_CHECKING: from typing_extensions import TypeAlias, TypeVar - T = TypeVar("T", infer_variance=True) + T = TypeVar( + "T", + infer_variance=True, + bound="AirflowSerdeType[Any]", + default="AirflowSerdeType[Any]", + ) + T2 = TypeVar("T2", infer_variance=True, bound="AirflowSerdeType", default=Any) AirflowSerdeResponse: TypeAlias = Tuple[T, str, int, bool] + AirflowSerdeType: TypeAlias = Union[ + bool, float, int, Dict[Any, T2], List[T2], str, Tuple[T2, ...], Set[T2] + ] ErrorResponse: AirflowSerdeResponse[Any] = ("", "", 0, False)