<commit_before># Webhooks for external integrations.
from __future__ import absolute_import
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
from zerver.lib.validator import check_dict, check_string
import ujson


@api_key_only_webhook_view('Travis')
@has_request_variables
def api_travis_webhook(request, user_profile, client,
                       stream=REQ(default='travis'),
                       topic=REQ(default=None),
                       message=REQ('payload', validator=check_dict([
                           ('author_name', check_string),
                           ('status_message', check_string),
                           ('compare_url', check_string),
                       ]))):<commit_msg>Annotate travis webhoook function.<commit_after># Webhooks for external integrations.
from __future__ import absolute_import

from django.http import HttpRequest, HttpResponse

from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success
from zerver.lib.validator import check_dict, check_string
from zerver.models import UserProfile, Client

import ujson


@api_key_only_webhook_view('Travis')
@has_request_variables
def api_travis_webhook(request, user_profile, client,
                       stream=REQ(default='travis'),
                       topic=REQ(default=None),
                       message=REQ('payload', validator=check_dict([
                           ('author_name', check_string),
                           ('status_message', check_string),
                           ('compare_url', check_string),
                       ]))):
    # type: (HttpRequest, UserProfile, Client, str, str, Dict[str, str]) -> HttpResponse
{'fraction_non_alphanumeric': 0.08170795993674222, 'fraction_numerical': 0.0, 'mean_word_length': 2.8421052631578947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5979191', 'n_tokens_mistral': 515, 'n_tokens_neox': 503, 'n_words': 114}