<commit_before>module Byebug
  #
  # Mantains context information for the debugger and it's the main
  # communication point between the library and the C-extension through the
  # at_breakpoint, at_catchpoint, at_tracing, at_line and at_return callbacks
  #
  class Context
    def stack_size
      return 0 unless backtrace

      backtrace.drop_while { |l| Byebug.ignored?(l.first.path) }
        .take_while { |l| !Byebug.ignored?(l.first.path) }
        .size
    end

    def interrupt
      step_into 1
    end

    #
    # Gets local variables for a frame.
    #
    # @param frame_no Frame index in the backtrace. Defaults to 0.
    #
    # TODO: Use brand new local_variable_{get,set,defined?} for rubies >= 2.1
    #
    def frame_locals(frame_no = 0)
      bind = frame_binding(frame_no)
      return [] unless bind

      bind.eval('local_variables.inject({}){|h, v| h[v] = eval(v.to_s); h}')
    end

    #
    # Gets current method arguments for a frame.
    #
    # @param frame_no Frame index in the backtrace. Defaults to 0.
    #
    def frame_args(frame_no = 0)
      bind = frame_binding(frame_no)
      return c_frame_args(frame_no) unless bind

      ruby_frame_args(bind)
    end

    def handler
      Byebug.handler || fail('No interface loaded')
    end

    def at_breakpoint(brkpnt)
      handler.at_breakpoint(self, brkpnt)
    end

    def at_catchpoint(excpt)
      handler.at_catchpoint(self, excpt)
    end

    def at_tracing(file, line)
      handler.at_tracing(self, file, line) unless IGNORED_FILES.include?(file)
    end

    def at_line(file, line)
      handler.at_line(self, file, line) unless IGNORED_FILES.include?(file)
    end

    def at_return(file, line)
      handler.at_return(self, file, line)
    end

    private

    #<commit_msg>Never stop at Byebug's internals<commit_after>module Byebug
  #
  # Mantains context information for the debugger and it's the main
  # communication point between the library and the C-extension through the
  # at_breakpoint, at_catchpoint, at_tracing, at_line and at_return callbacks
  #
  class Context
    def stack_size
      return 0 unless backtrace

      backtrace.drop_while { |l| Byebug.ignored?(l.first.path) }
        .take_while { |l| !Byebug.ignored?(l.first.path) }
        .size
    end

    def interrupt
      step_into 1
    end

    #
    # Gets local variables for a frame.
    #
    # @param frame_no Frame index in the backtrace. Defaults to 0.
    #
    # TODO: Use brand new local_variable_{get,set,defined?} for rubies >= 2.1
    #
    def frame_locals(frame_no = 0)
      bind = frame_binding(frame_no)
      return [] unless bind

      bind.eval('local_variables.inject({}){|h, v| h[v] = eval(v.to_s); h}')
    end

    #
    # Gets current method arguments for a frame.
    #
    # @param frame_no Frame index in the backtrace. Defaults to 0.
    #
    def frame_args(frame_no = 0)
      bind = frame_binding(frame_no)
      return c_frame_args(frame_no) unless bind

      ruby_frame_args(bind)
    end

    def handler
      Byebug.handler || fail('No interface loaded')
    end

    def at_breakpoint(brkpnt)
      handler.at_breakpoint(self, brkpnt)
    end

    def at_catchpoint(excpt)
      handler.at_catchpoint(self, excpt)
    end

    def at_tracing(file, line)
      handler.at_tracing(self, file, line) unless IGNORED_FILES.include?(file)
    end

    def at_line(file, line)
      handler.at_line(self, file, line) unless IGNORED_FILES.include?(file)
    end

    def at_return(file, line)
      handler.at_return(self, file, line) unless IGNORED_FILES.include?(file)
    end

    private

    #
{'fraction_non_alphanumeric': 0.08855172413793104, 'fraction_numerical': 0.004413793103448276, 'mean_word_length': 2.7151639344262297, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4586823', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1209, 'n_words': 324}