<commit_before>module Committee
  module Bin
    # CommitteeStub internalizes the functionality of bin/committee-stub so
    # that we can test code that would otherwise be difficult to get at in an
    # executable.
    class CommitteeStub
      # Gets a Rack app suitable for use as a stub.
      def get_app(schema, options)
        Rack::Builder.new {
          unless options[:tolerant]
            use Committee::Middleware::RequestValidation, schema: schema
            use Committee::Middleware::ResponseValidation, schema: schema
          end

          use Committee::Middleware::Stub, schema: schema

          run lambda { |_|
            [404, {}, ["Not found"]]
          }
        }
      end

      # Gets an option parser for command line arguments.
      def get_options_parser
        options = {
          :driver   => :hyper_schema,
          :help     => false,
          :port     => 9292,<commit_msg>Cache stub results for committee-stub<commit_after>module Committee
  module Bin
    # CommitteeStub internalizes the functionality of bin/committee-stub so
    # that we can test code that would otherwise be difficult to get at in an
    # executable.
    class CommitteeStub
      # Gets a Rack app suitable for use as a stub.
      def get_app(schema, options)
        cache = {}

        Rack::Builder.new {
          unless options[:tolerant]
            use Committee::Middleware::RequestValidation, schema: schema
            use Committee::Middleware::ResponseValidation, schema: schema
          end

          use Committee::Middleware::Stub, cache: cache, schema: schema

          run lambda { |_|
            [404, {}, ["Not found"]]
          }
        }
      end

      # Gets an option parser for command line arguments.
      def get_options_parser
        options = {
          :driver   => :hyper_schema,
          :help     => false,
          :port     => 9292,
{'fraction_non_alphanumeric': 0.07756813417190776, 'fraction_numerical': 0.007337526205450734, 'mean_word_length': 2.049520766773163, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5431788', 'n_tokens_mistral': 485, 'n_tokens_neox': 478, 'n_words': 168}