<commit_before>Faraday::Request.extend Module.new {
  legacy = [:OAuth, :OAuth2]
  define_method(:const_missing) { |const|
    if legacy.include? const
      const_set const, FaradayMiddleware.const_get(const)
    else
      super
    end
  }
}

Faraday::Response.extend Module.new {
  legacy = [:Mashify, :Rashify, :ParseJson, :ParseMarshal, :ParseXml, :ParseYaml]
  define_method(:const_missing) { |const|
    if legacy.include? const
      const_set const, FaradayMiddleware.const_get(const)
    else
      super
    end
  }
}<commit_msg>add deprecation notice when using old constants<commit_after>deprecation_warning = lambda { |old, new, trace|
  warn "Deprecation warning: #{old} is deprecated; use #{new}"
  warn trace[0,10].join("\n") if $DEBUG
}

Faraday::Request.extend Module.new {
  legacy = [:OAuth, :OAuth2]
  define_method(:const_missing) { |const|
    if legacy.include? const
      klass = FaradayMiddleware.const_get(const)
      deprecation_warning.call "Faraday::Request::#{const}", klass.name, caller
      const_set const, klass
    else
      super
    end
  }
}

Faraday::Response.extend Module.new {
  legacy = [:Mashify, :Rashify, :ParseJson, :ParseMarshal, :ParseXml, :ParseYaml]
  define_method(:const_missing) { |const|
    if legacy.include? const
      klass = FaradayMiddleware.const_get(const)
      deprecation_warning.call "Faraday::Response::#{const}", klass.name, caller
      const_set const, klass
    else
      super
    end
  }
}
{'fraction_non_alphanumeric': 0.12024456521739131, 'fraction_numerical': 0.0033967391304347825, 'mean_word_length': 3.8453947368421053, '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': '4362264', 'n_tokens_mistral': 501, 'n_tokens_neox': 496, 'n_words': 107}