Example #1
0
def generate_recurring_sitting_dates(start_date, repeat, repeat_until,
                                     weekdays, monthly, exceptions):
    if repeat_until is not None:
        assert repeat_until > start_date
    generators = []
    if weekdays is not None:
        for weekday in weekdays:
            generators.append(iter(weekday(start_date)))
    if monthly is not None:
        generators.append(iter(monthly(start_date)))
    count = 0
    for date in generate_dates(*generators):
        if date in exceptions:
            continue
        count += 1
        if repeat and count > repeat:
            break
        if repeat_until and date.date() > repeat_until:
            break
        yield date.date()
def generate_recurring_sitting_dates(start_date, repeat, repeat_until,
                                     weekdays, monthly, exceptions):
    if repeat_until is not None:
        assert repeat_until > start_date
    generators = []
    if weekdays is not None:
        for weekday in weekdays:
            generators.append(iter(weekday(start_date)))
    if monthly is not None:
        generators.append(iter(monthly(start_date)))
    count = 0
    for date in generate_dates(*generators):
        if date in exceptions:
            continue
        count += 1
        if repeat and count > repeat:
            break
        if repeat_until and date.date() > repeat_until:
            break
        yield date.date()