<commit_before>class TreeBuilderInstances < TreeBuilder
  def tree_init_options(_tree_name)
    {
      :leaf => 'VmCloud'
    }
  end

  def x_get_tree_roots(options)
    objects = rbac_filtered_objects(EmsCloud.order("lower(name)"), :match_via_descendants => "VmCloud")
    objects += [
      {:id => "arch", :text => _("<Archived>"), :image => "currentstate-archived", :tip => _("Archived Instances")},
      {:id => "orph", :text => _("<Orphaned>"), :image => "currentstate-orphaned", :tip => _("Orphaned Instances")}
    ]
    count_only_or_objects(options[:count_only], objects, nil)
  end

  include TreeBuilderCommon
  include TreeBuilderArchived
end<commit_msg>Implement TreeBuilderInstances.<commit_after>class TreeBuilderInstances < TreeBuilder
  def tree_init_options(_tree_name)
    {
      :leaf => 'VmCloud'
    }
  end

  def set_locals_for_render
    locals = super
    locals.merge!(
      :tree_id   => "instances_treebox",
      :tree_name => "instances_tree",
      :id_prefix => "instances_",
      :autoload  => true
    )
  end

  def x_get_tree_roots(options)
    objects = rbac_filtered_objects(EmsCloud.order("lower(name)"), :match_via_descendants => "VmCloud")
    objects += [
      {:id => "arch", :text => _("<Archived>"), :image => "currentstate-archived", :tip => _("Archived Instances")},
      {:id => "orph", :text => _("<Orphaned>"), :image => "currentstate-orphaned", :tip => _("Orphaned Instances")}
    ]
    count_only_or_objects(options[:count_only], objects, nil)
  end

  def x_get_tree_ems_kids(object, options)
    objects = rbac_filtered_objects(object.availability_zones.order("name")) +
              rbac_filtered_objects(object.vms.where(:availability_zone_id => nil).order("name"))
    options[:count_only] ? objects.length : objects
  end

  # Get AvailabilityZone children count/array
  def x_get_tree_az_kids(object, options)
    objects = rbac_filtered_objects(object.vms.order("name"))
    options[:count_only] ? objects.length : objects
  end

  include TreeBuilderArchived
end
{'fraction_non_alphanumeric': 0.14447174447174446, 'fraction_numerical': 0.0, 'mean_word_length': 4.315926892950392, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 32, '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': '2131670', 'n_tokens_mistral': 690, 'n_tokens_neox': 672, 'n_words': 120}