From 8e589daaf2cec6a10262b8ff88801127f2fa14fd Mon Sep 17 00:00:00 2001 From: default-303 <54715852+default-303@users.noreply.github.com> Date: Sun, 30 May 2021 00:24:35 +0530 Subject: [PATCH] Fix typing of jinja decorators (#4109) --- CHANGES.rst | 2 ++ src/flask/typing.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 3e79b5cb..7920e5ab 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,8 @@ Unreleased - Fix type annotation for ``teardown_request``. :issue:`4093` - Fix type annotation for ``before_request`` and ``before_app_request`` decorators. :issue:`4104` +- Fixed the issue where typing requires template global + decorators to accept functions with no arguments. :issue:`4098` Version 2.0.1 diff --git a/src/flask/typing.py b/src/flask/typing.py index 8d89839f..b1a6cbdc 100644 --- a/src/flask/typing.py +++ b/src/flask/typing.py @@ -40,8 +40,8 @@ BeforeRequestCallable = t.Callable[[], t.Optional[ResponseReturnValue]] ErrorHandlerCallable = t.Callable[[Exception], ResponseReturnValue] TeardownCallable = t.Callable[[t.Optional[BaseException]], None] TemplateContextProcessorCallable = t.Callable[[], t.Dict[str, t.Any]] -TemplateFilterCallable = t.Callable[[t.Any], str] -TemplateGlobalCallable = t.Callable[[], t.Any] -TemplateTestCallable = t.Callable[[t.Any], bool] +TemplateFilterCallable = t.Callable[..., t.Any] +TemplateGlobalCallable = t.Callable[..., t.Any] +TemplateTestCallable = t.Callable[..., bool] URLDefaultCallable = t.Callable[[str, dict], None] URLValuePreprocessorCallable = t.Callable[[t.Optional[str], t.Optional[dict]], None]