<commit_before>require 'yaml'

# Load node definitions from the vcloud-launcher YAML in the
# govuk-provisioning repo parallel to this.
def load_nodes
  yaml_dir = File.expand_path(
    "../../govuk-provisioning/vcloud-launcher/production_skyscape/",
    __FILE__
  )
  yaml_local = File.expand_path("../nodes.local.yaml", __FILE__)

  # DEPRECATED
  json_local = File.expand_path("../nodes.local.json", __FILE__)
  if File.exists?(json_local)
    $stderr.puts "ERROR: nodes.local.json is deprecated. Please convert it to YAML"
    exit 1
  end

  unless File.exists?(yaml_dir)
    puts "Unable to find nodes in 'govuk-provisioning' repo"
    puts
    return {}
  end

  yaml_files = Dir.glob(
    File.join(yaml_dir, "*.yaml")
  )

  nodes = Hash[
    yaml_files.flat_map { |yaml_file|<commit_msg>Use vcloud-launcher configs from Preview<commit_after>require 'yaml'

# Load node definitions from the vcloud-launcher YAML in the
# govuk-provisioning repo parallel to this.
def load_nodes
  yaml_dir = File.expand_path(
    "../../govuk-provisioning/vcloud-launcher/preview_carrenza/",
    __FILE__
  )
  yaml_local = File.expand_path("../nodes.local.yaml", __FILE__)

  # DEPRECATED
  json_local = File.expand_path("../nodes.local.json", __FILE__)
  if File.exists?(json_local)
    $stderr.puts "ERROR: nodes.local.json is deprecated. Please convert it to YAML"
    exit 1
  end

  unless File.exists?(yaml_dir)
    puts "Unable to find nodes in 'govuk-provisioning' repo"
    puts
    return {}
  end

  yaml_files = Dir.glob(
    File.join(yaml_dir, "*.yaml")
  )

  nodes = Hash[
    yaml_files.flat_map { |yaml_file|
{'fraction_non_alphanumeric': 0.11666666666666667, 'fraction_numerical': 0.0012345679012345679, 'mean_word_length': 3.4532967032967035, 'pattern_counts': {'":': 0, '<': 3, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5090963', 'n_tokens_mistral': 585, 'n_tokens_neox': 566, 'n_words': 133}