<commit_before>module Nexpose
# Constants useful across the Nexpose module.
# Configuration structure for blackouts.
  class Blackout < APIObject
    # Whether or not this blackout is enabled.
    attr_accessor :enabled
    # Valid schedule types: daily, hourly, monthly-date, monthly-day, weekly.
    attr_accessor :blackout_type
    # The repeat interval based upon type.
    attr_accessor :blackout_interval
    # The earliest date to generate the report on (in ISO 8601 format).
    attr_accessor :blackout_start
    # The amount of time, in minutes, a blackout period should last.
    attr_accessor :blackout_duration

    def initialize(start, enabled=true, duration, type, interval)
      @blackout_start = start
      @enabled =enabled
      @blackout_duration = duration.to_i
      @blackout_type = type
      @blackout_interval = interval.to_i
    end

    def self.from_hash(hash)
      repeat_blackout_hash = hash[:repeat_blackout]
      blackout = new(hash[:start_date], hash[:blackout_duration], repeat_blackout_hash[:type], repeat_blackout_hash[:interval])
      blackout
    end<commit_msg>first attempt for fix of hash failure of blackouts<commit_after>module Nexpose
# Constants useful across the Nexpose module.
# Configuration structure for blackouts.
  class Blackout < APIObject
    # Whether or not this blackout is enabled.
    attr_accessor :enabled
    # Valid schedule types: daily, hourly, monthly-date, monthly-day, weekly.
    attr_accessor :blackout_type
    # The repeat interval based upon type.
    attr_accessor :blackout_interval
    # The earliest date to generate the report on (in ISO 8601 format).
    attr_accessor :blackout_start
    # The amount of time, in minutes, a blackout period should last.
    attr_accessor :blackout_duration

    def initialize(start, enabled=true, duration, type, interval)
      @blackout_start    = start
      @enabled           = enabled
      @blackout_duration = duration.to_i
      @blackout_type     = type
      @blackout_interval = interval.to_i
    end

    def self.from_hash(hash)
      repeat_blackout_hash = hash[:repeat_blackout]

      if repeat_blackout_hash.nil?
        type     = 'daily'
        interval = 0
      else
        type     = repeat_blackout_hash[:type]
        interval = repeat_blackout_hash[:interval]
      end

      new(hash[:start_date], hash[:blackout_duration], type, interval)
    end
{'fraction_non_alphanumeric': 0.06794497707378074, 'fraction_numerical': 0.003751563151313047, 'mean_word_length': 3.324324324324324, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4002684', 'n_tokens_mistral': 692, 'n_tokens_neox': 671, 'n_words': 211}