<commit_before>require "nokogiri"

module RETS
  class Client
    URL_KEYS = {:getobject => true, :login => true, :logout => true, :search => true, :getmetadata => true}

    ##
    # Attempts to login to a RETS server.
    # @param [Hash] args
    #   * url - Login URL for the RETS server
    #   * username - Username to pass for HTTP authentication
    #   * password - <PASSWORD> for HTTP authentication
    #   * ua_auth (Optional) - Whether RETS-UA-Authorization needs to be passed, implied when using *ua_username* or *ua_password*
    #   * ua_username (Optional) - What to set the HTTP User-Agent header to. If *ua_auth* is set and this is nil, *username* is used
    #   * ua_password (Optional) - What password to use for RETS-UA-Authorization. If *ua_auth* is set and this is nil, *password* is used
    #   * user_agent (Optional) - Custom user agent, ignored when using user agent authentication.
    #
    # @return [RETS::Base::Core]
    #   Successful login will return a {RETS::Base::Core}. Otherwise it can raise a {RETS::InvalidRequest}, {RETS::InvalidResponse} or {RETS::ServerError} exception depending on why it was unable to login or make the request.
    def self.login(args)
      raise ArgumentError, "No URL passed" unless args[:url]

      @urls = {:login => URI.parse(args[:url])}
      raise RETS::InvalidRequest, "Invalid URL passed" unless @urls.is_a?(URI::HTTP)
      
      base_url = @urls[:login].to_s.gsub(@urls[:login].path, "")<commit_msg>Bad mistake causing any request to be considered a bad URL<commit_after>require "nokogiri"

module RETS
  class Client
    URL_KEYS = {:getobject => true, :login => true, :logout => true, :search => true, :getmetadata => true}

    ##
    # Attempts to login to a RETS server.
    # @param [Hash] args
    #   * url - Login URL for the RETS server
    #   * username - Username to pass for HTTP authentication
    #   * password - <PASSWORD> for HTTP authentication
    #   * ua_auth (Optional) - Whether RETS-UA-Authorization needs to be passed, implied when using *ua_username* or *ua_password*
    #   * ua_username (Optional) - What to set the HTTP User-Agent header to. If *ua_auth* is set and this is nil, *username* is used
    #   * ua_password (Optional) - What password to use for RETS-UA-Authorization. If *ua_auth* is set and this is nil, *password* is used
    #   * user_agent (Optional) - Custom user agent, ignored when using user agent authentication.
    #
    # @return [RETS::Base::Core]
    #   Successful login will return a {RETS::Base::Core}. Otherwise it can raise a {RETS::InvalidRequest}, {RETS::InvalidResponse} or {RETS::ServerError} exception depending on why it was unable to login or make the request.
    def self.login(args)
      raise ArgumentError, "No URL passed" unless args[:url]

      @urls = {:login => URI.parse(args[:url])}
      raise RETS::InvalidRequest, "Invalid URL passed" unless @urls[:login].is_a?(URI::HTTP)
      
      base_url = @urls[:login].to_s.gsub(@urls[:login].path, "")
{'fraction_non_alphanumeric': 0.11516760703617657, 'fraction_numerical': 0.0, 'mean_word_length': 3.4388807069219443, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '1024401', 'n_tokens_mistral': 909, 'n_tokens_neox': 912, 'n_words': 334}