diff options
author | Jonah BrĂ¼chert <jbb@kaidan.im> | 2024-03-29 03:34:45 +0100 |
---|---|---|
committer | Jonah BrĂ¼chert <jbb@kaidan.im> | 2024-03-29 03:34:45 +0100 |
commit | 0cb93b99f31a0954eccbe412faf210ca70e8d228 (patch) | |
tree | 665fdad8d69fb1d4539d758f4056e90d383ab9ae /accounts/utils/__init__.py | |
parent | 7d5b1e5b1f845534d565803412eef5916ce2824d (diff) | |
download | web-0cb93b99f31a0954eccbe412faf210ca70e8d228.tar.gz web-0cb93b99f31a0954eccbe412faf210ca70e8d228.tar.bz2 web-0cb93b99f31a0954eccbe412faf210ca70e8d228.zip |
utils: Improve typing
Diffstat (limited to 'accounts/utils/__init__.py')
-rw-r--r-- | accounts/utils/__init__.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/accounts/utils/__init__.py b/accounts/utils/__init__.py index 1f79953..dfb02af 100644 --- a/accounts/utils/__init__.py +++ b/accounts/utils/__init__.py @@ -4,14 +4,16 @@ from functools import wraps from flask import render_template, request, Flask from wtforms.validators import Regexp, ValidationError -from typing import Optional +from typing import Optional, Callable, Any # using http://flask.pocoo.org/docs/patterns/viewdecorators/ -def templated(template: Optional[str] = None): - def templated_(f): +def templated( + template: Optional[str] = None, +) -> Callable[..., Callable[..., str]]: + def templated_(f: Callable[..., str]) -> Callable[..., str]: @wraps(f) - def templated__(*args, **kwargs): + def templated__(*args: list[Any], **kwargs: dict[str, Any]) -> str: template_name = template if template_name is None: if request.endpoint: |