我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用dateutil.rrule.SU。
def testRRuleAll(self): from dateutil.rrule import rrule from dateutil.rrule import rruleset from dateutil.rrule import rrulestr from dateutil.rrule import YEARLY, MONTHLY, WEEKLY, DAILY from dateutil.rrule import HOURLY, MINUTELY, SECONDLY from dateutil.rrule import MO, TU, WE, TH, FR, SA, SU rr_all = (rrule, rruleset, rrulestr, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY, MO, TU, WE, TH, FR, SA, SU) for var in rr_all: self.assertIsNot(var, None) # In the public interface but not in all from dateutil.rrule import weekday self.assertIsNot(weekday, None)
def _is_weekdays(day_array): """ Is the day_array every weekday? """ days = [ rrule.MO in day_array, rrule.TU in day_array, rrule.WE in day_array, rrule.TH in day_array, rrule.FR in day_array, rrule.SA not in day_array, rrule.SU not in day_array, ] return reduce(lambda x, y: x and y, days)
def testRelativeDeltaAll(self): from dateutil.relativedelta import relativedelta from dateutil.relativedelta import MO, TU, WE, TH, FR, SA, SU for var in (relativedelta, MO, TU, WE, TH, FR, SA, SU): self.assertIsNot(var, None) # In the public interface but not in all from dateutil.relativedelta import weekday self.assertIsNot(weekday, None)
def get_all_next_tournament_dates(start, index=0): until = start + timedelta(days=7) pdsat_time = ['Saturday', rrule.rrule(rrule.WEEKLY, byhour=13, byminute=30, bysecond=0, dtstart=start, until=until, byweekday=rrule.SA)[index]] pds_time = ['Sunday', rrule.rrule(rrule.WEEKLY, byhour=13, byminute=30, bysecond=0, dtstart=start, until=until, byweekday=rrule.SU)[index]] pdm_time = ['Monday', rrule.rrule(rrule.WEEKLY, byhour=19, byminute=0, bysecond=0, dtstart=start, until=until, byweekday=rrule.MO)[index]] pdt_time = ['Thursday', rrule.rrule(rrule.WEEKLY, byhour=19, byminute=0, bysecond=0, dtstart=start, until=until, byweekday=rrule.TH)[index]] return [pdsat_time, pds_time, pdm_time, pdt_time]