def get_data(self): value = self.get_from_cache() if value: return value _, upcoming = utilities.get_contests() data = [] for contest in upcoming[:2]: data.append((contest["Name"], str(contest["Platform"]).lower(), contest["url"])) self.set_to_cache(data) return data
def get_data(self): value = self.get_from_cache() if value: return value _, upcoming = utilities.get_contests() data = [] for contest in upcoming: if contest["Platform"] not in CONTESTS_SITE_MAPPING: continue data.append((contest["Name"], str(contest["Platform"]).lower(), contest["url"])) if len(data) == 2: break self.set_to_cache(data) return data
def get_data(self): value = self.get_from_cache() if value: return value contest_list = utilities.get_contests() data = [] for contest in contest_list: if contest["site"] not in CONTESTS_SITE_MAPPING: continue if contest["status"] == "CODING": continue contest["name"] = contest["name"].encode("ascii", "ignore") data.append(contest) if len(data) == 2: break self.set_to_cache(data) return data