Skip to content

Commit

Permalink
Made small style changes to make slightly cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryShomer committed Feb 20, 2019
1 parent a8a4f0d commit a522f37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
5 changes: 1 addition & 4 deletions hockey_scraper/html_pbp.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,7 @@ def if_valid_event(event):
:return: boolean
"""
if event[0] != '#' and event[4] not in ['GOFF', 'EGT', 'PGSTR', 'PGEND', 'ANTHEM']:
return True
else:
return False
return event[0] != '#' and event[4] not in ['GOFF', 'EGT', 'PGSTR', 'PGEND', 'ANTHEM']


def return_name_html(info):
Expand Down
13 changes: 6 additions & 7 deletions hockey_scraper/live_scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,12 @@ def scrape_live_game(self, force=False):
# Don't bother with scraper warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
# Scrape pbp - pay attention to each argument
# pay attention to each argument
self.pbp_df, self.html_game_status = game_scraper.scrape_pbp_live(self.game_id, self.date,
{"head_coaches": self.head_coaches},
game_json, self.players,
{"Home": self.home_team, "Away": self.away_team},
espn_id=self.espn_id)
# Get shifts if asked for
if self.if_scrape_shifts:
self.shifts_df = game_scraper.scrape_shifts(self.game_id, self.players, self.date)

Expand Down Expand Up @@ -223,9 +222,9 @@ def is_game_over(self, prev=False):
:return: Boolean - True if over
"""
if not prev:
return True if self.html_game_status == self.api_game_status == "Final" else False
return self.html_game_status == self.api_game_status == "Final"
else:
return True if self.prev_html_game_status == self.prev_api_game_status == "Final" else False
return self.prev_html_game_status == self.prev_api_game_status == "Final"

def is_intermission(self, prev=False):
"""
Expand All @@ -236,9 +235,9 @@ def is_intermission(self, prev=False):
:return: Boolean - True if yes
"""
if not prev:
return True if self.html_game_status == self.api_game_status == "Intermission" else False
return self.html_game_status == self.api_game_status == "Intermission"
else:
return True if self.prev_html_game_status == self.prev_api_game_status == "Intermission" else False
return self.prev_html_game_status == self.prev_api_game_status == "Intermission"

def get_pbp(self):
"""
Expand Down Expand Up @@ -390,5 +389,5 @@ def finished(self):
finished_games += 1

# If the # of finished games == # of total games
return True if len(self.live_games) == finished_games else False
return len(self.live_games) == finished_games

0 comments on commit a522f37

Please sign in to comment.