<commit_before>#!/usr/bin/env bash
###############################################################################
# migrate-hasp-107.sh - Modify an existing Home Assistant configuration
# with HASP deployed to accomodate breaking changes in v107
###############################################################################

# Confirm that we're working in the .homeassistant folder by checking for configuration.yaml
if [ ! -f configuration.yaml ]
then
  echo "WARNING: 'configuration.yaml' not found in current directory."
  echo "Searching for Home Assistant 'configuration.yaml'..."
  configfile=$(find / -name configuration.yaml 2>/dev/null)
  count=$(echo "$configfile" | wc -l)
  if [ $count == 1 ]
  then
    configdir=$(dirname "${configfile}")
    cd $configdir
    echo "INFO: configuration.yaml found under: $configdir"
  else
    echo "ERROR: Failed to locate the active 'configuration.yaml'"
    echo "       Please run this script from the homeassistant"
    echo "       configuration folder for your environment."
    exit 1
  fi
fi

# If the user has already deployed HASP devices...
if [ -d packages ]
then
  # Search through existing packages to see if we have any "view:" statements to remove as they have been deprecated
  find packages -name "hasp_*.yaml" -exec sed -i '/[[:blank:]]view\:/d' {} +
fi

if [ -d hasp-examples ]
then<commit_msg>Update migrate-hasp-107.sh<commit_after>#!/usr/bin/env bash
###############################################################################
# migrate-hasp-107.sh - Modify an existing Home Assistant configuration
# with HASP deployed to accomodate breaking changes in v107
###############################################################################

# First order of business is to find 'configuration.yaml' in some likely places
if [ ! -f configuration.yaml ] # check current directory first
then
  if [ -f /config/configuration.yaml ] # next check container config dir
  then
    cd /config
  elif [ -f ~/.homeassistant/configuration.yaml ]
  then
    cd ~/.homeassistant
  else
    echo "WARNING: 'configuration.yaml' not found in current directory."
    echo "         Searching for 'configuration.yaml'..."
    foundConfigFiles=$(find / -name configuration.yaml 2>/dev/null)
    foundConfigCount=$(echo "$foundConfigFiles" | wc -l)
    if [ $foundConfigCount == 1 ]
    then
      foundConfigDir=$(dirname "${foundConfigFiles}")
      cd $foundConfigDir
      echo "INFO: configuration.yaml found under: $foundConfigDir"
    else
      echo "ERROR: Failed to locate the active 'configuration.yaml'"
      echo "       Please run this script from the homeassistant"
      echo "       configuration folder for your environment."
      exit 1
    fi
  fi
fi

# If the user has already deployed HASP devices...
if [ -d packages ]
then
  # Search through existing packages to see if we have any "view:" statements to remove as they have been deprecated
  find packages -name "hasp_*.yaml" -exec sed -i '/[[:blank:]]view\:/d' {} +
fi

if [ -d hasp-examples ]
then
{'fraction_non_alphanumeric': 0.19485657764589515, 'fraction_numerical': 0.006923837784371909, 'mean_word_length': 3.7854889589905363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2743834', 'n_tokens_mistral': 824, 'n_tokens_neox': 781, 'n_words': 303}