<commit_before>/**
 * @file Throttled interface to Etherscan API client.
 * @module client/etherscan-throttled
 */

'use strict'

// Imports
const RawClient = require('./etherscan')

/**
 * Private members store.
 * @private
 */
const privs = new WeakMap()

/**
 * Throttled interface to Etherscan API client.
 * @static
 */
class Client {
  /**
   * No parameters.
   */
  constructor () {
    const priv = {}
    privs.set(this, priv)
    priv.rawClient = new RawClient()
  }
}

// Expose<commit_msg>Add rate limiter to client/etherscan-throttled<commit_after>/**
 * @file Throttled interface to Etherscan API client.
 * @module client/etherscan-throttled
 */

'use strict'

// Imports
const RawClient = require('./etherscan')
const Bottleneck = require('bottleneck')

/**
 * Private members store.
 * @private
 */
const privs = new WeakMap()

/**
 * Modules configuration.
 * @private
 */
const moduleConfig = {

  /**
   * 5 requests per second.
   * Unlimited queue size.
   */
  bottleneck: {
    maxConcurrent: 5,
    minTime: 1000,
    highWater: -1,
    strategy: Bottleneck.strategy.LEAK,
    rejectOnDrop: true
  }
}

/**
 * Throttled interface to Etherscan API client.
 * @static
 */
class Client {
  /**
   * No parameters.
   */
  constructor () {
    const priv = {}
    privs.set(this, priv)
    priv.rawClient = new RawClient()
    priv.limiter = new Bottleneck(
      moduleConfig.bottleneck.maxConcurrent,
      moduleConfig.bottleneck.minTime,
      moduleConfig.bottleneck.highWater,
      moduleConfig.bottleneck.strategy,
      moduleConfig.bottleneck.rejectOnDrop
    )
  }
}

// Expose
{'fraction_non_alphanumeric': 0.12857142857142856, 'fraction_numerical': 0.004347826086956522, 'mean_word_length': 2.891304347826087, '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': '2956247', 'n_tokens_mistral': 551, 'n_tokens_neox': 525, 'n_words': 125}