<commit_before>require 'battman'

Battman::Battman.new do |battman|

  battman.watch :acpi do |watcher|

    current_state = :discharging # defaulting to discharging

    watcher.every 2.seconds do |status|

      status.check(:state) do |value, last_value|
        current_state = value
        state_changed = value != last_value

        if state_changed
          `notify-send 'Battery is #{current_state}'`
        end
      end

    end

    watcher.every 60.seconds do |status|

      suspend = false

      status.check(:remaining_percent) do |value|

        if current_state == :discharging && value.in?(0...5)
          `i3lock && systemctl suspend` if suspend
          `notify-send -u critical 'Battery is critical'`

          if value.in?(0..2)
            `notify-send -u critical 'Suspending in 60 seconds! (plug in cable to abort)'`
            suspend = true
          end
        else
          suspend = false
        end

      end

    end

    watcher.every 5.minutes do |status|

      status.check(:remaining_percent) do |value|
        if current_state == :discharging && value.in?(5...10)
          `notify-send -u normal 'Battery is low'`
        end
      end

    end

  end

  battman.run
end
<commit_msg>Fixed grammar mistake in a notification message in example<commit_after>require 'battman'

Battman::Battman.new do |battman|

  battman.watch :acpi do |watcher|

    current_state = :discharging # defaulting to discharging

    watcher.every 2.seconds do |status|

      status.check(:state) do |value, last_value|
        current_state = value
        state_changed = value != last_value

        if state_changed
          `notify-send 'Battery is #{current_state}'`
        end
      end

    end

    watcher.every 60.seconds do |status|

      suspend = false

      status.check(:remaining_percent) do |value|

        if current_state == :discharging && value.in?(0...5)
          `i3lock && systemctl suspend` if suspend
          `notify-send -u critical 'Battery level is critical!'`

          if value.in?(0..2)
            `notify-send -u critical 'Suspending in 60 seconds! (plug in cable to abort)'`
            suspend = true
          end
        else
          suspend = false
        end

      end

    end

    watcher.every 5.minutes do |status|

      status.check(:remaining_percent) do |value|
        if current_state == :discharging && value.in?(5...10)
          `notify-send -u normal 'Battery is low'`
        end
      end

    end

  end

  battman.run
end

{'fraction_non_alphanumeric': 0.0946159936658749, 'fraction_numerical': 0.011084718923198733, 'mean_word_length': 2.044578313253012, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6298967', 'n_tokens_mistral': 799, 'n_tokens_neox': 757, 'n_words': 221}