Skip to content

Commit

Permalink
Documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
panzarino committed Nov 21, 2015
1 parent e8cfc7a commit a7b4c20
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
9 changes: 6 additions & 3 deletions mlbgame/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@

from mlbgame import version
VERSION = version.__version__
'''
Current version of mlbgame
'''

def day(year, month, day, home=None, away=None):
'''
Return an array of games for a certain day
Return a list of games for a certain day
If home and away are the same, it will return the game for that team
If the home and away team are the same, it will return the game(s) for that team
'''
daysinmonth = calendar.monthrange(year, month)[1]
if daysinmonth < day:
Expand All @@ -159,7 +162,7 @@ def day(year, month, day, home=None, away=None):

def games(years, months=None, days=None, home=None, away=None):
'''
Return an array of arrays of games for multiple days
Return a list of lists of games for multiple days
If home and away are the same team, it will return all games for that team
'''
Expand Down
12 changes: 11 additions & 1 deletion mlbgame/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
import gzip

def scoreboard(year, month, day, home=None, away=None):
'''
Return the data for a certain day matching certain criteria as a dictionary
Should not be used other than as called by `__init__.py`
'''
monthstr = str(month).zfill(2)
daystr = str(day).zfill(2)
filename = "gameday-data/year_"+str(year)+"/month_"+monthstr+"/day_"+daystr+"/scoreboard.xml.gz"
Expand Down Expand Up @@ -67,9 +72,14 @@ def scoreboard(year, month, day, home=None, away=None):

class GameScoreboard(object):
'''
Object to hold information about a certain game
Object to hold scoreboard information about a certain game
'''
def __init__(self, data):
'''
Creates a `GameScoreboard` object
data is expected to come from the `scoreboard()` function
'''
self.game_id = data['game_id']
self.game_type = data.get('game_type', '')
self.game_status = data.get('game_status', '')
Expand Down
5 changes: 4 additions & 1 deletion mlbgame/version.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
__version__="0.1.2"
__version__="0.1.2"
'''
Current version of mlbgame
'''

0 comments on commit a7b4c20

Please sign in to comment.