<commit_before># Defines helper functions used across a variety of tests.

create_repo() {
  local dir_name="${1:-}"
  if [ -z "${dir_name}" ]; then
    repo_path="$(mktemp --directory)"
  else
    repo_path="$(mktemp --directory)/${dir_name}"
  fi

  mkdir -p "${repo_path}"
  git init "${repo_path}" >/dev/null 2>&1

  echo ${repo_path}
}

destroy-all-containers() {
  docker ps -aq | xargs --no-run-if-empty docker rm --force
}

container-running() {
  [ "$(docker inspect --format={{.State.Status}} "$1")" = running ]
}<commit_msg>Add file helper for creating multiline files from Heredocs<commit_after># Defines helper functions used across a variety of tests.

create_repo() {
  local dir_name="${1:-}"
  if [ -z "${dir_name}" ]; then
    repo_path="$(mktemp --directory)"
  else
    repo_path="$(mktemp --directory)/${dir_name}"
  fi

  mkdir -p "${repo_path}"
  git init "${repo_path}" >/dev/null 2>&1

  echo ${repo_path}
}

destroy-all-containers() {
  docker ps -aq | xargs --no-run-if-empty docker rm --force
}

container-running() {
  [ "$(docker inspect --format={{.State.Status}} "$1")" = running ]
}

file() {
  local file=$1

  # `file` will be passed file contents via STDIN
  while read data; do
    echo "$data" >> "$file"
  done
}
{'fraction_non_alphanumeric': 0.18225419664268586, 'fraction_numerical': 0.007194244604316547, 'mean_word_length': 3.5035971223021583, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1626579', 'n_tokens_mistral': 455, 'n_tokens_neox': 426, 'n_words': 123}