<commit_before>import os
import json

from populus.utils.filesystem import (
    get_contracts_dir,
    get_compiled_contracts_destination_path,
    recursive_find_files,
)
from solc import (
    compile_files,
)


def find_project_contracts(project_dir):
    contracts_dir = get_contracts_dir(project_dir)

    return tuple(
        os.path.relpath(p) for p in recursive_find_files(contracts_dir, "*.sol")
    )


def write_compiled_sources(project_dir, compiled_sources):
    compiled_contract_path = get_compiled_contracts_destination_path(project_dir)

    with open(compiled_contract_path, 'w') as outfile:
        outfile.write(
            json.dumps(compiled_sources,
                       sort_keys=True,
                       indent=4,
                       separators=(',', ': '))
        )
    return compiled_contract_path


def compile_project_contracts(project_dir, **compiler_kwargs):
    compiler_kwargs.setdefault('output_values', ['bin', 'bin_runtime', 'abi'])
    contract_source_paths = find_project_contracts(project_dir)
    compiled_sources = compile_files(contract_source_paths, **compiler_kwargs)

    return contract_source_paths, compiled_sources


def compile_and_write_contracts(project_dir, **compiler_kwargs):
    contract_source_paths, compiled_sources = compile_project_contracts(
        project_dir,
        **compiler_kwargs
    )

    output_file_path = write_compiled_sources(project_dir, compiled_sources)
    return contract_source_paths, compiled_sources, output_file_path<commit_msg>bin-runtime instead of bin_runtime<commit_after>import os
import json

from populus.utils.filesystem import (
    get_contracts_dir,
    get_compiled_contracts_destination_path,
    recursive_find_files,
)
from solc import (
    compile_files,
)


def find_project_contracts(project_dir):
    contracts_dir = get_contracts_dir(project_dir)

    return tuple(
        os.path.relpath(p) for p in recursive_find_files(contracts_dir, "*.sol")
    )


def write_compiled_sources(project_dir, compiled_sources):
    compiled_contract_path = get_compiled_contracts_destination_path(project_dir)

    with open(compiled_contract_path, 'w') as outfile:
        outfile.write(
            json.dumps(compiled_sources,
                       sort_keys=True,
                       indent=4,
                       separators=(',', ': '))
        )
    return compiled_contract_path


def compile_project_contracts(project_dir, **compiler_kwargs):
    compiler_kwargs.setdefault('output_values', ['bin', 'bin-runtime', 'abi'])
    contract_source_paths = find_project_contracts(project_dir)
    compiled_sources = compile_files(contract_source_paths, **compiler_kwargs)

    return contract_source_paths, compiled_sources


def compile_and_write_contracts(project_dir, **compiler_kwargs):
    contract_source_paths, compiled_sources = compile_project_contracts(
        project_dir,
        **compiler_kwargs
    )

    output_file_path = write_compiled_sources(project_dir, compiled_sources)
    return contract_source_paths, compiled_sources, output_file_path
{'fraction_non_alphanumeric': 0.07664826242286457, 'fraction_numerical': 0.0006495615459564793, 'mean_word_length': 4.065789473684211, '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': '7449804', 'n_tokens_mistral': 928, 'n_tokens_neox': 891, 'n_words': 148}