<commit_before>__author__ = 'thauser'
from argh import arg

from pnc_cli import utils
from pnc_cli.swagger_client.apis import BuildconfigurationsetsApi
from pnc_cli.swagger_client.apis import BuildconfigsetrecordsApi


sets_api = BuildconfigurationsetsApi(utils.get_api_client())
bcsr_api = BuildconfigsetrecordsApi(utils.get_api_client())


def _config_set_record_exists(id):
    return id in [str(x.id) for x in bcsr_api.get_all().content]


def list_build_configuration_set_records():
    """
    List all build configuration set records.
    """
    response = utils.checked_api_call(bcsr_api, 'get_all')
    if response:
        return response.content


@arg("id", help="ID of build configuration set record to retrieve.")
def get_build_configuration_set_record(id):
    """
    Get a specific BuildConfigSetRecord
    """
    if not _config_set_record_exists(id):
        print("A build configuration set record with ID {} does not exist.").format(id)
        return
    response = utils.checked_api_call(bcsr_api, 'get_specific', id=id)
    if response:
        return response.content


@arg("id", help="ID of build configuration set record to retrieve build records from.")
def get_records_for_build_config_set(id):
    """
    Get a list of BuildRecords for the given BuildConfigSetRecord
    """
    if not id in [str(x.id) for x in sets_api.get_all().content]:
        print("A build configuration set with ID {} does not exist.").format(id)
        return
    response = utils.checked_api_call(bcsr_api, 'get_build_records', id=id)
    if response:
        return response.content<commit_msg>tweak build config set record help text<commit_after>__author__ = 'thauser'
from argh import arg

from pnc_cli import utils
from pnc_cli.swagger_client.apis import BuildconfigurationsetsApi
from pnc_cli.swagger_client.apis import BuildconfigsetrecordsApi


sets_api = BuildconfigurationsetsApi(utils.get_api_client())
bcsr_api = BuildconfigsetrecordsApi(utils.get_api_client())


def _config_set_record_exists(id):
    return id in [str(x.id) for x in bcsr_api.get_all().content]


def list_build_configuration_set_records():
    """
    List all build configuration set records.
    """
    response = utils.checked_api_call(bcsr_api, 'get_all')
    if response:
        return response.content


@arg("id", help="ID of build configuration set record to retrieve.")
def get_build_configuration_set_record(id):
    """
    Get a specific BuildConfigSetRecord
    """
    if not _config_set_record_exists(id):
        print("A build configuration set record with ID {} does not exist.".format(id))
        return
    response = utils.checked_api_call(bcsr_api, 'get_specific', id=id)
    if response:
        return response.content


@arg("id", help="ID of BuildConfigSetRecord to retrieve build records from.")
def get_records_for_build_config_set(id):
    """
    Get a list of BuildRecords for the given BuildConfigSetRecord
    """
    if not id in [str(x.id) for x in sets_api.get_all().content]:
        print("A BuildConfigurationSet with ID {} does not exist.".format(id))
        return
    response = utils.checked_api_call(bcsr_api, 'get_build_records', id=id)
    if response:
        return response.content
{'fraction_non_alphanumeric': 0.09051456912585244, 'fraction_numerical': 0.0, 'mean_word_length': 4.171474358974359, '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': '906261', 'n_tokens_mistral': 982, 'n_tokens_neox': 983, 'n_words': 268}