<commit_before>#!/bin/bash
# A simple npm wrapper for using GitHub as a light-weight npm registry.
#

# echo the supplied params, and then return
function errNoExit {
  echo "** Error running ${SCRIPT_NAME}"
  while [ $# -gt 0 ]
  do
    echo "*** $1"
    shift
  done
}

# echo the supplied params, and then exit with an error
function errExit {
  echo "** Error running ${SCRIPT_NAME}"
  while [ $# -gt 0 ]
  do
    echo "*** $1"
    shift
  done
  exit 1
}

# common way of invoking npm
function callNpm {
  echo
  echo "${SCRIPT_NAME}: "
  echo "  calling: npm $*"
  npm $*
  exit $?
}

# extract a JSON value from JSON which has been pre-parsed with JSON.sh
function getJsonVal {
  prop=\\[\"${1//\./\",\"}\"\\]
  grep ${prop} <${PARSED_JSON} | ( read -r key value ; value=${value#\"} ; value=${value%\"}; echo $value)
}

# find the fully deferenced location of a file
function dereferencedFilePath {
  pushd . > /dev/null
  filePath="$1";
  if ([ -h "${filePath}" ])
  then
    while([ -h "${filePath}" ])
    do
      cd `dirname "$filePath"`
      filePath=`readlink "${filePath}"`
    done
  fi
  cd `dirname ${filePath}` > /dev/null
  filePath=`pwd -L`;
  popd  > /dev/null
  echo "$filePath"
}

# initialise bits and pieces
SCRIPT_DIR=`dereferencedFilePath "${BASH_SOURCE[0]}"`<commit_msg>Changed the way the deferencedFilePath is determined<commit_after>#!/bin/bash
# A simple npm wrapper for using GitHub as a light-weight npm registry.
#

# echo the supplied params, and then return
function errNoExit {
  echo "** Error running ${SCRIPT_NAME}"
  while [ $# -gt 0 ]
  do
    echo "*** $1"
    shift
  done
}

# echo the supplied params, and then exit with an error
function errExit {
  echo "** Error running ${SCRIPT_NAME}"
  while [ $# -gt 0 ]
  do
    echo "*** $1"
    shift
  done
  exit 1
}

# common way of invoking npm
function callNpm {
  echo
  echo "${SCRIPT_NAME}: "
  echo "  calling: npm $*"
  npm $*
  exit $?
}

# extract a JSON value from JSON which has been pre-parsed with JSON.sh
function getJsonVal {
  prop=\\[\"${1//\./\",\"}\"\\]
  grep ${prop} <${PARSED_JSON} | ( read -r key value ; value=${value#\"} ; value=${value%\"}; echo $value)
}

# find the fully deferenced location of a file
function dereferencedFilePath {
  pushd . > /dev/null
  _source="$1"
  _dir="$( dirname "$_source" )"
  while [ -h "$_source" ]
  do
    _source="$(readlink "$_source")"
    [[ $_source != /* ]] && _source="$_dir/$_source"
    _dir="$( cd -P "$( dirname "$_source"  )" && pwd )"
  done
  _dir="$( cd -P "$( dirname "$_source" )" && pwd )"
  popd  > /dev/null
  echo "$_dir"
}

# initialise bits and pieces
SCRIPT_DIR=`dereferencedFilePath "${BASH_SOURCE[0]}"`
{'fraction_non_alphanumeric': 0.16393442622950818, 'fraction_numerical': 0.005961251862891207, 'mean_word_length': 3.1244239631336406, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '5644602', 'n_tokens_mistral': 989, 'n_tokens_neox': 935, 'n_words': 298}