Module valolyticspy.services.dictionaries.map
Expand source code
import sys
sys.path.append("")
from valolyticspy.dtos.valorant_api.map import Map
from valolyticspy.services.api.valorant_api import ValorantApiClient as API
class MapDictionary(dict[str, Map]):
def refresh(self):
self.clear()
self.update({ map.uuid: map for map in API.get_maps() })
def name(self, displayName: str):
for map in self.values():
if map.displayName.lower() == displayName.lower():
return map
raise ValueError(f"No map found with displayName {displayName}")
Classes
class MapDictionary (*args, **kwargs)-
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
Expand source code
class MapDictionary(dict[str, Map]): def refresh(self): self.clear() self.update({ map.uuid: map for map in API.get_maps() }) def name(self, displayName: str): for map in self.values(): if map.displayName.lower() == displayName.lower(): return map raise ValueError(f"No map found with displayName {displayName}")Ancestors
- builtins.dict
Methods
def name(self, displayName: str)-
Expand source code
def name(self, displayName: str): for map in self.values(): if map.displayName.lower() == displayName.lower(): return map raise ValueError(f"No map found with displayName {displayName}") def refresh(self)-
Expand source code
def refresh(self): self.clear() self.update({ map.uuid: map for map in API.get_maps() })