<commit_before>#!/bin/bash -e

###################
# ARRAY UTILITIES #
###################

function containElementInArray()
{
    local element=''

    for element in "${@:2}"
    do
        [[ "${element}" = "${1}" ]] && echo 'true' && return 0
    done

    echo 'false' && return 1
}

#################
# AWS UTILITIES #
#################

function getAllowRegions()
{
    echo 'ap-northeast-1 ap-southeast-1 ap-southeast-2 eu-west-1 sa-east-1 us-east-1 us-west-1 us-west-2'
}

function isValidRegion()
{
    local region="${1}"
    local regions=($(getAllowRegions))

    echo "$(containElementInArray "${region}" "${regions[@]}")"
}

####################
# STRING UTILITIES #
####################

function encodeURL()
{
    local length="${#1}"

    local i=0

    for ((i = 0; i < length; i++))
    do
        local walker="${1:i:1}"
<commit_msg>Update util.bash<commit_after>#!/bin/bash -e

###################
# ARRAY UTILITIES #
###################

function containElementInArray()
{
    local element=''

    for element in "${@:2}"
    do
        [[ "${element}" = "${1}" ]] && echo 'true' && return 0
    done

    echo 'false' && return 1
}

#################
# AWS UTILITIES #
#################

function getAllowRegions()
{
    echo 'ap-northeast-1 ap-southeast-1 ap-southeast-2 eu-central-1 eu-west-1 sa-east-1 us-east-1 us-west-1 us-west-2'
}

function isValidRegion()
{
    local region="${1}"
    local regions=($(getAllowRegions))

    echo "$(containElementInArray "${region}" "${regions[@]}")"
}

####################
# STRING UTILITIES #
####################

function encodeURL()
{
    local length="${#1}"

    local i=0

    for ((i = 0; i < length; i++))
    do
        local walker="${1:i:1}"

{'fraction_non_alphanumeric': 0.2917633410672854, 'fraction_numerical': 0.021461716937354988, 'mean_word_length': 3.4689119170984455, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5848981', 'n_tokens_mistral': 619, 'n_tokens_neox': 582, 'n_words': 130}