<commit_before>"""A module defining a repository rule that ensures the vendored examples have 
actual vendored sources"""

load("@rules_rust//rust:repositories.bzl", "load_arbitrary_tool")

def _examples_dir(repository_ctx):
    """Returns the path to the cargo-raze workspace root

    Args:
        repository_ctx (repository_ctx): The current rule's context object

    Returns:
        path: A path to the cargo-raze workspace root
    """
    examples_cargo_raze_root = repository_ctx.path(repository_ctx.attr._script).dirname.dirname
    return repository_ctx.path(str(examples_cargo_raze_root) + "/examples")

EXECUTE_FAIL_MESSAGE = """\
Failed to setup examples repository with exit code ({}).
--------stdout:
{}
--------stderr:
{}
"""

def _examples_repository_impl(repository_ctx):
    """Implementation of the `examples_repository` repository rule

    Args:
        repository_ctx (repository_ctx): The current rule's context object
    """

    examples_dir = _examples_dir(repository_ctx)

    if repository_ctx.attr.target_triple:
        target_triple = repository_ctx.attr.target_triple
    elif "mac" in repository_ctx.os.name:
        target_triple = "x86_64-apple-darwin"
    elif "windows" in repository_ctx.os.name:
        target_triple = "x86_64-pc-windows-msvc"
    else:
        target_triple = "x86_64-unknown-linux-gnu"

    # Download cargo
    load_arbitrary_tool(
        ctx = repository_ctx,
        tool_name = "cargo",
        tool_subdirectories = ["cargo"],
        version = repository_ctx.attr.cargo_version,<commit_msg>Replace incomplete repository_os logic with get_host_triple (#482)<commit_after>"""A module defining a repository rule that ensures the vendored examples have 
actual vendored sources"""

load("@rules_rust//rust:repositories.bzl", "load_arbitrary_tool")
load("@rules_rust//rust/platform:triple.bzl", "get_host_triple")

def _examples_dir(repository_ctx):
    """Returns the path to the cargo-raze workspace root

    Args:
        repository_ctx (repository_ctx): The current rule's context object

    Returns:
        path: A path to the cargo-raze workspace root
    """
    examples_cargo_raze_root = repository_ctx.path(repository_ctx.attr._script).dirname.dirname
    return repository_ctx.path(str(examples_cargo_raze_root) + "/examples")

EXECUTE_FAIL_MESSAGE = """\
Failed to setup examples repository with exit code ({}).
--------stdout:
{}
--------stderr:
{}
"""

def _examples_repository_impl(repository_ctx):
    """Implementation of the `examples_repository` repository rule

    Args:
        repository_ctx (repository_ctx): The current rule's context object
    """

    examples_dir = _examples_dir(repository_ctx)

    if repository_ctx.attr.target_triple:
        target_triple = repository_ctx.attr.target_triple
    else:
        target_triple = get_host_triple(repository_ctx).str

    # Download cargo
    load_arbitrary_tool(
        ctx = repository_ctx,
        tool_name = "cargo",
        tool_subdirectories = ["cargo"],
        version = repository_ctx.attr.cargo_version,
{'fraction_non_alphanumeric': 0.10352710646636186, 'fraction_numerical': 0.004898758981058132, 'mean_word_length': 3.7859375, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2243012', 'n_tokens_mistral': 939, 'n_tokens_neox': 890, 'n_words': 211}