<commit_before>module Yelp
  class Error < StandardError
    def self.check_for_error(data)
      # Check if the status is in the range of non-error status codes
      return if (200..399).include?(data.status)

      body = JSON.parse(data.body)
      @error_classes ||= Hash.new do |hash, key|
        class_name = key.split('_').map(&:capitalize).join('').gsub('Oauth', 'OAuth')
        hash[key] = Yelp.const_get(class_name)
      end

      klass = error_classes[body['error']['id']]
      raise klass.new(body['error']['text'])
    end
  end

  class AlreadyConfigured < Error
    def initialize(msg = 'Gem cannot be reconfigured.  Initialize a new ' +
        'instance of Yelp::Client.')
      super
    end
  end

  class MissingAPIKeys < Error
    def initialize(msg = "You're missing an API key")
      super
    end
  end

  class MissingLatLng < Error
    def initialize(msg = 'Missing required latitude or longitude parameters')
      super
    end
  end

  class BoundingBoxNotComplete < Error
    def initialize(msg = 'Missing required values for bounding box')<commit_msg>Fix incorrect variable name for error_classes<commit_after>module Yelp
  class Error < StandardError
    def self.check_for_error(data)
      # Check if the status is in the range of non-error status codes
      return if (200..399).include?(data.status)

      body = JSON.parse(data.body)
      @error_classes ||= Hash.new do |hash, key|
        class_name = key.split('_').map(&:capitalize).join('').gsub('Oauth', 'OAuth')
        hash[key] = Yelp.const_get(class_name)
      end

      klass = @error_classes[body['error']['id']]
      raise klass.new(body['error']['text'])
    end
  end

  class AlreadyConfigured < Error
    def initialize(msg = 'Gem cannot be reconfigured.  Initialize a new ' +
        'instance of Yelp::Client.')
      super
    end
  end

  class MissingAPIKeys < Error
    def initialize(msg = "You're missing an API key")
      super
    end
  end

  class MissingLatLng < Error
    def initialize(msg = 'Missing required latitude or longitude parameters')
      super
    end
  end

  class BoundingBoxNotComplete < Error
    def initialize(msg = 'Missing required values for bounding box')
{'fraction_non_alphanumeric': 0.1044776119402985, 'fraction_numerical': 0.005427408412483039, 'mean_word_length': 2.9784172661870505, 'pattern_counts': {'":': 0, '<': 13, '<?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': '2310107', 'n_tokens_mistral': 689, 'n_tokens_neox': 652, 'n_words': 200}