Module valolyticspy.services.dictionaries.agent

Expand source code
import sys
sys.path.append("")
from valolyticspy.dtos.valorant_api.agent import Agent
from valolyticspy.services.api.valorant_api import ValorantApiClient as API

class AgentDictionary(dict[str, Agent]):
    def refresh(self):
        self.clear()
        self.update({ agent.uuid: agent for agent in API.get_agents() })

    def name(self, displayName: str):
        for agent in self.values():
            if agent.displayName.lower() == displayName.lower():
                return agent
        raise ValueError(f"No agent found with displayName {displayName}")

Classes

class AgentDictionary (*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 AgentDictionary(dict[str, Agent]):
    def refresh(self):
        self.clear()
        self.update({ agent.uuid: agent for agent in API.get_agents() })

    def name(self, displayName: str):
        for agent in self.values():
            if agent.displayName.lower() == displayName.lower():
                return agent
        raise ValueError(f"No agent found with displayName {displayName}")

Ancestors

  • builtins.dict

Methods

def name(self, displayName: str)
Expand source code
def name(self, displayName: str):
    for agent in self.values():
        if agent.displayName.lower() == displayName.lower():
            return agent
    raise ValueError(f"No agent found with displayName {displayName}")
def refresh(self)
Expand source code
def refresh(self):
    self.clear()
    self.update({ agent.uuid: agent for agent in API.get_agents() })