<commit_before>module Rspec
  module Bash
    class CallLog
      def initialize(call_log_path)
        @call_log_path = call_log_path
        @call_log = []
      end

      def exist?
        @call_log_path.exist?
      end

      def stdin_for_args(*argument_list)
        call_argument_list_matcher = Util::CallLogArgumentListMatcher.new(*argument_list)
        matching_call_log_list = call_argument_list_matcher.get_call_log_matches(call_log)
        matching_call_log_list.first[:stdin] unless matching_call_log_list.empty?
      end

      def call_count(*argument_list)
        call_argument_list_matcher = Util::CallLogArgumentListMatcher.new(*argument_list)
        call_argument_list_matcher.get_call_count(call_log)
      end

      def called_with_args?(*argument_list)
        call_argument_list_matcher = Util::CallLogArgumentListMatcher.new(*argument_list)
        call_argument_list_matcher.args_match?(call_log)
      end

      def called_with_no_args?
        !call_log_arguments.empty? && call_log_arguments.all?(&:empty?)
      end

      def add_log(stdin, argument_list)
        @call_log = call_log
        @call_log << {
          args: argument_list,
          stdin: stdin
        }
        write
      end

      def call_log
        return @call_log unless @call_log.empty?
        begin
          @call_log_path.open('r') do |call_log|
            YAML.load(call_log.read) || []
          end
        rescue NoMethodError, Errno::ENOENT
          return []
        end
      end

      def call_log=(new_log)
        @call_log = new_log
      end

      private

      def call_log_arguments
        call_log.map { |call_log| call_log[:args] || [] }.compact
      end

      def write
        @call_log_path.open('w') do |call_log|
          call_log.write @call_log.to_yaml
        end
      end
    end
  end
end<commit_msg>make the called_with_no_args? method slightly more expressive<commit_after>module Rspec
  module Bash
    class CallLog
      def initialize(call_log_path)
        @call_log_path = call_log_path
        @call_log = []
      end

      def exist?
        @call_log_path.exist?
      end

      def stdin_for_args(*argument_list)
        call_argument_list_matcher = Util::CallLogArgumentListMatcher.new(*argument_list)
        matching_call_log_list = call_argument_list_matcher.get_call_log_matches(call_log)
        matching_call_log_list.first[:stdin] unless matching_call_log_list.empty?
      end

      def call_count(*argument_list)
        call_argument_list_matcher = Util::CallLogArgumentListMatcher.new(*argument_list)
        call_argument_list_matcher.get_call_count(call_log)
      end

      def called_with_args?(*argument_list)
        call_argument_list_matcher = Util::CallLogArgumentListMatcher.new(*argument_list)
        call_argument_list_matcher.args_match?(call_log)
      end

      def called_with_no_args?
        return false if call_log.empty?

        call_log.all? do |call_log|
          argument_list = call_log[:args] || []
          argument_list.empty?
        end
      end

      def add_log(stdin, argument_list)
        @call_log = call_log
        @call_log << {
          args: argument_list,
          stdin: stdin
        }
        write
      end

      def call_log
        return @call_log unless @call_log.empty?
        begin
          @call_log_path.open('r') do |call_log|
            YAML.load(call_log.read) || []
          end
        rescue NoMethodError, Errno::ENOENT
          return []
        end
      end

      def call_log=(new_log)
        @call_log = new_log
      end

      private

      def write
        @call_log_path.open('w') do |call_log|
          call_log.write @call_log.to_yaml
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0740543420351625, 'fraction_numerical': 0.0, 'mean_word_length': 2.325952170062002, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1522328', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1180, 'n_words': 203}