<commit_before>package erbrenderer

const templateEvaluationContextRb = `
# Based on common/properties/template_evaluation_context.rb
require "rubygems"
require "ostruct"
require "json"
require "erb"
require "yaml"

class Hash
  def recursive_merge!(other)
    self.merge!(other) do |_, old_value, new_value|
      if old_value.class == Hash && new_value.class == Hash
        old_value.recursive_merge!(new_value)
      else
        new_value
      end
    end
    self
  end
end

class TemplateEvaluationContext
  attr_reader :name, :index
  attr_reader :properties, :raw_properties
  attr_reader :spec

  def initialize(spec)
    @name = spec["job"]["name"] if spec["job"].is_a?(Hash)
    @index = spec["index"]

    properties1 = spec['global_properties'].recursive_merge!(spec['cluster_properties'])

    if spec['job_properties']
    	properties1 = spec['job_properties']
    else
    	properties1 = spec['global_properties'].recursive_merge!(spec['cluster_properties'])
    end

    properties = {}
    spec['default_properties'].each do |name, value|
      copy_property(properties, properties1, name, value)<commit_msg>Revert "allow instance group level properties"<commit_after>package erbrenderer

const templateEvaluationContextRb = `
# Based on common/properties/template_evaluation_context.rb
require "rubygems"
require "ostruct"
require "json"
require "erb"
require "yaml"

class Hash
  def recursive_merge!(other)
    self.merge!(other) do |_, old_value, new_value|
      if old_value.class == Hash && new_value.class == Hash
        old_value.recursive_merge!(new_value)
      else
        new_value
      end
    end
    self
  end
end

class TemplateEvaluationContext
  attr_reader :name, :index
  attr_reader :properties, :raw_properties
  attr_reader :spec

  def initialize(spec)
    @name = spec["job"]["name"] if spec["job"].is_a?(Hash)
    @index = spec["index"]

    properties1 = spec['global_properties'].recursive_merge!(spec['cluster_properties'])
    properties = {}
    spec['default_properties'].each do |name, value|
      copy_property(properties, properties1, name, value)
{'fraction_non_alphanumeric': 0.11005692599620494, 'fraction_numerical': 0.0028462998102466793, 'mean_word_length': 4.339240506329114, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6646806', 'n_tokens_mistral': 647, 'n_tokens_neox': 632, 'n_words': 146}