Beispiel #1
0
    def __init__(self, game: Game, time_format):
        self.home_team = game.home_abbreviation()
        self.away_team = game.away_abbreviation()
        self.pregame_weather = game.pregame_weather()
        self.time_format = time_format

        try:
            self.start_time = self.__convert_time(game.datetime())
        except:
            self.start_time = "TBD"

        self.status = game.status()

        away_id = game.probable_pitcher_id("away")
        if away_id is not None:
            name = game.full_name(away_id)
            wins = game.pitcher_stat(away_id, "wins", "away")
            losses = game.pitcher_stat(away_id, "losses", "away")
            era = game.pitcher_stat(away_id, "era", "away")
            self.away_starter = "{} ({}-{} {} ERA)".format(
                name, wins, losses, era)
        else:
            self.away_starter = PITCHER_TBD

        home_id = game.probable_pitcher_id("home")
        if home_id is not None:
            name = game.full_name(home_id)
            wins = game.pitcher_stat(home_id, "wins", "home")
            losses = game.pitcher_stat(home_id, "losses", "home")
            era = game.pitcher_stat(home_id, "era", "home")
            self.home_starter = "{} ({}-{} {} ERA)".format(
                name, wins, losses, era)
        else:
            self.home_starter = PITCHER_TBD
Beispiel #2
0
    def __init__(self, game: Game):

        winner_side = game.winning_team()

        winner = game.decision_pitcher_id("winner")
        if winner is not None:
            self.winning_pitcher = game.full_name(winner)
            self.winning_pitcher_wins = game.pitcher_stat(
                winner, "wins", winner_side)
            self.winning_pitcher_losses = game.pitcher_stat(
                winner, "losses", winner_side)
        else:
            self.winning_pitcher = PITCHER_UNKNOWN
            self.winning_pitcher_wins = 0
            self.winning_pitcher_losses = 0

        save = game.decision_pitcher_id("save")
        if save is not None:
            self.save_pitcher = game.full_name(save)
            self.save_pitcher_saves = game.pitcher_stat(
                save, "saves", winner_side)
        else:
            self.save_pitcher = None
            self.save_pitcher_saves = None

        loser = game.decision_pitcher_id("loser")
        if loser is not None:
            loser_side = game.losing_team()
            self.losing_pitcher = game.full_name(loser)
            self.losing_pitcher_wins = game.pitcher_stat(
                loser, "wins", loser_side)
            self.losing_pitcher_losses = game.pitcher_stat(
                loser, "losses", loser_side)
        else:
            self.losing_pitcher = PITCHER_UNKNOWN
            self.losing_pitcher_wins = 0
            self.losing_pitcher_losses = 0