<commit_before>#!/usr/bin/env python

import os
import random
import time

name = 'sleep'


def setup(config={}):
    LOG.debug('doing setup for sleep handler')
    register_action('sleep', handle_sleep, args={"sleep_interval": {
                "required": True, "type": "int"}}
)


def handle_sleep(input_data):
    action = input_data['action']
    payload = input_data['payload']

    sleep_time = payload.get('time', 5)
    success_percentage = payload.get('success_percentage', 100)

    result = random.randrange(1, 100)

    result_code = 1
    if result <= success_percentage:
        result_code = 0

    time.sleep(sleep_time)

    result_str = ['success!', 'fail!'][result_code]
    return {'result_code': result_code,
            'result_str': result_str,
            'result_data': {'sleep_interval': sleep_time,
                            'success_percentage': success_percentage,
                            'random': result}}<commit_msg>pep8, how I loathe you.<commit_after>#!/usr/bin/env python

import os
import random
import time

name = 'sleep'


def setup(config={}):
    LOG.debug('doing setup for sleep handler')
    register_action('sleep', handle_sleep,
                    args={"sleep_interval": {"required": True, "type": "int"}})


def handle_sleep(input_data):
    action = input_data['action']
    payload = input_data['payload']

    sleep_time = payload.get('time', 5)
    success_percentage = payload.get('success_percentage', 100)

    result = random.randrange(1, 100)

    result_code = 1
    if result <= success_percentage:
        result_code = 0

    time.sleep(sleep_time)

    result_str = ['success!', 'fail!'][result_code]
    return {'result_code': result_code,
            'result_str': result_str,
            'result_data': {'sleep_interval': sleep_time,
                            'success_percentage': success_percentage,
                            'random': result}}
{'fraction_non_alphanumeric': 0.12903225806451613, 'fraction_numerical': 0.010926118626430802, 'mean_word_length': 2.877016129032258, 'pattern_counts': {'":': 6, '<': 5, '<?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': '7474963', 'n_tokens_mistral': 603, 'n_tokens_neox': 571, 'n_words': 127}