<s> """<STR_LIT>""" <EOL> import os <EOL> try : <EOL> from urllib2 import urlopen , HTTPError <EOL> except ImportError : <EOL> from urllib . request import urlopen <EOL> from urllib . error import HTTPError <EOL> def get_scoreboard ( year , month , day ) : <EOL> """<STR_LIT>""" <EOL> monthstr = str ( month ) . zfill ( <NUM_LIT:2> ) <EOL> daystr = str ( day ) . zfill ( <NUM_LIT:2> ) <EOL> filename = "<STR_LIT>" % ( year , monthstr , daystr ) <EOL> file = os . path . join ( os . path . dirname ( __file__ ) , filename ) <EOL> if os . path . isfile ( file ) : <EOL> data = file <EOL> else : <EOL> try : <EOL> data = urlopen ( "<STR_LIT>" % ( year , monthstr , daystr ) ) <EOL> except HTTPError : <EOL> data = os . path . join ( os . path . dirname ( __file__ ) , "<STR_LIT>" ) <EOL> return data <EOL> def get_box_score ( game_id ) : <EOL> """<STR_LIT>""" <EOL> year , month , day , rest = game_id . split ( '<STR_LIT:_>' , <NUM_LIT:3> ) <EOL> filename = "<STR_LIT>" % ( year , month , day , game_id ) <EOL> file = os . path . join ( os . path . dirname ( __file__ ) , filename ) <EOL> if os . path . isfile ( file ) : <EOL> data = file <EOL> else : <EOL> try : <EOL> data = urlopen ( "<STR_LIT>" % ( year , month , day , game_id ) ) <EOL> except HTTPError : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> return data </s>
