Coverage for src/typedal/types.py: 100%

1"""

2 Stuff to make mypy happy.

3"""

4 from typing import Any, Optional, TypedDict

5

6 from pydal.objects import Expression as _Expression

7 from pydal.objects import Field as _Field

8 from pydal.objects import Query as _Query

9

10

11 class Query(_Query): # type: ignore

12 """

13 Pydal Query object.

14

15 Makes mypy happy.

16 """

17

18

19 class Expression(_Expression): # type: ignore

20 """

21 Pydal Expression object.

22

23 Make mypy happy.

24 """

25

26

27 class Field(_Field):

28 """

29 Pydal Field object.

30

31 Make mypy happy.

32 """

33

34

35 class _Types:

36 """

37 Internal type storage for stuff that mypy otherwise won't understand.

38 """

39

40 NONETYPE = type(None)

41

42

43 class Pagination(TypedDict):

44 """

45 Pagination key of a paginate dict has these items.

46 """

47

48 total_items: int

49 current_page: int

50 per_page: int

51 total_pages: int

52 has_next_page: bool

53 has_prev_page: bool

54 next_page: Optional[int]

55 prev_page: Optional[int]

56

57

58 class PaginateDict(TypedDict):

59 """

60 Result of PaginatedRows.as_dict().

61 """

62

63 data: dict[int, dict[str, Any]]

64 pagination: Pagination