From 6f543751a6f511835764cf14a98b016f47cede96 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sun, 27 Dec 2020 15:25:16 +0200 Subject: [PATCH] Fix and improve typing. --- etebase_fastapi/stoken_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etebase_fastapi/stoken_handler.py b/etebase_fastapi/stoken_handler.py index c840f0e..9ea1500 100644 --- a/etebase_fastapi/stoken_handler.py +++ b/etebase_fastapi/stoken_handler.py @@ -10,7 +10,7 @@ from django_etebase.models import Stoken StokenAnnotation = t.Any -def get_stoken_obj(stoken: t.Optional[str]): +def get_stoken_obj(stoken: t.Optional[str]) -> t.Optional[Stoken]: if stoken is not None: try: return Stoken.objects.get(uid=stoken) @@ -22,7 +22,7 @@ def get_stoken_obj(stoken: t.Optional[str]): def filter_by_stoken( stoken: t.Optional[str], queryset: QuerySet, stoken_annotation: StokenAnnotation -) -> t.Tuple[QuerySet, t.Optional[str]]: +) -> t.Tuple[QuerySet, t.Optional[Stoken]]: stoken_rev = get_stoken_obj(stoken) queryset = queryset.annotate(max_stoken=stoken_annotation).order_by("max_stoken")