當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。