(period, target)
:param period: 'daily', 'weekly', or 'monthly'
    :param target: The 15-minute-aligned point in time we are targeting for a match
    :return: generator of couch view kwargs to use in view query for 'reportconfig/all_notifications'
def _make_all_notification_view_keys(period, target):
    """

    :param period: 'daily', 'weekly', or 'monthly'
    :param target: The 15-minute-aligned point in time we are targeting for a match
    :return: generator of couch view kwargs to use in view query for 'reportconfig/all_notifications'
    """
    assert target.minute % 15 == 0
    assert target.second == 0
    assert target.microsecond == 0

    if target.minute == 0:
        # for legacy purposes, on the hour also include reports that didn't have a minute set
        minutes = (None, target.minute)
    else:
        minutes = (target.minute,)

    if period == 'daily':
        for minute in minutes:
            yield {
                'startkey': [period, target.hour, minute],
                'endkey': [period, target.hour, minute, {}],
            }
    elif period == 'weekly':
        for minute in minutes:
            yield {
                'key': [period, target.hour, minute, target.weekday()],
            }
    else:
        # monthly
        for minute in minutes:
            yield {
                'key': [period, target.hour, minute, target.day]
            }
        if target.day == monthrange(target.year, target.month)[1]:
            for day in range(target.day + 1, 32):
                for minute in minutes:
                    yield {
                        'key': [period, target.hour, minute, day]
                    }
def _make_all_notification_view_keys ( period , target ) : assert target . minute % 15 == 0 assert target . second == 0 assert target . microsecond == 0 if target . minute == 0 : # for legacy purposes, on the hour also include reports that didn't have a minute set minutes = ( None , target . minute ) else : minutes = ( target . minute , ) if period == 'daily' : for minute in minutes : yield { 'startkey' : [ period , target . hour , minute ] , 'endkey' : [ period , target . hour , minute , { } ] , } elif period == 'weekly' : for minute in minutes : yield { 'key' : [ period , target . hour , minute , target . weekday ( ) ] , } else : # monthly for minute in minutes : yield { 'key' : [ period , target . hour , minute , target . day ] } if target . day == monthrange ( target . year , target . month ) [ 1 ] : for day in range ( target . day + 1 , 32 ) : for minute in minutes : yield { 'key' : [ period , target . hour , minute , day ] }