def from_dict(obj: Any) -> 'UserPastRaces': if not isinstance(obj, dict): return None count = from_int(obj.get("count")) num_pages = from_int(obj.get("num_pages")) races = from_list(Race.from_dict, obj.get("races")) return UserPastRaces(count, num_pages, races)
def from_dict(obj: Any) -> 'Flag': if not isinstance(obj, dict): return None Mode = from_str(obj.get("Mode")) flag_id = from_int(obj.get("flag_id")) HoursToComplete = from_int(obj.get("HoursToComplete")) return Flag( Mode=Mode, flag_id=flag_id, HoursToComplete=HoursToComplete)
def from_dict(obj: Any) -> 'Ranking': if not isinstance(obj, dict): return None user = User.from_dict(obj.get("user")) place = from_int(obj.get("place")) place_ordinal = from_str(obj.get("place_ordinal")) score = from_int(obj.get("score")) best_time = from_str(obj.get("best_time")) times_raced = from_int(obj.get("times_raced")) return Ranking( user=user, place=place, place_ordinal=place_ordinal, score=score, best_time=best_time, times_raced=times_raced)
def from_dict(obj: Any) -> 'Leaderboard': if not isinstance(obj, dict): return None goal = from_str(obj.get("goal")) num_ranked = from_int(obj.get("num_ranked")) rankings = from_list(Ranking.from_dict, obj.get("rankings")) return Leaderboard(goal, num_ranked, rankings)
def from_dict(obj: Any) -> 'Standings': if not isinstance(obj, dict): return None race_id = from_int(obj.get("race_id")) Season = from_str(obj.get("Season")) Mode = from_str(obj.get("Mode")) StartTime = (pytz.timezone('US/Eastern').localize( from_datetime(obj.get("StartTime")) )) RaceName = from_str(obj.get("RaceName")) HasCompleted = from_bool(obj.get("HasCompleted")) ParticipantCount = from_int(obj.get("ParticipantCount")) return ScheduleItem( race_id=race_id, Season=Season, Mode=Mode, StartTime=StartTime, RaceName=RaceName, HasCompleted=HasCompleted, ParticipantCount=ParticipantCount )
def from_dict(obj: Any) -> 'Season': if not isinstance(obj, dict): return None season_id = from_int(obj.get("season_id")) SeasonName = from_str(obj.get("SeasonName")) IsCurrentSeason = from_bool(obj.get("IsCurrentSeason")) return Season( season_id=season_id, SeasonName=SeasonName, IsCurrentSeason=IsCurrentSeason )
def from_dict(obj: Any) -> 'Stats': if not isinstance(obj, dict): return None joined = from_int(obj.get("joined")) first = from_int(obj.get("first")) second = from_int(obj.get("second")) third = from_int(obj.get("third")) forfeits = from_int(obj.get("forfeits")) dqs = from_int(obj.get("dqs")) return Stats(joined, first, second, third, forfeits, dqs)
def from_dict(obj: Any) -> 'RacerResult': if not isinstance(obj, dict): return None RacerName = from_str(obj.get("RacerName")) OpponentRacerName = from_str(obj.get("OpponentRacerName")) Mode = from_str(obj.get("Mode")) race_id = from_int(obj.get("race_id")) Season = from_str(obj.get("Season")) Result = from_str(obj.get("Result")) FinishTime = from_str(obj.get("FinishTime")) OpponentFinishTime = from_str(obj.get("OpponentFinishTime")) return RacerResult( RacerName=RacerName, OpponentRacerName=OpponentRacerName, Mode=Mode, race_id=race_id, Season=Season, Result=Result, FinishTime=FinishTime, OpponentFinishTime=OpponentFinishTime )
def from_dict(obj: Any) -> 'Standings': if not isinstance(obj, dict): return None RacerName = from_str(obj.get("RacerName")) Season = from_str(obj.get("Season")) Mode = from_str(obj.get("Mode")) Rating = from_int(obj.get("Rating")) Rank = from_int(obj.get("Rank")) Change = from_int(obj.get("Change")) Wins = from_int(obj.get("Wins")) Losses = from_int(obj.get("Losses")) Ties = from_int(obj.get("Ties")) return Standings( RacerName=RacerName, Season=Season, Mode=Mode, Rating=Rating, Rank=Rank, Change=Change, Wins=Wins, Losses=Losses, Ties=Ties)
def from_dict(obj: Any) -> 'Race': if not isinstance(obj, dict): return None name = from_str(obj.get("name")) slug = from_str(obj.get("slug")) status = Status.from_dict(obj.get("status")) url = from_str(obj.get("url")) data_url = from_str(obj.get("data_url")) websocket_url = from_union([from_str, from_none], obj.get("websocket_url")) websocket_bot_url = from_union([from_str, from_none], obj.get("websocket_bot_url")) websocket_oauth_url = from_union([from_str, from_none], obj.get("websocket_oauth_url")) category = RaceCategory.from_dict(obj.get("category")) goal = Goal.from_dict(obj.get("goal")) info = from_str(obj.get("info")) entrants_count = from_int(obj.get("entrants_count")) entrants_count_inactive = from_int(obj.get("entrants_count_inactive")) entrants = from_union( [lambda x: from_list(Entrant.from_dict, x), from_none], obj.get("entrants")) opened_at = from_datetime(obj.get("opened_at")) start_delay = from_union([from_timedelta, from_none], obj.get("start_delay")) started_at = from_union([from_datetime, from_none], (obj.get("started_at"))) ended_at = from_union([from_datetime, from_none], (obj.get("ended_at"))) cancelled_at = from_union([from_datetime, from_none], (obj.get("cancelled_at"))) unlisted = from_union([from_bool, from_none], obj.get("unlisted")) time_limit = from_timedelta(obj.get("time_limit")) streaming_required = from_union([from_bool, from_none], obj.get("streaming_required")) auto_start = from_union([from_bool, from_none], obj.get("auto_start")) opened_by = from_union([lambda x: User.from_dict(x), from_none], obj.get("opened_by")) monitors = from_union( [lambda x: from_list(User.from_dict, x), from_none], obj.get("monitors")) recordable = from_union([from_bool, from_none], obj.get("recordable")) recorded = from_union([from_bool, from_none], obj.get("recorded")) recorded_by = from_union([lambda x: User.from_dict(x), from_none], obj.get("recorded_by")) allow_comments = from_union([from_bool, from_none], obj.get("allow_comments")) hide_comments = from_union([from_bool, from_none], obj.get("hide_comments")) allow_midrace_chat = from_union([from_bool, from_none], obj.get("allow_midrace_chat")) allow_non_entrant_chat = from_union([from_bool, from_none], obj.get("allow_non_entrant_chat")) chat_message_delay = from_union([from_str, from_none], obj.get("chat_message_delay")) version = from_union([from_int, from_none], obj.get("version")) entrants_count_finished = from_union( [from_int, from_none], obj.get("entrants_count_finished")) return Race(name=name, status=status, url=url, data_url=data_url, websocket_url=websocket_url, websocket_bot_url=websocket_bot_url, websocket_oauth_url=websocket_oauth_url, category=category, goal=goal, info=info, entrants_count=entrants_count, entrants_count_inactive=entrants_count_inactive, opened_at=opened_at, time_limit=time_limit, entrants=entrants, version=version, started_at=started_at, ended_at=ended_at, cancelled_at=cancelled_at, unlisted=unlisted, streaming_required=streaming_required, auto_start=auto_start, opened_by=opened_by, monitors=monitors, recordable=recordable, recorded=recorded, recorded_by=recorded_by, allow_comments=allow_comments, hide_comments=hide_comments, allow_midrace_chat=allow_midrace_chat, allow_non_entrant_chat=allow_non_entrant_chat, chat_message_delay=chat_message_delay, start_delay=start_delay, entrants_count_finished=entrants_count_finished, slug=slug)
def from_dict(obj: Any) -> 'Racer': if not isinstance(obj, dict): return None racer_id = from_int(obj.get("racer_id")) RacerName = from_str(obj.get("RacerName")) return Racer(racer_id=racer_id, RacerName=RacerName)