diff --git a/zerver/webhooks/gogs/view.py b/zerver/webhooks/gogs/view.py index 9778480d23..d6b5c58097 100644 --- a/zerver/webhooks/gogs/view.py +++ b/zerver/webhooks/gogs/view.py @@ -1,7 +1,8 @@ # vim:fenc=utf-8 -from typing import Any, Callable, Dict, Optional +from typing import Any, Dict, Optional from django.http import HttpRequest, HttpResponse +from typing_extensions import Protocol from zerver.decorator import webhook_view from zerver.lib.exceptions import UnsupportedWebhookEventType @@ -147,10 +148,15 @@ def api_gogs_webhook( ) +class FormatPullRequestEvent(Protocol): + def __call__(self, payload: Dict[str, Any], include_title: bool) -> str: + ... + + def gogs_webhook_main( integration_name: str, http_header_name: str, - format_pull_request_event: Callable[..., Any], + format_pull_request_event: FormatPullRequestEvent, request: HttpRequest, user_profile: UserProfile, payload: Dict[str, Any],