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):
        self.away_team = Team(game.away_abbreviation(), game.away_score(),
                              game.away_name(), game.away_hits(),
                              game.away_errors())
        self.home_team = Team(game.home_abbreviation(), game.home_score(),
                              game.home_name(), game.home_hits(),
                              game.home_errors())
        self.inning = Inning(game)
        self.bases = Bases(game)
        self.pitches = Pitches(game)
        self.outs = Outs(game)
        self.game_status = game.status()
        self.atbat = AtBat(game)

        self.note = game.note()

        self.reason = game.reason()

        self.play_result = game.current_play_result()