當前位置: 首頁>>代碼示例>>Python>>正文


Python rrule.TU屬性代碼示例

本文整理匯總了Python中dateutil.rrule.TU屬性的典型用法代碼示例。如果您正苦於以下問題:Python rrule.TU屬性的具體用法?Python rrule.TU怎麽用?Python rrule.TU使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在dateutil.rrule的用法示例。


在下文中一共展示了rrule.TU屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testRRuleAll

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [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: testRelativeDeltaAll

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
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) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:12,代碼來源:test_imports.py

示例3: test_weekly_tue

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [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

示例4: test_every_weekday

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [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

示例5: test_every_month_last_working_day

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
def test_every_month_last_working_day(self):
        """Repeat the last working day of each month."""
        vrecurr = utils.build_rrule(
            freq="MONTHLY", byday=["MO", "TU", "WE", "TH", "FR"], bysetpos=-1
        )
        assert vrecurr["FREQ"] == "MONTHLY"
        assert vrecurr["BYDAY"] == ["MO", "TU", "WE", "TH", "FR"]
        assert vrecurr["BYSETPOS"] == -1
        vRecur(
            vrecurr
        ).to_ical().decode() == "FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1"
        assert len(vrecurr.keys()) == 3 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:14,代碼來源:test_recurrence.py

示例6: test_every_day_in_jan

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
def test_every_day_in_jan(self):
        """Repeat every day in January"""
        vrecurr = utils.build_rrule(
            freq="YEARLY", bymonth=1, byday=["MO", "TU", "WE", "TH", "FR", "SA", "SU"]
        )
        assert vrecurr["FREQ"] == "YEARLY"
        assert vrecurr["BYMONTH"] == 1
        assert vrecurr["BYDAY"] == ["MO", "TU", "WE", "TH", "FR", "SA", "SU"]
        vRecur(
            vrecurr
        ).to_ical().decode() == "FREQ=YEARLY;BYDAY=MO,TU,WE,TH,FR,SA,SU;BYMONTH=1"
        assert len(vrecurr.keys()) == 3 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:14,代碼來源:test_recurrence.py

示例7: test_weekly_by_month_nweekday

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [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

示例8: test_weekly_by_weekday

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
def test_weekly_by_weekday(self):
        rule = rrule(
            WEEKLY,
            count=3,
            byweekday=(TU, TH),
            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" 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:11,代碼來源:test_recurrence.py

示例9: test_daily_by_month_nweekday

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
def test_daily_by_month_nweekday(self):
        rule = rrule(
            DAILY,
            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=DAILY;COUNT=3;BYDAY=TU,TH;BYMONTH=1,3" 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:14,代碼來源:test_recurrence.py

示例10: test_monthly_nweekday

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
def test_monthly_nweekday(self):
        rule = rrule(
            MONTHLY,
            count=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=MONTHLY;COUNT=3;BYDAY=+1TU,-1TH" 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:11,代碼來源:test_recurrence.py

示例11: test_monthly_month_nweekday

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
def test_monthly_month_nweekday(self):
        rule = rrule(
            MONTHLY,
            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=MONTHLY;BYDAY=+1TU,-1TH;BYMONTH=1,3" 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:11,代碼來源:test_recurrence.py

示例12: test_complex_rule_serialization

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
def test_complex_rule_serialization(self):
        rule = recurrence.Rule(
            recurrence.WEEKLY,
            interval=17,
            wkst=1,
            count=7,
            byday=[recurrence.to_weekday("-1MO"), recurrence.to_weekday("TU")],
            bymonth=[1, 3],
        )
        vrecurr = utils.build_rrule_from_recurrences_rrule(rule)
        assert (
            vRecur(vrecurr).to_ical().decode()
            == "FREQ=WEEKLY;COUNT=7;INTERVAL=17;BYDAY=-1MO,TU;BYMONTH=1,3;WKST=TU"
        ) 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:16,代碼來源:test_recurrence.py

示例13: test_complex_rule_serialization_with_weekday_instance

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
def test_complex_rule_serialization_with_weekday_instance(self):
        rule = recurrence.Rule(
            recurrence.WEEKLY,
            interval=17,
            wkst=recurrence.to_weekday(1),
            count=7,
            byday=[recurrence.to_weekday("-1MO"), recurrence.to_weekday("TU")],
            bymonth=[1, 3],
        )
        vrecurr = utils.build_rrule_from_recurrences_rrule(rule)
        assert (
            vRecur(vrecurr).to_ical().decode()
            == "FREQ=WEEKLY;COUNT=7;INTERVAL=17;BYDAY=-1MO,TU;BYMONTH=1,3;WKST=TU"
        ) 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:16,代碼來源:test_recurrence.py

示例14: get_early_closes

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
def get_early_closes(start, end):
    # TSX closed at 1:00 PM on december 24th.

    start = canonicalize_datetime(start)
    end = canonicalize_datetime(end)

    start = max(start, datetime(1993, 1, 1, tzinfo=pytz.utc))
    end = max(end, datetime(1993, 1, 1, tzinfo=pytz.utc))

    # Not included here are early closes prior to 1993
    # or unplanned early closes

    early_close_rules = []

    christmas_eve = rrule.rrule(
        rrule.MONTHLY,
        bymonth=12,
        bymonthday=24,
        byweekday=(rrule.MO, rrule.TU, rrule.WE, rrule.TH, rrule.FR),
        cache=True,
        dtstart=start,
        until=end
    )
    early_close_rules.append(christmas_eve)

    early_close_ruleset = rrule.rruleset()

    for rule in early_close_rules:
        early_close_ruleset.rrule(rule)
    early_closes = early_close_ruleset.between(start, end, inc=True)

    early_closes.sort()
    return pd.DatetimeIndex(early_closes) 
開發者ID:zhanghan1990,項目名稱:zipline-chinese,代碼行數:35,代碼來源:tradingcalendar_tse.py

示例15: init_rruleset

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import TU [as 別名]
def init_rruleset():
    rr = rruleset()
    rr.rrule(rrule(DAILY,
                   byweekday=(MO,TU,WE,TH,FR),
                   dtstart=datetime.datetime(2010,1,1)))
    for h in holidays:
        rr.exdate(h)
    return rr 
開發者ID:botant,項目名稱:py-business-calendar,代碼行數:10,代碼來源:speed_comparison.py


注:本文中的dateutil.rrule.TU屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。