示例#1
0
    def from_dict(cls, match_dict):
        url = None
        date_time = None
        title = None
        key = list(match_dict.keys())[0]
        found = re.search(r'^(https://.+?) (.+?): (.+?)$', key)
        if found:
            url = found.group(1)
            date_time = DateTime.fromisoformat(found.group(2))
            title = MatchTitle.from_str(found.group(3))

        bets_dict = list(match_dict.values())[0][0]
        bets = [
            Bet.from_dict({bet_title: odds})
            for bet_title, odds in bets_dict.items()
        ]

        return cls(title, url, date_time, None, bets)