<commit_before>"""
perftools.middleware
~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""

__all__ = ('SlowRequestLoggingMiddleware', 'RemoteProfilingMiddleware', 'QueryCountLoggingMiddleware')

import random
import threading


class Base(threading.local):
    def __init__(self, application, percent=100):
        self.percent = percent

    def should_run(self, environ):
        if self.percent == 100:
            return True
        return random.randint(0, 100) % self.percent == 0

from perftools.middleware.slowreq import SlowRequestLoggingMiddleware
from perftools.middleware.remoteprof import RemoteProfilingMiddleware
from perftools.middleware.querycount import QueryCountLoggingMiddleware<commit_msg>Lets use real math not cramermath<commit_after>"""
perftools.middleware
~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""

__all__ = ('SlowRequestLoggingMiddleware', 'RemoteProfilingMiddleware', 'QueryCountLoggingMiddleware')

import random
import threading


class Base(threading.local):
    def __init__(self, application, percent=100):
        self.percent = percent

    def should_run(self, environ):

        return random.randint(0, 100) < self.percent

from perftools.middleware.slowreq import SlowRequestLoggingMiddleware
from perftools.middleware.remoteprof import RemoteProfilingMiddleware
from perftools.middleware.querycount import QueryCountLoggingMiddleware
{'fraction_non_alphanumeric': 0.1083223249669749, 'fraction_numerical': 0.019815059445178335, 'mean_word_length': 5.4743589743589745, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4490626', 'n_tokens_mistral': 448, 'n_tokens_neox': 429, 'n_words': 110}