def __init__(self, **kwargs): self.victory = util.set_if_exists(kwargs, 'radiant_win') self.score = util.set_if_exists(kwargs, 'radiant_score') self.team_id = util.set_if_exists(kwargs, 'radiant_team_id') self.name = util.set_if_exists(kwargs, 'radiant_name') self.series_wins = util.set_if_exists(kwargs, 'radiant_series_wins') if self.team_id is not None: self.team = util.resolve_team(self.team_id)
def __init__(self, **kwargs): self.duration = util.set_if_exists(kwargs, 'duration') self.match_id = util.set_if_exists(kwargs, 'match_id') self.radiant = Radiant(**kwargs) self.dire = Dire(**kwargs) self.pick_bans = list(map(lambda pick_ban: PickBan(**pick_ban), kwargs['picks_bans'])) self.players = list(map(lambda player: Player(**player), kwargs['players'])) self.clips = util.get_twitch_clips(self.match_id)
def __init__(self, **kwargs): self.league_id = util.set_if_exists(kwargs, 'league_id') self.league_node_id = util.set_if_exists(kwargs, 'league_node_id') self.match_id = util.set_if_exists(kwargs, 'match_id') self.radiant_series_wins = util.set_if_exists(kwargs, 'radiant_series_wins') self.dire_series_wins = util.set_if_exists(kwargs, 'dire_series_wins') self.dire_team = util.set_if_exists(kwargs, 'dire_team') self.radiant_team = util.set_if_exists(kwargs, 'radiant_team') self.node_type = util.set_if_exists(kwargs, 'node_type') self.series_id = util.set_if_exists(kwargs, 'series_id')
def __init__(self, **kwargs): self.name = util.set_if_exists(kwargs['info'], 'name') self.league_id = util.set_if_exists(kwargs['info'], 'league_id') self.region = util.set_if_exists(kwargs['info'], 'region') self.url = util.set_if_exists(kwargs['info'], 'url') self.description = util.set_if_exists(kwargs['info'], 'description') self.pro_circuit_points = util.set_if_exists(kwargs['info'], 'pro_circuit_points') self.status = util.set_if_exists(kwargs['info'], 'status') self.prize_pool = PrizePool(**kwargs['prize_pool']) self.streams = list(map(lambda stream: Stream(**stream), kwargs['streams'])) self.node_groups = list(map(lambda node_group: NodeGroup(None, **node_group), kwargs['node_groups']))
def __init__(self, parent, **kwargs): self.name = util.set_if_exists(kwargs, 'name') self.node_group_id = util.set_if_exists(kwargs, 'node_group_id') self.parent_node_group_id = util.set_if_exists(kwargs, 'parent_node_group_id') self.incoming_node_group_ids = util.set_if_exists(kwargs, 'incoming_node_group_ids') self.advancing_node_group_id = util.set_if_exists(kwargs, 'advancing_node_group_id') self.advancing_team_count = util.set_if_exists(kwargs, 'advancing_team_count') self.team_count = util.set_if_exists(kwargs, 'team_count') self.is_tiebreaker = util.set_if_exists(kwargs, 'is_tiebreaker') self.is_final_group = util.set_if_exists(kwargs, 'is_final_group') self.is_completed = util.set_if_exists(kwargs, 'is_completed') self.region = util.set_if_exists(kwargs, 'region') self.phase = util.set_if_exists(kwargs, 'phase') self.nodes = list(map(lambda node: Node(self, **node), kwargs['nodes'])) self.node_groups = list(map(lambda node_group: NodeGroup(self, **node_group), kwargs['node_groups'])) self.team_standings = list(map(lambda team_standing: TeamStanding(**team_standing), kwargs['team_standings'])) # Fix an issue where child node_groups are not given the correct phase if parent is not None: if hasattr(parent, 'phase'): self.phase = parent.phase # Assign a proper name to the node groups if self.name == '': if self.phase == 1: self.name = f'{util.resolve_region(self.region)} {util.resolve_phase(self.phase)}' else: self.name = util.resolve_phase(self.phase) self.fix_nodes() # Attempt to normalise some of the data by moving any node groups that have 1 node group as a child forward # to its node group if parent is None and len(self.node_groups) == 1: ng = self.node_groups[0] self.name = ng.name self.node_group_id = ng.node_group_id self.parent_node_group_id = ng.parent_node_group_id self.incoming_node_group_ids = ng.incoming_node_group_ids self.advancing_node_group_id = ng.advancing_node_group_id self.advancing_team_count = ng.advancing_team_count self.team_count = ng.team_count self.is_tiebreaker = ng.is_tiebreaker self.is_final_group = ng.is_final_group self.is_completed = ng.is_completed self.phase = ng.phase self.nodes = ng.nodes self.node_groups = ng.node_groups self.team_standings = ng.team_standings # If all nodes groups within a node group are completed, the complete the nodegroup. if all(node_group.is_completed for node_group in self.node_groups): self.is_completed = True
def __init__(self, **kwargs): self.stream_id = util.set_if_exists(kwargs, 'stream_id') self.language = util.set_if_exists(kwargs, 'language') self.name = util.set_if_exists(kwargs, 'name') self.broadcast_provider = util.set_if_exists(kwargs, 'broadcast_provider') self.stream_url = util.set_if_exists(kwargs, 'stream_url')
def __init__(self, **kwargs): self.name = util.set_if_exists(kwargs, 'persona') self.hero_id = util.set_if_exists(kwargs, 'hero_id') self.item_0 = util.set_if_exists(kwargs, 'item_0') self.item_1 = util.set_if_exists(kwargs, 'item_1') self.item_2 = util.set_if_exists(kwargs, 'item_2') self.item_3 = util.set_if_exists(kwargs, 'item_3') self.item_4 = util.set_if_exists(kwargs, 'item_4') self.item_5 = util.set_if_exists(kwargs, 'item_5') self.kills = util.set_if_exists(kwargs, 'kills') self.deaths = util.set_if_exists(kwargs, 'deaths') self.assists = util.set_if_exists(kwargs, 'assists') self.level = util.set_if_exists(kwargs, 'level') self.net_worth = util.set_if_exists(kwargs, 'gold') + util.set_if_exists(kwargs, 'gold_spent') self.gold_per_min = util.set_if_exists(kwargs, 'gold_per_min') self.xp_per_min = util.set_if_exists(kwargs, 'xp_per_min') self.last_hits = util.set_if_exists(kwargs, 'last_hits') self.denies = util.set_if_exists(kwargs, 'denies') self.scaled_hero_damage = util.set_if_exists(kwargs, 'scaled_hero_damage') self.scaled_hero_healing = util.set_if_exists(kwargs, 'scaled_hero_healing') self.scaled_tower_damage = util.set_if_exists(kwargs, 'scaled_tower_damage')
def __init__(self, **kwargs): self.isPick = util.set_if_exists(kwargs, 'is_pick') self.hero = util.set_if_exists(kwargs, 'hero_id') self.order = util.set_if_exists(kwargs, 'order') + 1 self.team = util.set_if_exists(kwargs, 'team')
def __init__(self, **kwargs): self.base_prize_pool = util.set_if_exists(kwargs, 'base_prize_pool') self.total_price_pool = util.set_if_exists(kwargs, 'total_prize_pool') self.prize_pool_split = util.set_if_exists(kwargs, 'prize_split_pct_x100')
def __init__(self, parent, **kwargs): self.name = util.set_if_exists(kwargs, 'name') self.node_id = util.set_if_exists(kwargs, 'node_id') self.node_group_id = util.set_if_exists(kwargs, 'node_group_id') self.winning_node_id = util.set_if_exists(kwargs, 'winning_node_id') self.losing_node_id = util.set_if_exists(kwargs, 'losing_node_id') self.incoming_node_id_1 = util.set_if_exists(kwargs, 'incoming_node_id_1') self.incoming_node_id_2 = util.set_if_exists(kwargs, 'incoming_node_id_2') self.node_type = util.set_if_exists(kwargs, 'node_type') self.series_id = util.set_if_exists(kwargs, 'series_id') self.team_id_1 = util.set_if_exists(kwargs, 'team_id_1') self.team_id_2 = util.set_if_exists(kwargs, 'team_id_2') self.team_1_wins = util.set_if_exists(kwargs, 'team_1_wins') self.team_2_wins = util.set_if_exists(kwargs, 'team_2_wins') self.has_started = util.set_if_exists(kwargs, 'has_started') self.is_completed = util.set_if_exists(kwargs, 'is_completed') self.actual_time = util.set_if_exists(kwargs, 'actual_time') # We're not serialising matches because it would take TEN YEARS. self.matches = util.set_if_exists(kwargs, 'matches') self.team_1 = util.resolve_team(self.team_id_1) self.team_2 = util.resolve_team(self.team_id_2)
def __init__(self, **kwargs): self.team = util.resolve_team(util.set_if_exists(kwargs, 'team_id')) self.standing = util.set_if_exists(kwargs, 'standing') self.wins = util.set_if_exists(kwargs, 'wins') self.losses = util.set_if_exists(kwargs, 'losses') self.score = util.set_if_exists(kwargs, 'score')