def obtain_data_set_avg(self): result = [] now_value = utils.get_value(self.locations, self.raw_value) if not utils.check_list_null(self.data_sets): compare_set = map(utils.get_avg, self.data_sets) return now_value, compare_set else: return None, None
def obtain_data_set(self, key): self.locations = utils.get_location(key) raw_pattern = self.dao.get_last_value(key) patterns = utils.get_pattern(raw_pattern) data_sets = self.dao.get_data_by_pattern(key, *patterns) data_period_set = self.dao.get_data_by_range(key, [-6, -2]) get_period_value = partial(utils.get_value, self.locations) data_period_set_modify = map(get_period_value, data_period_set) data_sets.append(data_period_set_modify) self.data_sets = data_sets self.raw_value = raw_pattern if utils.check_list_null(self.data_sets): logging.error('please check key:' + key) return self