<commit_before>define [
  'underscore'
  'store_original'
], (_, store) ->

  _.extend store,
    setOriginal: store.set
    getOriginal: store.get

  _.extend store,

    set: (key, val, exp = undefined) ->
      if exp? and exp > 0
        @setOriginal key,
          time: new Date().getTime()
          exp: exp
          val: val
      else
        @setOriginal key, val

    get: (key) ->
      info = @getOriginal key
      if _.isObject(info) and info.exp? and info.time?
        if not @isExpired key
          info.val
        else
          @remove key
          null
      else
        info

    isExpired: (key) ->
      info = @getOriginal key
      info.exp? and info.time? and (info.exp < new Date().getTime() - info.time)

  store<commit_msg>[fix] store: expiration flag<commit_after>define [
  'underscore'
  'store_original'
], (_, store) ->

  _.extend store,
    setOriginal: store.set
    getOriginal: store.get

  _.extend store,

    set: (key, val, exp = undefined) ->
      if exp? and exp > 0
        @setOriginal key,
          time: new Date().getTime()
          exp: exp
          val: val
      else
        @setOriginal key, val

    get: (key) ->
      info = @getOriginal key
      if _.isObject(info) and info.exp? and info.time?
        if not @isExpired key
          info.val
        else
          @remove key
          null
      else
        info

    isExpired: (key) ->
      info = @getOriginal key
      return null  unless info?
      info.exp? and info.time? and \
        (info.exp < new Date().getTime() - info.time)

  store
{'fraction_non_alphanumeric': 0.10984126984126984, 'fraction_numerical': 0.0012698412698412698, 'mean_word_length': 1.694017094017094, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '1056800', 'n_tokens_mistral': 503, 'n_tokens_neox': 486, 'n_words': 148}