当前位置: 首页>>代码示例>>Python>>正文


Python rrule.WEEKLY属性代码示例

本文整理汇总了Python中dateutil.rrule.WEEKLY属性的典型用法代码示例。如果您正苦于以下问题:Python rrule.WEEKLY属性的具体用法?Python rrule.WEEKLY怎么用?Python rrule.WEEKLY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在dateutil.rrule的用法示例。


在下文中一共展示了rrule.WEEKLY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testRRuleAll

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
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) 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:21,代码来源:test_imports.py

示例2: test_activity_series_create_activates_group

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_activity_series_create_activates_group(self):
        url = '/api/activity-series/'
        recurrence = rrule.rrule(
            freq=rrule.WEEKLY,
            byweekday=[0, 1]  # Monday and Tuesday
        )
        start_date = self.group.timezone.localize(datetime.now().replace(hour=20, minute=0))
        activity_series_data = {
            'max_participants': 5,
            'place': self.place.id,
            'rule': str(recurrence),
            'start_date': start_date
        }
        self.group.status = GroupStatus.INACTIVE.value
        self.group.save()
        self.client.force_login(user=self.member)
        self.client.post(url, activity_series_data, format='json')
        self.group.refresh_from_db()
        self.assertEqual(self.group.status, GroupStatus.ACTIVE.value) 
开发者ID:yunity,项目名称:karrot-backend,代码行数:21,代码来源:test_activity_series_api.py

示例3: _getWhen

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def _getWhen(self, offset, numDays=1):
        retval = ""
        if self.freq == DAILY:
            retval = self.__getDailyWhen()

        elif self.freq == WEEKLY:
            retval = self.__getWeeklyWhen(offset)

        elif self.freq == MONTHLY:
            retval = self.__getMonthlyWhen(offset)

        elif self.freq == YEARLY:
            retval = self.__getYearlyWhen(offset)

        if numDays >= 2:
            retval += " "+_("for {n} days").format(n=numDays)
        if self.until:
            until = self.until + dt.timedelta(days=offset)
            retval += " "+_("(until {when})").format(when=dateShortFormat(until))
        return retval 
开发者ID:linuxsoftware,项目名称:ls.joyous,代码行数:22,代码来源:recurrence.py

示例4: _create_recurring_event_dates

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def _create_recurring_event_dates(self, start_date: datetime, end_date: datetime, weekdays: list):
        converted_days = [DAY_MAP[i] for i in weekdays]
        return list(
            rrule(WEEKLY, byweekday=converted_days, dtstart=start_date, until=end_date)
        ) 
开发者ID:City-of-Helsinki,项目名称:linkedevents,代码行数:7,代码来源:funactionuorille.py

示例5: test_every_week

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_every_week(self):
        """Repeat every week."""
        vrecurr = utils.build_rrule(freq="WEEKLY")
        assert vrecurr["FREQ"] == "WEEKLY"
        vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY"
        assert len(vrecurr.keys()) == 1 
开发者ID:jazzband,项目名称:django-ical,代码行数:8,代码来源:test_recurrence.py

示例6: test_weekly_tue

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_weekly_tue(self):
        """Repeat every week on Tuesday."""
        vrecurr = utils.build_rrule(freq="WEEKLY", byday="TU")
        assert vrecurr["FREQ"] == "WEEKLY"
        assert vrecurr["BYDAY"] == "TU"
        vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;BYDAY=TU"
        assert len(vrecurr.keys()) == 2 
开发者ID:jazzband,项目名称:django-ical,代码行数:9,代码来源:test_recurrence.py

示例7: test_weekly_mo_wed

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_weekly_mo_wed(self):
        """Repeat every week on Monday, Wednesday."""
        vrecurr = utils.build_rrule(freq="WEEKLY", byday=["MO", "WE"])
        assert vrecurr["FREQ"] == "WEEKLY"
        assert vrecurr["BYDAY"] == ["MO", "WE"]
        vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;BYDAY=MO,WE"
        assert len(vrecurr.keys()) == 2 
开发者ID:jazzband,项目名称:django-ical,代码行数:9,代码来源:test_recurrence.py

示例8: test_every_weekday

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_every_weekday(self):
        """Repeat every weekday."""
        vrecurr = utils.build_rrule(freq="WEEKLY", byday=["MO", "TU", "WE", "TH", "FR"])
        assert vrecurr["FREQ"] == "WEEKLY"
        assert vrecurr["BYDAY"] == ["MO", "TU", "WE", "TH", "FR"]
        vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"
        assert len(vrecurr.keys()) == 2 
