#NEWLINE# def _get_stats( self , task , start_date ) : #NEWLINE# #INDENT# ' Fetches statistic information for given task and start range.\n            ' #NEWLINE# stats = [ ] #NEWLINE# stats_dir = self . _sdir ( task . base_dir ) #NEWLINE# date = data #NEWLINE# end_date = datetime . date . today ( ) #NEWLINE# delta = datetime . timedelta ( days = 1 ) #NEWLINE# while ( date <= end_date ) : #NEWLINE# #INDENT# date_str = date . strftime ( '%Y%m%d' ) #NEWLINE# filename = os . path . join ( stats_dir , '{0}.json' . format ( date_str ) ) #NEWLINE# if os . path . exists ( filename ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# with open ( filename , 'r' ) as file_ : #NEWLINE# #INDENT# data = json . loads ( file_ . read ( ) ) #NEWLINE# #UNINDENT# stats . append ( ( date , sorted ( data . iteritems ( ) , key = ( lambda x : x [ 1 ] ) , reverse = True ) ) ) #NEWLINE# #UNINDENT# except ( json . JSONDecodeError , OSError ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# date += delta #NEWLINE# #UNINDENT# return stats