<commit_before>module NanoBox
  module Output
    
    def logtap
      $logtap ||= ::NanoBox::Logtap.new(uri: payload[:logtap_uri])
    end

    # header
    # 
    # Print a header, formatted to 70 characters, with the label
    # 
    # Example:
    # 
    # header "headline here"
    # 
    # would produce:
    # ::::::::::::::::::::::::::: HEADLINE HERE :::::::::::::::::::::::::::
    def header(label)
      label = label.upcase
      max_len = 70
      middle = label.length + 2
      remainder = max_len - middle
      left = remainder / 2

      if remainder % 2 == 0
        right = left
      else
        right = left + 1
      end

      res = ""

      # start with a newline
      res << "\n"

      # print the left column
      left.times { res << ':' }

      # print a space
      res << " "

      # print the label
      res << label

      # print the right column
      right.times { res << ':' }

      # end with two newlines
      res << "\n\n"

      res
    end

    # process_start
    # 
    # Print a header indicating the start of a process.
    # 
    # Example:
    # 
    # process_start "build output"
    # 
    # would produce:
    # BUILD OUTPUT ::::::::::::::::::::::::::::::::::::::::::::::::::::: =>
    def process_start(label)
      label = label.upcase
      max_len = 70
      left = label.length + 1
      right = 3
      middle = max_len - (left + right)

      res = ""

      # start with a newline
      res << "\n"

      # print label
      res << label

      # print a space
      res << " "

      # print middle column
      middle.times { res << ':'}

      # print the right column
      res << " =>"

      # end with two newlines
      res << "\n\n"

      res
    end

    # process_end
    # 
    # Print a header indicating the end of a process.
    # 
    # Example:
    # 
    # process_end "build output"
    # 
    # would produce:
    # <= ::::::::::::::::::::::::::::::::::::::::::::::::: END BUILD OUTPUT
    def process_end(label)
      label = "end #{label}".upcase
      max_len = 70
      left = 3
      right = label.length + 1
      middle = max_len - (left + right)

      res = ""

      # start with a newline
      res << "\n"

      # print the left column
      res << "<= "

      # print middle column
      middle.times { res << ':'}

      # print a space
      res << " "

      # print label
      res << label

      # end with two newlines
      res << "\n\n"

      res
    end

    # subtask_start
    # 
    # Print a header indicating the start of a sub task
    # 
    # Example:
    # 
    # subtask_start "after build hook 1"
    # 
    # would produce:
    # ::::::::: AFTER BUILD HOOK 1
    def subtask_start(label)
      "\n::::::::: #{label.upcase}\n"
    end

    # subtask_success
    # 
    # Print a footer indicating a successful sub task
    # 
    # Example:
    # 
    # subtask_success
    # 
    # would produce:
    # <<<<<<<<< [√] SUCCESS
    def subtask_success<commit_msg>trying output styles without empty lines<commit_after>module NanoBox
  module Output
    
    def logtap
      $logtap ||= ::NanoBox::Logtap.new(uri: payload[:logtap_uri])
    end

    # header
    # 
    # Print a header, formatted to 70 characters, with the label
    # 
    # Example:
    # 
    # header "headline here"
    # 
    # would produce:
    # ::::::::::::::::::::::::::: HEADLINE HERE :::::::::::::::::::::::::::
    def header(label)
      label = label.upcase
      max_len = 70
      middle = label.length + 2
      remainder = max_len - middle
      left = remainder / 2

      if remainder % 2 == 0
        right = left
      else
        right = left + 1
      end

      res = ""

      # start with a newline
      # res << "\n"

      # print the left column
      left.times { res << ':' }

      # print a space
      res << " "

      # print the label
      res << label

      # print the right column
      right.times { res << ':' }

      # end with two newlines
      res << "\n"
      # res << "\n\n"

      res
    end

    # process_start
    # 
    # Print a header indicating the start of a process.
    # 
    # Example:
    # 
    # process_start "build output"
    # 
    # would produce:
    # BUILD OUTPUT ::::::::::::::::::::::::::::::::::::::::::::::::::::: =>
    def process_start(label)
      label = label.upcase
      max_len = 70
      left = label.length + 1
      right = 3
      middle = max_len - (left + right)

      res = ""

      # start with a newline
      res << "\n"

      # print label
      res << label

      # print a space
      res << " "

      # print middle column
      middle.times { res << ':'}

      # print the right column
      res << " =>"

      # end with two newlines
      res << "\n"
      # res << "\n\n"

      res
    end

    # process_end
    # 
    # Print a header indicating the end of a process.
    # 
    # Example:
    # 
    # process_end "build output"
    # 
    # would produce:
    # <= ::::::::::::::::::::::::::::::::::::::::::::::::: END BUILD OUTPUT
    def process_end(label)
      label = "end #{label}".upcase
      max_len = 70
      left = 3
      right = label.length + 1
      middle = max_len - (left + right)

      res = ""

      # start with a newline
      res << "\n"

      # print the left column
      res << "<= "

      # print middle column
      middle.times { res << ':'}

      # print a space
      res << " "

      # print label
      res << label

      # end with two newlines
      res << "\n"
      # res << "\n\n"

      res
    end

    # subtask_start
    # 
    # Print a header indicating the start of a sub task
    # 
    # Example:
    # 
    # subtask_start "after build hook 1"
    # 
    # would produce:
    # ::::::::: AFTER BUILD HOOK 1
    def subtask_start(label)
      "\n::::::::: #{label.upcase}\n"
    end

    # subtask_success
    # 
    # Print a footer indicating a successful sub task
    # 
    # Example:
    # 
    # subtask_success
    # 
    # would produce:
    # <<<<<<<<< [√] SUCCESS
    def subtask_success
{'fraction_non_alphanumeric': 0.15565804645033768, 'fraction_numerical': 0.006259265359907758, 'mean_word_length': 1.6240276577355228, 'pattern_counts': {'":': 0, '<': 103, '<?xml version=': 0, '>': 7, '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': '6677490', 'n_tokens_mistral': 1936, 'n_tokens_neox': 1773, 'n_words': 550}