def tournament_deserializer(object): tournament_list = [] for tournament in object: this_tournament = Tournament(tournament["name"], tournament["place"], tournament["date"], tournament["tours"], DataHandler.player_deserializer( tournament["players"]), tournament["timing_style"], tournament["description"], tournament["round_number"]) this_tournament.rounds = DataHandler.round_deserializer( tournament["rounds"]) tournament_list.append(this_tournament) return tournament_list
def tournament_deserializer(reloaded_tournament): tournament = Tournament(reloaded_tournament["name"], reloaded_tournament["place"], reloaded_tournament["date"], reloaded_tournament["time_control"], reloaded_tournament["details"]) tournament.status = reloaded_tournament["status"] tournament.players = list() tournament.rounds = list() for player in reloaded_tournament["players"]: player = player_deserializer(player) tournament.add_player(player) for round in reloaded_tournament["rounds"]: reload_round = round_deserializer(round) tournament.add_round(reload_round) return tournament