Skip to content

Commit

Permalink
Legacy union typing
Browse files Browse the repository at this point in the history
  • Loading branch information
max-muoto committed Apr 12, 2024
1 parent a02c179 commit b4a4b81
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ninja/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Tuple,
Type,
TypeVar,
Union,
overload,
)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b4a4b81

Please sign in to comment.