def _min_daily_pageviews_by_sr(ndays=NDAYS_TO_QUERY, end_date=None):
 if (not end_date):
  last_modified = traffic.get_traffic_last_modified()
  end_date = (last_modified - timedelta(days=1))
 stop = end_date
 start = (stop - timedelta(ndays))
 time_points = traffic.get_time_points('day', start, stop)
 cls = traffic.PageviewsBySubredditAndPath
 q = traffic.Session.query(cls.srpath, func.min(cls.pageview_count)).filter((cls.interval == 'day')).filter(cls.date.in_(time_points)).filter(cls.srpath.like('%-GET_listing')).group_by(cls.srpath)
 retval = {}
 for row in q:
  m = PAGEVIEWS_REGEXP.match(row[0])
  if m:
   retval[m.group(1)] = row[1]
 return retval

def _min_daily_pageviews_by_sr ( ndays = NDAYS_TO_QUERY , end_date = None ) : if ( not end_date ) : last_modified = traffic . get_traffic_last_modified ( ) end_date = ( last_modified - timedelta ( days = 1 ) ) stop = end_date start = ( stop - timedelta ( ndays ) ) time_points = traffic . get_time_points ( 'day' , start , stop ) cls = traffic . PageviewsBySubredditAndPath q = traffic . Session . query ( cls . srpath , func . min ( cls . pageview_count ) ) . filter ( ( cls . interval == 'day' ) ) . filter ( cls . date . in_ ( time_points ) ) . filter ( cls . srpath . like ( '%-GET_listing' ) ) . group_by ( cls . srpath ) retval = { } for row in q : m = PAGEVIEWS_REGEXP . match ( row [ 0 ] ) if m : retval [ m . group ( 1 ) ] = row [ 1 ] return retval
return dict mapping sr_name to min_pageviews over the last ndays .