<commit_before>module SupportsFeatureMixin
  #
  # Including this in a model gives you a DSL to make features supported or not
  #
  #   class Post
  #     include SupportsFeatureMixin
  #     supports :publish
  #     supports_not :fake, :reason => 'We keep it real'
  #     supports :archive do
  #       unsupported_reason_add(:archive, 'Its too good') if featured?
  #     end
  #   end
  #
  # To make a feature conditionally supported, pass a block to the +supports+ method.
  # The block is evaluated in the context of the instance.
  # If you call the private method +unsupported_reason_add+ with the feature
  # and a reason, then the feature will be unsupported and the reason will be
  # accessible through
  #
  #   instance.unsupported_reason(:feature)
  #
  # The above allows you to call +supports_feature?+ or +supports?(feature) :methods
  # on the Class and Instance
  #
  #   Post.supports_publish?                       # => true
  #   Post.supports?(:publish)                     # => true
  #   Post.new.supports_publish?                   # => true
  #   Post.supports_fake?                          # => false
  #   Post.supports_archive?                       # => true
  #   Post.new(featured: true).supports_archive?   # => false
  #
  # To get a reason why a feature is unsupported use the +unsupported_reason+ method
  #
  #   Post.unsupported_reason(:publish)                     # => "Feature not supported"
  #   Post.unsupported_reason(:fake)                        # => "We keep it real"
  #   Post.new(featured: true).unsupported_reason(:archive) # => "Its too good"
  #
  # To query for known features you can ask the class or the instance via +feature_known?+
  #
  #   Post.feature_known?('fake')     # => true
  #   Post.new.feature_known?(:fake)  # => true
  #   Post.new.feature_known?(:alert) # => false
  #
  # If you include this concern in a Module that gets included by the Model
  # you have to extend that model with +ActiveSupport::Concern+ and wrap the
  # +supports+ calls in an +included+ block. This is also true for modules in between!
  #
  #   module Operations
  #     extend ActiveSupport::Concern
  #     module Power
  #       extend ActiveSupport::Concern
  #       included do
  #         supports :operation
  #       end
  #     end
  #   end
  #
  extend ActiveSupport::Concern

  QUERYABLE_FEATURES = {
    :associate_floating_ip        => 'Associate a Floating IP',
    :control                      => 'Basic control operations', # FIXME: this is just a internal helper and should be refactored
    :cloud_tenant_mapping         => 'CloudTenant mapping',
    :backup_create                => 'CloudVolume backup creation',
    :backup_restore               => 'CloudVolume backup restore',
    :cinder_service               => 'Cinder storage service',
    :swift_service                => 'Swift storage service',
    :delete                       => 'Deletion',
    :disassociate_floating_ip     => 'Disassociate a Floating IP',
    :discovery                    => 'Discovery of Managers for a Provider',
    :evacuate                     => 'Evacuation',
    :events                       => 'Query for events',
    :launch_cockpit               => 'Launch Cockpit UI',
    :live_migrate                 => 'Live Migration',
    :migrate                      => 'Migration',
    :provisioning                 => 'Provisioning',
    :reboot_guest                 => 'Reboot Guest Operation',
    :reconfigure                  => 'Reconfiguration',
    :refresh_new_target           => 'Refresh non-existing record',
    :regions                      => 'Regions of a Provider',
    :resize                       => 'Resizing',
    :retire                       => 'Retirement',
    :smartstate_analysis          => 'Smartstate Analaysis',
  }.freeze

  # Whenever this mixin is included we define all features as unsupported by default.
  # This way we can query for every feature
  included do
    QUERYABLE_FEATURES.keys.each do |feature|
      supports_not(feature)
    end
  end<commit_msg>add :terminate to SupportFeatureMixin list<commit_after>module SupportsFeatureMixin
  #
  # Including this in a model gives you a DSL to make features supported or not
  #
  #   class Post
  #     include SupportsFeatureMixin
  #     supports :publish
  #     supports_not :fake, :reason => 'We keep it real'
  #     supports :archive do
  #       unsupported_reason_add(:archive, 'Its too good') if featured?
  #     end
  #   end
  #
  # To make a feature conditionally supported, pass a block to the +supports+ method.
  # The block is evaluated in the context of the instance.
  # If you call the private method +unsupported_reason_add+ with the feature
  # and a reason, then the feature will be unsupported and the reason will be
  # accessible through
  #
  #   instance.unsupported_reason(:feature)
  #
  # The above allows you to call +supports_feature?+ or +supports?(feature) :methods
  # on the Class and Instance
  #
  #   Post.supports_publish?                       # => true
  #   Post.supports?(:publish)                     # => true
  #   Post.new.supports_publish?                   # => true
  #   Post.supports_fake?                          # => false
  #   Post.supports_archive?                       # => true
  #   Post.new(featured: true).supports_archive?   # => false
  #
  # To get a reason why a feature is unsupported use the +unsupported_reason+ method
  #
  #   Post.unsupported_reason(:publish)                     # => "Feature not supported"
  #   Post.unsupported_reason(:fake)                        # => "We keep it real"
  #   Post.new(featured: true).unsupported_reason(:archive) # => "Its too good"
  #
  # To query for known features you can ask the class or the instance via +feature_known?+
  #
  #   Post.feature_known?('fake')     # => true
  #   Post.new.feature_known?(:fake)  # => true
  #   Post.new.feature_known?(:alert) # => false
  #
  # If you include this concern in a Module that gets included by the Model
  # you have to extend that model with +ActiveSupport::Concern+ and wrap the
  # +supports+ calls in an +included+ block. This is also true for modules in between!
  #
  #   module Operations
  #     extend ActiveSupport::Concern
  #     module Power
  #       extend ActiveSupport::Concern
  #       included do
  #         supports :operation
  #       end
  #     end
  #   end
  #
  extend ActiveSupport::Concern

  QUERYABLE_FEATURES = {
    :associate_floating_ip        => 'Associate a Floating IP',
    :control                      => 'Basic control operations', # FIXME: this is just a internal helper and should be refactored
    :cloud_tenant_mapping         => 'CloudTenant mapping',
    :backup_create                => 'CloudVolume backup creation',
    :backup_restore               => 'CloudVolume backup restore',
    :cinder_service               => 'Cinder storage service',
    :swift_service                => 'Swift storage service',
    :delete                       => 'Deletion',
    :disassociate_floating_ip     => 'Disassociate a Floating IP',
    :discovery                    => 'Discovery of Managers for a Provider',
    :evacuate                     => 'Evacuation',
    :events                       => 'Query for events',
    :launch_cockpit               => 'Launch Cockpit UI',
    :live_migrate                 => 'Live Migration',
    :migrate                      => 'Migration',
    :provisioning                 => 'Provisioning',
    :reboot_guest                 => 'Reboot Guest Operation',
    :reconfigure                  => 'Reconfiguration',
    :refresh_new_target           => 'Refresh non-existing record',
    :regions                      => 'Regions of a Provider',
    :resize                       => 'Resizing',
    :retire                       => 'Retirement',
    :smartstate_analysis          => 'Smartstate Analaysis',
    :terminate                => 'Terminate a VM'
  }.freeze

  # Whenever this mixin is included we define all features as unsupported by default.
  # This way we can query for every feature
  included do
    QUERYABLE_FEATURES.keys.each do |feature|
      supports_not(feature)
    end
  end
{'fraction_non_alphanumeric': 0.0901449628456572, 'fraction_numerical': 0.0, 'mean_word_length': 2.0441230997404523, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 76, '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': '7380772', 'n_tokens_mistral': 2298, 'n_tokens_neox': 2228, 'n_words': 699}