<commit_before>part of hop_runner;

Map<String, dynamic> config;

Directory get tool_dir => new File.fromUri(Platform.script).parent.absolute;
Directory get root_dir => tool_dir.parent;

Map<String, dynamic> load_config() => loadYaml(new File("${tool_dir.path}/build.yaml").readAsStringSync());

Map<String, dynamic> variables = {
  "tool_dir": tool_dir.path,
  "root_dir": root_dir.path
};

String parse_config_value(String input) {
  var out = input;
  for (var variable in variables.keys) {
    out = out.replaceAll("{${variable}}", variables[variable]);
  }
  return out;
}

dynamic getvar(String path, [dynamic defaultValue = false]) {
  var current = config;<commit_msg>Build: Add Variables Support in Configuration<commit_after>part of hop_runner;

Map<String, dynamic> config;

Directory get tool_dir => new File.fromUri(Platform.script).parent.absolute;
Directory get root_dir => tool_dir.parent;

Map<String, dynamic> load_config() {
  var it = loadYaml(new File("${tool_dir.path}/build.yaml").readAsStringSync());
  if (it.containsKey("variables")) {
    variables.addAll(it["variables"]);
  }
  return it;
}

Map<String, dynamic> variables = {
  "tool_dir": tool_dir.path,
  "root_dir": root_dir.path
};

String parse_config_value(String input) {
  var out = input;
  for (var variable in variables.keys) {
    out = out.replaceAll("{${variable}}", variables[variable]);
  }
  return out;
}

dynamic getvar(String path, [dynamic defaultValue = false]) {
  var current = config;
{'fraction_non_alphanumeric': 0.14237743451981194, 'fraction_numerical': 0.0, 'mean_word_length': 5.286919831223629, 'pattern_counts': {'":': 4, '<': 9, '<?xml version=': 0, '>': 14, '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': '4846059', 'n_tokens_mistral': 481, 'n_tokens_neox': 478, 'n_words': 115}