<commit_before>'''Utilities relating to running commands and HTTP requests'''

import dcos.http
import sdk_spin
import sdk_utils
import shakedown


def request(method, url, retry=True, **kwargs):
    def fn():
        response = dcos.http.request(method, url, **kwargs)
        sdk_utils.out('Got {} for {} {} (args: {})'.format(
            response.status_code, method.upper(), url, kwargs))
        response.raise_for_status()
        return response
    if retry:
        return sdk_spin.time_wait_return(lambda: fn())
    else:
        return fn()


def run_cli(cmd):
    (stdout, stderr, ret) = shakedown.run_dcos_command(cmd)
    if ret != 0:
        err = 'Got error code {} when running command "dcos {}":\nstdout: "{}"\nstderr: "{}"'.format(
            ret, cmd, stdout, stderr)
        sdk_utils.out(err)
        raise Exception(err)
    return stdout
<commit_msg>Use new spinner; accept empty 200 success. (#915)<commit_after>'''Utilities relating to running commands and HTTP requests'''

import dcos.http
import sdk_spin
import sdk_utils
import shakedown


def request(method, url, retry=True, **kwargs):
    def fn():
        response = dcos.http.request(method, url, **kwargs)
        sdk_utils.out('Got {} for {} {} (args: {})'.format(
            response.status_code, method.upper(), url, kwargs))
        response.raise_for_status()
        return response
    if retry:
        return shakedown.wait_while_exceptions(lambda: fn())
    else:
        return fn()


def run_cli(cmd):
    (stdout, stderr, ret) = shakedown.run_dcos_command(cmd)
    if ret != 0:
        err = 'Got error code {} when running command "dcos {}":\nstdout: "{}"\nstderr: "{}"'.format(
            ret, cmd, stdout, stderr)
        sdk_utils.out(err)
        raise Exception(err)
    return stdout

{'fraction_non_alphanumeric': 0.13322185061315497, 'fraction_numerical': 0.004459308807134894, 'mean_word_length': 2.9624724061810155, 'pattern_counts': {'":': 2, '<': 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': '3555959', 'n_tokens_mistral': 575, 'n_tokens_neox': 557, 'n_words': 157}