<commit_before># -*- coding: utf-8 -*-

from __future__ import (
    print_function,
    unicode_literals,
    absolute_import,
    division)

import six
import tornado
import tornado.httpclient

from tornado.concurrent import TracebackFuture

from pusher.http import process_response


class TornadoBackend(object):
    """Adapter for the tornado.httpclient module.

    :param client:  pusher.Client object
    :param kwargs:  options for the httpclient.HTTPClient constructor
    """
    def __init__(self, client, **kwargs):
        self.client = client
        self.http = tornado.httpclient.AsyncHTTPClient(**kwargs)


    def send_request(self, request):
        method = request.method
        data = request.body
        headers = {'Content-Type': 'application/json'}
        future = TracebackFuture()

        def process_response_future(response):
            if response.exc_info() is not None:
                future.set_exc_info(response.exc_info())

            elif response.exception() is not None:
                future.set_exception(response.exception())<commit_msg>Use tornado.concurrent.Future instead of tornado.concurrent.TracebackFuture<commit_after># -*- coding: utf-8 -*-

from __future__ import (
    print_function,
    unicode_literals,
    absolute_import,
    division)

import six
import tornado
import tornado.httpclient

from tornado.concurrent import Future

from pusher.http import process_response


class TornadoBackend(object):
    """Adapter for the tornado.httpclient module.

    :param client:  pusher.Client object
    :param kwargs:  options for the httpclient.HTTPClient constructor
    """
    def __init__(self, client, **kwargs):
        self.client = client
        self.http = tornado.httpclient.AsyncHTTPClient(**kwargs)


    def send_request(self, request):
        method = request.method
        data = request.body
        headers = {'Content-Type': 'application/json'}
        future = Future()

        def process_response_future(response):
            if response.exc_info() is not None:
                future.set_exc_info(response.exc_info())

            elif response.exception() is not None:
                future.set_exception(response.exception())
{'fraction_non_alphanumeric': 0.09017132551848513, 'fraction_numerical': 0.0009017132551848512, 'mean_word_length': 2.9554367201426026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4073127', 'n_tokens_mistral': 605, 'n_tokens_neox': 578, 'n_words': 155}