def __contains__(self, key): if key == '__image': return bool(self.images) elif key == '__total': try: return bool(get_total(self)) except (KeyError, ValueError): return False if self.revmapping: key = self.revmapping.get(key, key) return key in self.__tags
def retrieve_axises(country: str): data = retrieve_from_rest(country) ts, totals, new = [], [], [] if not data: return [], [], [] for x in data: ts.append(get_date_timestamp(x)) totals.append(get_total(x)) new.append(get_new(x)) # reversed new -> old for this API return ts[::-1], totals[::-1], new[::-1]
def __getitem__(self, key): if key.startswith('__'): if key == '__image': return self.images elif key == '__filetype': return self.filetype elif key == '__total': return get_total(self) else: return self.__tags[key] elif not isinstance(key, basestring): return self.__tags[key] else: return self.__tags[key].get_value()
def __getitem__(self,key): if key.startswith('__'): if key == '__image': return self.images elif key == '__filetype': return self.filetype elif key == '__total': return get_total(self) else: return self.__tags[key] elif not isinstance(key, basestring): return self.__tags[key] else: return self.__tags[key].get_value()
def __getitem__(self, key): if key == '__image': return self.images elif key == '__total': return get_total(self) return self.__tags[key]