예제 #1
0
파일: discord.py 프로젝트: kjhf/SlappPy
 def to_dict(self) -> dict:
     result = {}
     if len(self.ids) > 0:
         result["Ids"] = to_list(lambda x: Name.to_dict(x), self.ids)
     if len(self.usernames) > 0:
         result["Usernames"] = to_list(lambda x: Name.to_dict(x),
                                       self.usernames)
     return result
예제 #2
0
파일: battlefy.py 프로젝트: kjhf/SlappPy
 def to_dict(self) -> dict:
     result = {}
     if len(self.slugs) > 0:
         result["Slugs"] = to_list(lambda x: BattlefyUserSocial.to_dict(x), self.slugs)
     if len(self.usernames) > 0:
         result["Usernames"] = to_list(lambda x: Name.to_dict(x), self.usernames)
     if len(self.persistent_ids) > 0:
         result["PersistentIds"] = to_list(lambda x: Name.to_dict(x), self.persistent_ids)
     return result
예제 #3
0
 def to_dict(self) -> dict:
     result = {"Id": self.guid.__str__(), "Name": self.name}
     if len(self.brackets) > 0:
         result["Brackets"] = to_list(lambda x: Bracket.to_dict(x),
                                      self.brackets)
     if len(self.players) > 0:
         result["Players"] = to_list(lambda x: Player.to_dict(x),
                                     self.players)
     if len(self.teams) > 0:
         result["Teams"] = to_list(lambda x: Team.to_dict(x), self.teams)
     if len(self.uris) > 0:
         result["Uris"] = self.uris
     if self.start != UNKNOWN_DATE_TIME:
         result["Start"] = Source.datetime_to_ticks(self.start)
     return result
예제 #4
0
파일: bracket.py 프로젝트: kjhf/SlappPy
 def to_dict(self) -> dict:
     result = {"Name": self.name}
     if len(self.matches) > 0:
         result["Matches"] = to_list(lambda x: Game.to_dict(x), self.matches)
     if len(self.placements.players_by_placement) > 0 or len(self.placements.teams_by_placement) > 0:
         result["Placements"] = self.placements.to_dict()
     return result
예제 #5
0
파일: team.py 프로젝트: kjhf/SlappPy
 def to_dict(self) -> dict:
     result = {}
     if len(self.battlefy_persistent_team_ids) > 0:
         result["BattlefyPersistentTeamIds"] = to_list(
             lambda x: BattlefyTeamSocial.to_dict(x),
             self.battlefy_persistent_team_ids)
     if len(self.clan_tags) > 0:
         result["ClanTags"] = to_list(lambda x: ClanTag.to_dict(x),
                                      self.clan_tags)
     if len(self.divisions) > 0:
         result["Divisions"] = to_list(lambda x: Division.to_dict(x),
                                       self.divisions)
     result["Id"] = self.guid.__str__()
     if len(self.names) > 0:
         result["Names"] = to_list(lambda x: Name.to_dict(x), self.names)
     if len(self.sources) > 0:
         result["S"] = serialize_uuids(self.sources)
     if len(self.twitter_profiles) > 0:
         result["Twitter"] = to_list(lambda x: Twitter.to_dict(x),
                                     self.twitter_profiles)
     return result
예제 #6
0
 def to_dict(self) -> dict:
     result = {}
     if len(self.battlefy.slugs) > 0 or len(self.battlefy.usernames) > 0:
         result["Battlefy"] = self.battlefy.to_dict()
     if self.country:
         result["Country"] = self.country
     if len(self.discord.ids) > 0 or len(self.discord.usernames) > 0:
         result["Discord"] = self.discord.to_dict()
     if len(self.friend_codes) > 0:
         result["FriendCode"] = to_list(lambda x: FriendCode.to_dict(x),
                                        self.friend_codes)
     result["Id"] = self.guid.__str__()
     if len(self.names) > 0:
         result["Names"] = to_list(lambda x: Name.to_dict(x), self.names)
     if len(self.sendou_profiles) > 0:
         result["Sendou"] = to_list(lambda x: Sendou.to_dict(x),
                                    self.sendou_profiles)
     if not self.skill.is_default:
         result["Skill"] = self.skill.to_dict(),
     if len(self.sources) > 0:
         result["S"] = serialize_uuids(self.sources)
     if len(self.teams) > 0:
         result["Teams"] = serialize_uuids(self.teams)
     if self.top500:
         result["Top500"] = self.top500
     if len(self.twitch_profiles) > 0:
         result["Twitch"] = to_list(lambda x: Twitch.to_dict(x),
                                    self.twitch_profiles)
     if len(self.twitter_profiles) > 0:
         result["Twitter"] = to_list(lambda x: Twitter.to_dict(x),
                                     self.twitter_profiles)
     if len(self.weapons) > 0:
         result["Weapons"] = to_list(lambda x: str(x), self.weapons)
     return result