<commit_before>(function(module) {

  module
    .factory('anemometerById', function(Anemometer, $q) {
      return function anemometerById(anemometerId) {
        if (!anemometerId) return null

        return Anemometer.get({
          id: anemometerId
        }).$promise
      };
    })
    .factory('anemometerStatistics', function(Sample, timeFilter) {
      return function anemometerStatistics(anemometerId, params, cb) {
        var dataFrequency = params.dataFrequency,
          group_level = (dataFrequency - 1) * 2 + 1

        return Sample.statistics({
          startkey: key(anemometerId, dataFrequency, params.from),
          endkey: key(anemometerId, dataFrequency, params.to, true)
        }, cb)
      };
    })
    .factory('samples', function(Sample, timeFilter, $q) {
      return function samples(anemometer, timeSpan, dataFrequency) {
        if(timeSpan.to < timeSpan.from){
          var deferred = $q.defer()
          deferred.reject()
          return deferred.promise
        }
        return Sample.time({
          group_level: dataFrequency,
          startkey: key(anemometer._id, dataFrequency, timeSpan.from),
          endkey: key(anemometer._id, dataFrequency, timeSpan.to, true)
        }).$promise<commit_msg>anemometerById always return a promise<commit_after>(function(module) {

  module
    .factory('anemometerById', function(Anemometer, $q) {
      return function anemometerById(anemometerId) {
        if (!anemometerId){
          var deferred = $q.defer()
          deferred.reject()
          return deferred.promise
        }

        return Anemometer.get({
          id: anemometerId
        }).$promise
      };
    })
    .factory('anemometerStatistics', function(Sample, timeFilter) {
      return function anemometerStatistics(anemometerId, params, cb) {
        var dataFrequency = params.dataFrequency,
          group_level = (dataFrequency - 1) * 2 + 1

        return Sample.statistics({
          startkey: key(anemometerId, dataFrequency, params.from),
          endkey: key(anemometerId, dataFrequency, params.to, true)
        }, cb)
      };
    })
    .factory('samples', function(Sample, timeFilter, $q) {
      return function samples(anemometer, timeSpan, dataFrequency) {
        if(timeSpan.to < timeSpan.from){
          var deferred = $q.defer()
          deferred.reject()
          return deferred.promise
        }
        return Sample.time({
          group_level: dataFrequency,
          startkey: key(anemometer._id, dataFrequency, timeSpan.from),
          endkey: key(anemometer._id, dataFrequency, timeSpan.to, true)
        }).$promise
{'fraction_non_alphanumeric': 0.11005331302361006, 'fraction_numerical': 0.002284843869002285, 'mean_word_length': 2.4840848806366047, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1756353', 'n_tokens_mistral': 781, 'n_tokens_neox': 744, 'n_words': 159}