Skip to content

Commit e234ef8

Browse files
committed
Created more readable type hits for view
1 parent fac6cc2 commit e234ef8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/django_routify/router.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from inspect import isclass
2-
from typing import Callable
2+
from typing import Callable, Type
33
import re
44

55
from django.http import HttpRequest, HttpResponse
@@ -57,9 +57,11 @@ def urls(self) -> list[path]:
5757
return self.__urls
5858

5959
def route(self, url_path: str, name: str = None):
60+
VIEW_TYPE: Type = Callable[[HttpRequest, ...], HttpResponse]
61+
6062
def register(
61-
view: Callable[[HttpRequest, ...], HttpResponse] | View
62-
) -> Callable[[HttpRequest, ...], HttpResponse]:
63+
view: VIEW_TYPE | View
64+
) -> VIEW_TYPE:
6365
nonlocal url_path, name
6466

6567
if self.__auto_naming and not name:

0 commit comments

Comments
 (0)