<commit_before>require 'forwardable'

require 'byebug/helpers/eval'
require 'byebug/errors'

module Byebug
  #
  # Processes commands in regular mode.
  #
  # You can override this class to create your own command processor that, for
  # example, whitelists only certain commands to be executed.
  #
  # @see PostMortemProcessor for a example
  #
  class CommandProcessor
    include Helpers::EvalHelper

    attr_accessor :prev_line
    attr_reader :context

    def initialize(context)
      @context = context

      @proceed = false
      @prev_line = nil
    end

    def interface
      @interface ||= Context.interface
    end

    def printer
      @printer ||= Printers::Plain.new
    end

    def frame
      @context.frame
    end

    extend Forwardable
    def_delegator :printer, :print, :pr
    def_delegator :printer, :print_collection, :prc
    def_delegator :printer, :print_variables, :prv

    def_delegators :interface, :errmsg, :puts, :confirm

    #
    # Available commands
    #
    def command_list
      @command_list ||= CommandList.new(commands)
    end

    def commands
      Byebug.commands
    end

    def at_breakpoint(brkpt)
      number = Byebug.breakpoints.index(brkpt) + 1

      puts "Stopped by breakpoint #{number} at #{frame.file}:#{frame.line}"
    end

    def at_catchpoint(exception)
      puts "Catchpoint at #{context.location}: `#{exception}'"
    end

    def at_tracing
      puts "Tracing: #{context.full_location}"

      run_auto_cmds(2)
    end

    def at_line
      process_commands
    end

    def at_return(return_value)
      puts "Return value is: #{return_value}"
<commit_msg>Better presentation for return values<commit_after>require 'forwardable'

require 'byebug/helpers/eval'
require 'byebug/errors'

module Byebug
  #
  # Processes commands in regular mode.
  #
  # You can override this class to create your own command processor that, for
  # example, whitelists only certain commands to be executed.
  #
  # @see PostMortemProcessor for a example
  #
  class CommandProcessor
    include Helpers::EvalHelper

    attr_accessor :prev_line
    attr_reader :context

    def initialize(context)
      @context = context

      @proceed = false
      @prev_line = nil
    end

    def interface
      @interface ||= Context.interface
    end

    def printer
      @printer ||= Printers::Plain.new
    end

    def frame
      @context.frame
    end

    extend Forwardable
    def_delegator :printer, :print, :pr
    def_delegator :printer, :print_collection, :prc
    def_delegator :printer, :print_variables, :prv

    def_delegators :interface, :errmsg, :puts, :confirm

    #
    # Available commands
    #
    def command_list
      @command_list ||= CommandList.new(commands)
    end

    def commands
      Byebug.commands
    end

    def at_breakpoint(brkpt)
      number = Byebug.breakpoints.index(brkpt) + 1

      puts "Stopped by breakpoint #{number} at #{frame.file}:#{frame.line}"
    end

    def at_catchpoint(exception)
      puts "Catchpoint at #{context.location}: `#{exception}'"
    end

    def at_tracing
      puts "Tracing: #{context.full_location}"

      run_auto_cmds(2)
    end

    def at_line
      process_commands
    end

    def at_return(return_value)
      puts "Return value is: #{safe_inspect(return_value)}"

{'fraction_non_alphanumeric': 0.08318264014466546, 'fraction_numerical': 0.0012055455093429777, 'mean_word_length': 2.845886442641947, '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': '5096480', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1040, 'n_words': 282}