<commit_before>module Peddler
  # @api private
  class Marketplace
    HOSTS = {
      'A2EUQ1WTGCTBG2' => 'mws.amazonservices.ca',
      'AAHKV2X7AFYLW'  => 'mws.amazonservices.com.cn',
      'A1PA6795UKMFR9' => 'mws-eu.amazonservices.com',
      'A1RKKUPIHCS9HS' => 'mws-eu.amazonservices.com',
      'A13V1IB3VIYZZH' => 'mws-eu.amazonservices.com',
      'A1F83G8C2ARO7P' => 'mws-eu.amazonservices.com',
      'A21TJRUUN4KGV'  => 'mws.amazonservices.in',
      'APJ6JRA9NG5V4'  => 'mws-eu.amazonservices.com',
      'A1VC38T7YXB528' => 'mws.amazonservices.jp',
      'ATVPDKIKX0DER'  => 'mws.amazonservices.com'
    }

    BadId = Class.new(StandardError)

    attr_reader :id

    def initialize(id)
      @id = id or fail BadId, 'missing MarketplaceId'
    end

    def host
      @host ||= find_host
    end

    def encoding
      if japanese?
        # Caveat: I've had one instance in the past where Shift_JIS didn't
        # work but Windows-31J did when parsing a report.
        'Shift_JIS'
      elsif chinese?
        'UTF-16'
      else
        'ISO-8859-1'
      end
    end<commit_msg>Add Mexican endpoint<commit_after>module Peddler
  # @api private
  class Marketplace
    HOSTS = {
      'A2EUQ1WTGCTBG2' => 'mws.amazonservices.ca',
      'AAHKV2X7AFYLW'  => 'mws.amazonservices.com.cn',
      'A1PA6795UKMFR9' => 'mws-eu.amazonservices.com',
      'A1RKKUPIHCS9HS' => 'mws-eu.amazonservices.com',
      'A13V1IB3VIYZZH' => 'mws-eu.amazonservices.com',
      'A1F83G8C2ARO7P' => 'mws-eu.amazonservices.com',
      'A21TJRUUN4KGV'  => 'mws.amazonservices.in',
      'APJ6JRA9NG5V4'  => 'mws-eu.amazonservices.com',
      'A1VC38T7YXB528' => 'mws.amazonservices.jp',
      'A1AM78C64UM0Y8' => 'mws.amazonservices.com.mx',
      'ATVPDKIKX0DER'  => 'mws.amazonservices.com'
    }

    BadId = Class.new(StandardError)

    attr_reader :id

    def initialize(id)
      @id = id or fail BadId, 'missing MarketplaceId'
    end

    def host
      @host ||= find_host
    end

    def encoding
      if japanese?
        # Caveat: I've had one instance in the past where Shift_JIS didn't
        # work but Windows-31J did when parsing a report.
        'Shift_JIS'
      elsif chinese?
        'UTF-16'
      else
        'ISO-8859-1'
      end
    end
{'fraction_non_alphanumeric': 0.12522045855379188, 'fraction_numerical': 0.0445326278659612, 'mean_word_length': 2.506955177743431, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, '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': '5418533', 'n_tokens_mistral': 961, 'n_tokens_neox': 936, 'n_words': 157}