<commit_before>require 'etc'
require 'fileutils'
require 'cfpropertylist'

Puppet::Type.type(:propertylist).provide(:default) do

  confine :operatingsystem => :darwin

  mk_resource_methods

  class << self

    def instances
      args = Puppet::Util::CommandLine.new.args
      resource_type, resource_name = args.each { |x| x }
      unless resource_name
        err = ['Listing propertylist instances is not supported.',
        'Please specify a file or directory, e.g. puppet resource file /etc'].join(' ')
        raise Puppet::Error, err
      end
      [ new(get_propertylist_properties(resource_name)) ]
    end

    def prefetch(resources)
      if resource = resources.values.first
        resource.provider = new(get_propertylist_properties(resources.keys.first))
      end
    end

    def get_propertylist_properties(path)
      absent = { :name => path, :ensure => :absent }<commit_msg>bug fix: #prefetch was not processing all resources<commit_after>require 'etc'
require 'fileutils'
require 'cfpropertylist'

Puppet::Type.type(:propertylist).provide(:default) do

  confine :operatingsystem => :darwin

  mk_resource_methods

  class << self

    def instances
      args = Puppet::Util::CommandLine.new.args
      resource_type, resource_name = args.each { |x| x }
      unless resource_name
        err = ['Listing propertylist instances is not supported.',
        'Please specify a file or directory, e.g. puppet resource file /etc'].join(' ')
        raise Puppet::Error, err
      end
      [ new(get_propertylist_properties(resource_name)) ]
    end

    def prefetch(resources)
      resources.each do |k,v|
        v.provider = new(get_propertylist_properties(k))
      end
    end

    def get_propertylist_properties(path)
      absent = { :name => path, :ensure => :absent }
{'fraction_non_alphanumeric': 0.10249307479224377, 'fraction_numerical': 0.0, 'mean_word_length': 3.279620853080569, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '922752', 'n_tokens_mistral': 538, 'n_tokens_neox': 523, 'n_words': 137}