Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
max-muoto committed Apr 12, 2024
1 parent 2144df1 commit 76e5558
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ninja/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@ def my_view(request):
def _is_view_func(func: Any) -> TypeGuard[ViewFn[Req, P]]:
return inspect.isfunction(func_or_pgn_class)

isnotset = func_or_pgn_class == NOT_SET
isno tset = func_or_pgn_class == NOT_SET

pagination_class: Type[PaginationBase] = import_string(settings.PAGINATION_CLASS)

if _is_view_func(func_or_pgn_class):
return inject_pagination(func_or_pgn_class, pagination_class)

# Second check is redundant, but `TypeGuard` does narrow the negative case.
# Second check is redundant, but `TypeGuard` doesn't narrow the negative case.
# `TypeIs` should resolve this: https://peps.python.org/pep-0742/
if not isnotset and isinstance(func_or_pgn_class, type):
pagination_class = func_or_pgn_class
Expand Down

0 comments on commit 76e5558

Please sign in to comment.