From b4a4b81fcf2c056a095f0af83ceff032161fd099 Mon Sep 17 00:00:00 2001 From: Maxwell Muoto Date: Thu, 11 Apr 2024 21:52:13 -0500 Subject: [PATCH] Legacy union typing --- ninja/pagination.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ninja/pagination.py b/ninja/pagination.py index a7ec5aec..9274fc01 100644 --- a/ninja/pagination.py +++ b/ninja/pagination.py @@ -11,6 +11,7 @@ Tuple, Type, TypeVar, + Union, overload, ) @@ -124,16 +125,16 @@ def paginate( @overload def paginate( - func_or_pgn_class: Type[PaginationBase] | NOT_SET_TYPE = NOT_SET, + func_or_pgn_class: Union[Type[PaginationBase], NOT_SET_TYPE] = NOT_SET, **paginator_params: Any, ) -> Callable[[ViewFn[Req, P]], PaginatedViewFn[Req, P]]: ... def paginate( - func_or_pgn_class: ViewFn[Req, P] | Type[PaginationBase] | NOT_SET_TYPE = NOT_SET, + func_or_pgn_class: Union[ViewFn[Req, P], Type[PaginationBase], NOT_SET_TYPE] = NOT_SET, **paginator_params: Any, -) -> PaginatedViewFn[Req, P] | Callable[[ViewFn[Req, P]], PaginatedViewFn[Req, P]]: +) -> Union[PaginatedViewFn[Req, P], Callable[[ViewFn[Req, P]], PaginatedViewFn[Req, P]]]: """ @api.get(... @paginate