<commit_before>from __future__ import unicode_literals

import os

from pre_commit.languages import helpers
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cwd
from pre_commit.languages import helpers
from pre_commit.xargs import xargs

ENVIRONMENT_DIR = 'swift_env'
BUILD_DIR = '.build'
BUILD_CONFIG = 'release'

def install_environment(
        repo_cmd_runner,
        version='default',
        additional_dependencies=(),
):
    directory = repo_cmd_runner.path(helpers.environment_dir(
        ENVIRONMENT_DIR, 'default',
    ))

    # Build the swift package
    with clean_path_on_failure(directory):
        os.mkdir(directory)
        repo_cmd_runner.run((
            'swift', 'build',
            '-C', '{prefix}',
            '-c', BUILD_CONFIG,
            '--build-path', os.path.join(directory, BUILD_DIR),
        ))

def run_hook(repo_cmd_runner, hook, file_args):
    directory = repo_cmd_runner.path(helpers.environment_dir(
        ENVIRONMENT_DIR, 'default',
    ))
    with(cwd(os.path.join(directory, BUILD_DIR, BUILD_CONFIG))):
        return xargs(helpers.to_cmd(hook), file_args)<commit_msg>fix CI issues<commit_after>from __future__ import unicode_literals

import os

from pre_commit.languages import helpers
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cwd
from pre_commit.xargs import xargs

ENVIRONMENT_DIR = 'swift_env'
BUILD_DIR = '.build'
BUILD_CONFIG = 'release'


def install_environment(
        repo_cmd_runner,
        version='default',
        additional_dependencies=(),
):
    directory = repo_cmd_runner.path(helpers.environment_dir(
        ENVIRONMENT_DIR, 'default',
    ))

    # Build the swift package
    with clean_path_on_failure(directory):
        os.mkdir(directory)
        repo_cmd_runner.run((
            'swift', 'build',
            '-C', '{prefix}',
            '-c', BUILD_CONFIG,
            '--build-path', os.path.join(directory, BUILD_DIR),
        ))


def run_hook(repo_cmd_runner, hook, file_args):
    directory = repo_cmd_runner.path(helpers.environment_dir(
        ENVIRONMENT_DIR, 'default',
    ))
    with(cwd(os.path.join(directory, BUILD_DIR, BUILD_CONFIG))):
        return xargs(helpers.to_cmd(hook), file_args)
{'fraction_non_alphanumeric': 0.10412051395657954, 'fraction_numerical': 0.0, 'mean_word_length': 3.3929961089494163, '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': '6513766', 'n_tokens_mistral': 725, 'n_tokens_neox': 714, 'n_words': 141}