开发者ID:jazzband,项目名称:django-ical,代码行数:9,代码来源:test_recurrence.py

示例9: test_every_2_weeks

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_every_2_weeks(self):
        """Repeat every 2 weeks."""
        vrecurr = utils.build_rrule(interval=2, freq="WEEKLY")
        assert vrecurr["FREQ"] == "WEEKLY"
        assert vrecurr["INTERVAL"] == 2
        vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;INTERVAL=2"
        assert len(vrecurr.keys()) == 2 
开发者ID:jazzband,项目名称:django-ical,代码行数:9,代码来源:test_recurrence.py

示例10: test_every_week_20_times

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_every_week_20_times(self):
        """Repeat every week for 20 times."""
        vrecurr = utils.build_rrule(freq="WEEKLY", count=20)
        assert vrecurr["FREQ"] == "WEEKLY"
        assert vrecurr["COUNT"] == 20
        vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;COUNT=20"
        assert len(vrecurr.keys()) == 2 
开发者ID:jazzband,项目名称:django-ical,代码行数:9,代码来源:test_recurrence.py

示例11: test_every_week_until_jan_2007

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_every_week_until_jan_2007(self):
        """Repeat every week until January 1, 2007."""
        utc = pytz.UTC
        vrecurr = utils.build_rrule_from_text("FREQ=WEEKLY;UNTIL=20070101T000000Z")
        assert vrecurr["FREQ"] == ["WEEKLY"]
        assert vrecurr["UNTIL"] == [datetime.datetime(2007, 1, 1, 0, 0, tzinfo=utc)]
        vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;UNTIL=20070101T000000Z"
        assert len(vrecurr.keys()) == 2 
开发者ID:jazzband,项目名称:django-ical,代码行数:10,代码来源:test_recurrence.py

示例12: test_weekly_by_month_year_day

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_weekly_by_month_year_day(self):
        rule = rrule(
            WEEKLY,
            bymonth=(1, 7),
            byyearday=(1, 100, 200, 365),
            dtstart=datetime.datetime(1997, 9, 2, 9, 0),
        )
        vrecurr = utils.build_rrule_from_dateutil_rrule(rule)
        vRecur(
            vrecurr
        ).to_ical().decode() == "FREQ=WEEKLY;BYYEARDAY=1,100,200,365;BYMONTH=1,7" 
开发者ID:jazzband,项目名称:django-ical,代码行数:13,代码来源:test_recurrence.py

示例13: test_weekly_by_month_nweekday

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_weekly_by_month_nweekday(self):
        rule = rrule(
            WEEKLY,
            count=3,
            bymonth=(1, 3),
            byweekday=(TU(1), TH(-1)),
            dtstart=datetime.datetime(1997, 9, 2, 9, 0),
        )
        vrecurr = utils.build_rrule_from_dateutil_rrule(rule)
        vRecur(
            vrecurr
        ).to_ical().decode() == "FREQ=WEEKLY;COUNT=3;BYDAY=TU,TH;BYMONTH=1,3" 
开发者ID:jazzband,项目名称:django-ical,代码行数:14,代码来源:test_recurrence.py

示例14: test_weekly_by_monthday

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_weekly_by_monthday(self):
        rule = rrule(
            WEEKLY,
            count=3,
            bymonthday=(1, 3),
            dtstart=datetime.datetime(1997, 9, 2, 9, 0),
        )
        vrecurr = utils.build_rrule_from_dateutil_rrule(rule)
        vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY;COUNT=3;BYMONTHDAY=1,3" 
开发者ID:jazzband,项目名称:django-ical,代码行数:11,代码来源:test_recurrence.py

示例15: test_rule

# 需要导入模块: from dateutil import rrule [as 别名]
# 或者: from dateutil.rrule import WEEKLY [as 别名]
def test_rule(self):
        rule = recurrence.Rule(recurrence.WEEKLY)
        vrecurr = utils.build_rrule_from_recurrences_rrule(rule)
        vRecur(vrecurr).to_ical().decode() == "FREQ=WEEKLY" 
开发者ID:jazzband,项目名称:django-ical,代码行数:6,代码来源:test_recurrence.py


注:本文中的dateutil.rrule.WEEKLY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。