<commit_before># Functions for resolving the runtime environment of a package.

declare -A __runtime_environment
declare -A __buildtime_environment

declare -A __runtime_environment_provenance
declare -A __buildtime_environment_provenance

# Layer all direct dependencies' environment together.
#
# Priority is last-one-wins, based on the order in which you define
# the dependencies in your plan file.
#
# (I'm sure there are many other common variables we could add here;
# PRs welcome!)
declare -A -g __well_known_aggregate_env_vars=(
    # Shell
    [PATH]=":"

    # Go
    [GOPATH]=":"

    # Java
    [CLASSPATH]=";"

    # NodeJS
    [NODE_PATH]=":"

    # Python
    [PYTHONHOME]=":"
    [PYTHONPATH]=":"

    # Ruby
    [BUNDLE_PATH]=":"
    [BUNDLE_WITHOUT]=":"
    [GEM_PATH]=":"
    [RUBYLIB]=":"
    [RUBYPATH]=":"
)

# Purely internal implementation function to ensure we are operating
# on the correct data structures. See call sites for further context.
__fail_on_unrecognized_env() {
    local env_name=${1}
    if [ "${env_name}" != "__runtime_environment" ] &&
           [ "${env_name}" != "__buildtime_environment" ]; then
        exit_with "INTERNAL CODE ERROR: ${FUNCNAME[1]} was called at ${BASH_SOURCE[2]}:${BASH_LINENO[1]} with unrecognized environment variable name: ${env_name}"
    fi
}

__fail_on_protected_env_var_manipulation() {
    declare -A protected=(<commit_msg>Remove PYTHONHOME as an aggregate variable<commit_after># Functions for resolving the runtime environment of a package.

declare -A __runtime_environment
declare -A __buildtime_environment

declare -A __runtime_environment_provenance
declare -A __buildtime_environment_provenance

# Layer all direct dependencies' environment together.
#
# Priority is last-one-wins, based on the order in which you define
# the dependencies in your plan file.
#
# (I'm sure there are many other common variables we could add here;
# PRs welcome!)
declare -A -g __well_known_aggregate_env_vars=(
    # Shell
    [PATH]=":"

    # Go
    [GOPATH]=":"

    # Java
    [CLASSPATH]=";"

    # NodeJS
    [NODE_PATH]=":"

    # Python
    [PYTHONPATH]=":"

    # Ruby
    [BUNDLE_PATH]=":"
    [BUNDLE_WITHOUT]=":"
    [GEM_PATH]=":"
    [RUBYLIB]=":"
    [RUBYPATH]=":"
)

# Purely internal implementation function to ensure we are operating
# on the correct data structures. See call sites for further context.
__fail_on_unrecognized_env() {
    local env_name=${1}
    if [ "${env_name}" != "__runtime_environment" ] &&
           [ "${env_name}" != "__buildtime_environment" ]; then
        exit_with "INTERNAL CODE ERROR: ${FUNCNAME[1]} was called at ${BASH_SOURCE[2]}:${BASH_LINENO[1]} with unrecognized environment variable name: ${env_name}"
    fi
}

__fail_on_protected_env_var_manipulation() {
    declare -A protected=(
{'fraction_non_alphanumeric': 0.11886120996441281, 'fraction_numerical': 0.0028469750889679717, 'mean_word_length': 3.9928952042628776, 'pattern_counts': {'":': 19, '<': 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': '6802159', 'n_tokens_mistral': 928, 'n_tokens_neox': 893, 'n_words': 261}