<commit_before># Make virtualenv version available as a fact

Facter.add('virtualenv_version') do
  setcode do
    if Facter::Util::Resolution.which('virtualenv')
      Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{(\d+\.\d+\.?\d*).*$})[1]
    end
  end
end
<commit_msg>Improve handling of missing output of virtualenv version fact command<commit_after># Make virtualenv version available as a fact

Facter.add('virtualenv_version') do
  setcode do
    if Facter::Util::Resolution.which('virtualenv')
      results = Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{(\d+\.\d+\.?\d*).*$})
      results[1] if results
    end
  end
end

{'fraction_non_alphanumeric': 0.16444444444444445, 'fraction_numerical': 0.008888888888888889, 'mean_word_length': 4.322834645669292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5503565', 'n_tokens_mistral': 224, 'n_tokens_neox': 216, 'n_words': 53}