<commit_before># Puppet Firewall type
require 'puppet/util/firewall'

Puppet::Type.newtype(:firewall) do
  include Puppet::Util::Firewall

  @doc = "This type provides the capability to manage firewall rules within 
          puppet."

  feature :rate_limiting, "Rate limiting features."
  feature :snat, "Source NATing"
  feature :dnat, "Destination NATing"
  feature :interface_match, "Interface matching"
  feature :icmp_match, "Matching ICMP types"
  feature :state_match, "Matching stateful firewall states"
  feature :reject_type, "The ability to control reject messages"
  feature :log_level, "The ability to control the log level"
  feature :log_prefix, "The ability to add prefixes to log messages"

  # provider specific features
  feature :iptables, "The provider provides iptables features."

  ensurable do
    desc "Manage the state of this rule."

    newvalue(:present) do
      desc "Ensure the rule is present"
      provider.insert
    end

    newvalue(:absent) do
      desc "Ensure the rule is absent"
      provider.delete
    end

    defaultto :present
  end

  newparam(:name) do
    desc "The canonical name of the rule."
    isnamevar

    # Keep rule names simple - they must start with a number
    newvalues(/^\d+[a-zA-Z0-9\s\-_]+$/)
  end

  newparam(:action) do
    desc "Action to perform on this rule."
    newvalues(:accept, :reject, :drop)
    defaultto :accept
  end

  # Generic matching properties
  newproperty(:source, :array_matching => :all) do
    desc "The source IP address to match. Accepts a string or array."

    def should_to_s(value)
      value = [value] unless value.is_a?(Array)
      value.join(',')
    end<commit_msg>Removed a bug I introduced from the last commit. 'desc' is not valid in ensure values.<commit_after># Puppet Firewall type
require 'puppet/util/firewall'

Puppet::Type.newtype(:firewall) do
  include Puppet::Util::Firewall

  @doc = "This type provides the capability to manage firewall rules within 
          puppet."

  feature :rate_limiting, "Rate limiting features."
  feature :snat, "Source NATing"
  feature :dnat, "Destination NATing"
  feature :interface_match, "Interface matching"
  feature :icmp_match, "Matching ICMP types"
  feature :state_match, "Matching stateful firewall states"
  feature :reject_type, "The ability to control reject messages"
  feature :log_level, "The ability to control the log level"
  feature :log_prefix, "The ability to add prefixes to log messages"

  # provider specific features
  feature :iptables, "The provider provides iptables features."

  ensurable do
    desc "Manage the state of this rule."

    newvalue(:present) do
      provider.insert
    end

    newvalue(:absent) do
      provider.delete
    end

    defaultto :present
  end

  newparam(:name) do
    desc "The canonical name of the rule."
    isnamevar

    # Keep rule names simple - they must start with a number
    newvalues(/^\d+[a-zA-Z0-9\s\-_]+$/)
  end

  newparam(:action) do
    desc "Action to perform on this rule."
    newvalues(:accept, :reject, :drop)
    defaultto :accept
  end

  # Generic matching properties
  newproperty(:source, :array_matching => :all) do
    desc "The source IP address to match. Accepts a string or array."

    def should_to_s(value)
      value = [value] unless value.is_a?(Array)
      value.join(',')
    end
{'fraction_non_alphanumeric': 0.08906156604901375, 'fraction_numerical': 0.001195457262402869, 'mean_word_length': 3.438992042440318, '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': '1082599', 'n_tokens_mistral': 1022, 'n_tokens_neox': 993, 'n_words': 368}