<commit_before>require 'puppet'

# Possible values for an enabled repo are 'yes', '1', and 'true'.
# Everything else is considered disabled. However, there is a
# special case where a [repository] entry doesn't include an
# entry for 'enabled'. YUM treats those as enabled repos, and in
# the Puppet catalog, a yumrepo resource without an attribute has
# that attribute marked as ':absent', so we need to look for that.
def to_boolean(value)
  %w[absent yes true 1].include?(value.downcase)
end

Facter.add(:yumrepos) do
  confine osfamily: 'RedHat'

  setcode do
    enabled_repos  = []
    disabled_repos = []

    Puppet::Type.type('yumrepo').instances.find_all do |repo|
      repo_value = repo.retrieve

      # Take the 'enabled' attribute of each repo, convert it to a boolean, and use that result
      # to the repo's name to the enabled or disabled list.<commit_msg>Improve the comment explaining how things work<commit_after>require 'puppet'

# Possible values for an enabled repo are 'yes', '1', and 'true'.
# Everything else is considered disabled. However, there is a
# special case where a [repository] entry doesn't include an
# entry for 'enabled'. YUM treats those as enabled repos, and in
# the Puppet catalog, a yumrepo resource without an attribute has
# that attribute marked as ':absent', so we need to look for that.
def to_boolean(value)
  %w[absent yes true 1].include?(value.downcase)
end

Facter.add(:yumrepos) do
  confine osfamily: 'RedHat'

  setcode do
    enabled_repos  = []
    disabled_repos = []

    Puppet::Type.type('yumrepo').instances.find_all do |repo|
      repo_value = repo.retrieve

      # 1. Take the 'enabled' attribute of each repo and convert it to a boolean true or false.
      # 2. Add the repo's name to the enabled or disabled list based on the boolean value.
{'fraction_non_alphanumeric': 0.08755506607929515, 'fraction_numerical': 0.003303964757709251, 'mean_word_length': 3.8975741239892185, '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': '774171', 'n_tokens_mistral': 556, 'n_tokens_neox': 532, 'n_words': 234}