zerver/webhooks: Change use of typing.Text to str.

This commit is contained in:
Aditya Bansal
2018-05-10 23:04:01 +05:30
committed by Tim Abbott
parent e8506b5020
commit 64ddfc6ac0
88 changed files with 277 additions and 319 deletions

View File

@@ -1,6 +1,6 @@
# Webhooks for external integrations.
from typing import Any, Dict, Text
from typing import Any, Dict
import ujson
from django.http import HttpRequest, HttpResponse
@@ -27,10 +27,10 @@ def api_circleci_webhook(request: HttpRequest, user_profile: UserProfile,
check_send_webhook_message(request, user_profile, subject, body)
return json_success()
def get_subject(payload: Dict[str, Any]) -> Text:
def get_subject(payload: Dict[str, Any]) -> str:
return CIRCLECI_SUBJECT_TEMPLATE.format(repository_name=payload['reponame'])
def get_body(payload: Dict[str, Any]) -> Text:
def get_body(payload: Dict[str, Any]) -> str:
data = {
'build_url': payload['build_url'],
'username': payload['username'],
@@ -39,7 +39,7 @@ def get_body(payload: Dict[str, Any]) -> Text:
}
return CIRCLECI_MESSAGE_TEMPLATE.format(**data)
def get_status(payload: Dict[str, Any]) -> Text:
def get_status(payload: Dict[str, Any]) -> str:
status = payload['status']
if payload['previous'] and payload['previous']['status'] == FAILED_STATUS and status == FAILED_STATUS:
return u'is still failing'