<commit_before>class RespondusAPIMiddleware
  class_inheritable_accessor :servant

  Endpoint = %r{\A/api/respondus/soap}

  def self.plugin_enabled?
    plugin = Canvas::Plugin.find(:respondus_soap_endpoint)
    plugin.settings[:enabled] == 'true'
  end

  # The first time a call to this API is made, and the plugin is enabled, we
  # call do_setup. This requires the needed SOAP libraries, mixes in the
  # Soap4r::Middleware class, and replaces our call method with the one that
  # actually exposes the SOAP endpoint. Then we return to call, and it calls
  # super to get Soap4r::Middleware's call method that was just mixed in. It's
  # a bit dirty, but we save a lot of memory by not loading all these libraries
  # in processes where this API isn't going to get used, since we don't use
  # soap4r or REXML or any of those anywhere else.
  def self.do_setup
    # an issue with load orders causes us to load the ruby-provided soap4r on
    # some systems, rather than the soap4r gem that we specified (1.5.8). This
    # code ensures that our gem is on the front of the load order, before the
    # system ruby load path.
    # see http://code.google.com/p/phusion-passenger/issues/detail?id=133
    soap_gem_path_idx = $LOAD_PATH.index { |p| p =~ /\/soap4r-[\d.]+\/lib/ }
    if soap_gem_path_idx
      soap_gem_path = $LOAD_PATH.delete_at(soap_gem_path_idx)
      $LOAD_PATH.unshift(soap_gem_path)
    end

    remove_method :call # we'll just use soap4r-middleware's
    Bundler.require 'respondus_soap_endpoint'
    include Soap4r::Middleware
    require_dependency 'respondus_soap_endpoint'
    setup do
      self.endpoint = Endpoint<commit_msg>spec: fix respondus spec fragility<commit_after>class RespondusAPIMiddleware
  class_inheritable_accessor :servant

  Endpoint = %r{\A/api/respondus/soap}

  def self.plugin_enabled?
    plugin = Canvas::Plugin.find(:respondus_soap_endpoint)
    plugin.settings[:enabled] == 'true'
  end

  # The first time a call to this API is made, and the plugin is enabled, we
  # call do_setup. This requires the needed SOAP libraries, mixes in the
  # Soap4r::Middleware class, and replaces our call method with the one that
  # actually exposes the SOAP endpoint. Then we return to call, and it calls
  # super to get Soap4r::Middleware's call method that was just mixed in. It's
  # a bit dirty, but we save a lot of memory by not loading all these libraries
  # in processes where this API isn't going to get used, since we don't use
  # soap4r or REXML or any of those anywhere else.
  def self.do_setup
    # an issue with load orders causes us to load the ruby-provided soap4r on
    # some systems, rather than the soap4r gem that we specified (1.5.8). This
    # code ensures that our gem is on the front of the load order, before the
    # system ruby load path.
    # see http://code.google.com/p/phusion-passenger/issues/detail?id=133
    soap_gem_path_idx = $LOAD_PATH.index { |p| p.to_s =~ /\/soap4r-[\d.]+\/lib/ }
    if soap_gem_path_idx
      soap_gem_path = $LOAD_PATH.delete_at(soap_gem_path_idx)
      $LOAD_PATH.unshift(soap_gem_path)
    end

    remove_method :call # we'll just use soap4r-middleware's
    Bundler.require 'respondus_soap_endpoint'
    include Soap4r::Middleware
    require_dependency 'respondus_soap_endpoint'
    setup do
      self.endpoint = Endpoint
{'fraction_non_alphanumeric': 0.07655502392344497, 'fraction_numerical': 0.008373205741626795, 'mean_word_length': 3.59478021978022, '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': '2371599', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1035, 'n_words': 383}