mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
mypy: Improve return type of api_key_only_webhook_view decorator.
This commit is contained in:
committed by
Tim Abbott
parent
c063ba72a2
commit
5c3af83229
@@ -258,9 +258,9 @@ def access_user_by_api_key(request, api_key, email=None):
|
||||
|
||||
# Use this for webhook views that don't get an email passed in.
|
||||
def api_key_only_webhook_view(client_name):
|
||||
# type: (Text) -> Callable[..., HttpResponse]
|
||||
# This function can't be typed perfectly because returning a generic function
|
||||
# isn't supported in mypy - https://github.com/python/mypy/issues/1551.
|
||||
# type: (Text) -> Callable[[Callable[..., HttpResponse]], Callable[..., HttpResponse]]
|
||||
# TODO The typing here could be improved by using the Extended Callable types:
|
||||
# https://mypy.readthedocs.io/en/latest/kinds_of_types.html#extended-callable-types
|
||||
def _wrapped_view_func(view_func):
|
||||
# type: (Callable[..., HttpResponse]) -> Callable[..., HttpResponse]
|
||||
@csrf_exempt
|
||||
|
||||
Reference in New Issue
Block a user