<commit_before>request = require "request"
fs      = require "fs"
retry   = require "retry"

class Airbud
  @_defaults:
    # The URL to fetch
    url: null
    # How many times to try
    retries: 0
    # Timeout in milliseconds per try
    timeout: null
    # Automatically parse json
    parseJson: true
    # A key to find in the rootlevel of the parsed json.
    # If not found, Airbud will error out
    expectedKey: null
    # Only used by Airbud's own testsuite to test the timeout mechanism
    testDelay: 0

  @fetch: (options, cb) ->
    if !options.url
      err = new Error "You did not specify a url to fetch"
      return cb err

    for key, val of @_defaults
      if !options[key]?
        options[key] = val

    operation = retry.operation options

    # Setup timeouts for single operation<commit_msg>whitespace for better readability<commit_after>request = require "request"
fs      = require "fs"
retry   = require "retry"

class Airbud
  @_defaults:
    # The URL to fetch
    url: null

    # How many times to try
    retries: 0

    # Timeout in milliseconds per try
    timeout: null

    # Automatically parse json
    parseJson: true

    # A key to find in the rootlevel of the parsed json.
    # If not found, Airbud will error out
    expectedKey: null

    # Only used by Airbud's own testsuite to test the timeout mechanism
    testDelay: 0

  @fetch: (options, cb) ->
    if !options.url
      err = new Error "You did not specify a url to fetch"
      return cb err

    for key, val of @_defaults
      if !options[key]?
        options[key] = val

    operation = retry.operation options

    # Setup timeouts for single operation
{'fraction_non_alphanumeric': 0.06470940683043738, 'fraction_numerical': 0.002396644697423607, 'mean_word_length': 2.50104821802935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2177804', 'n_tokens_mistral': 496, 'n_tokens_neox': 478, 'n_words': 214}