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


Python rrule.YEARLY屬性代碼示例

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


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

示例1: year_blocks

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import YEARLY [as 別名]
def year_blocks(start, end):
    """
    Create pairs of start and end with max a year in between, to deal with usage restrictions on the API

    Parameters
    ----------
    start : dt.datetime | pd.Timestamp
    end : dt.datetime | pd.Timestamp

    Returns
    -------
    ((pd.Timestamp, pd.Timestamp))
    """
    rule = rrule.YEARLY

    res = []
    for day in rrule.rrule(rule, dtstart=start, until=end):
        res.append(pd.Timestamp(day))
    res.append(end)
    res = sorted(set(res))
    res = pairwise(res)
    return res 
開發者ID:EnergieID,項目名稱:entsoe-py,代碼行數:24,代碼來源:misc.py

示例2: _getWhen

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

示例3: test_every_year

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import YEARLY [as 別名]
def test_every_year(self):
        """Repeat every year."""
        vrecurr = utils.build_rrule(freq="YEARLY")
        assert vrecurr["FREQ"] == "YEARLY"
        vRecur(vrecurr).to_ical().decode() == "FREQ=YEARLY"
        assert len(vrecurr.keys()) == 1 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:8,代碼來源:test_recurrence.py

示例4: test_every_day_in_jan

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

示例5: test_every_fr_13th

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import YEARLY [as 別名]
def test_every_fr_13th(self):
        """Repeat every Friday the 13th."""
        vrecurr = utils.build_rrule(freq="YEARLY", bymonthday=13, byday="FR")
        assert vrecurr["FREQ"] == "YEARLY"
        assert vrecurr["BYMONTHDAY"] == 13
        assert vrecurr["BYDAY"] == "FR"
        vRecur(vrecurr).to_ical().decode() == "FREQ=YEARLY;BYDAY=FR;BYMONTHDAY=13"
        assert len(vrecurr.keys()) == 3 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:10,代碼來源:test_recurrence.py

示例6: test_yearly_month_nweekday

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

示例7: test_yearly_month_yearday

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import YEARLY [as 別名]
def test_yearly_month_yearday(self):
        rule = rrule(
            YEARLY,
            count=4,
            bymonth=(4, 7),
            byyearday=(1, 100, 200, 365),
            dtstart=datetime.datetime(1997, 9, 2, 9, 0),
        )
        vrecurr = utils.build_rrule_from_dateutil_rrule(rule)
        assert (
            vRecur(vrecurr).to_ical().decode()
            == "FREQ=YEARLY;COUNT=4;BYYEARDAY=1,100,200,365;BYMONTH=4,7"
        ) 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:15,代碼來源:test_recurrence.py

示例8: test_yearly_weekno_weekday

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import YEARLY [as 別名]
def test_yearly_weekno_weekday(self):
        rule = rrule(
            YEARLY,
            count=3,
            byweekno=1,
            byweekday=MO,
            dtstart=datetime.datetime(1997, 9, 2, 9, 0),
        )
        vrecurr = utils.build_rrule_from_dateutil_rrule(rule)
        vRecur(vrecurr).to_ical().decode() == "FREQ=YEARLY;COUNT=3;BYDAY=MO;BYWEEKNO=1" 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:12,代碼來源:test_recurrence.py

示例9: test_yearly_setpos

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import YEARLY [as 別名]
def test_yearly_setpos(self):
        rule = rrule(
            YEARLY,
            count=3,
            bymonthday=15,
            byhour=(6, 18),
            bysetpos=(3, -3),
            dtstart=datetime.datetime(1997, 9, 2, 9, 0),
        )
        vrecurr = utils.build_rrule_from_dateutil_rrule(rule)
        assert (
            vRecur(vrecurr).to_ical().decode()
            == "FREQ=YEARLY;COUNT=3;BYHOUR=6,18;BYMONTHDAY=15;BYSETPOS=3,-3"
        ) 
開發者ID:jazzband,項目名稱:django-ical,代碼行數:16,代碼來源:test_recurrence.py

示例10: frequency

# 需要導入模塊: from dateutil import rrule [as 別名]
# 或者: from dateutil.rrule import YEARLY [as 別名]
def frequency(self):
        """
        How often the recurrence repeats.
        ("YEARLY", "MONTHLY", "WEEKLY", "DAILY")
        """
        freqOptions = ("YEARLY", "MONTHLY", "WEEKLY", "DAILY")
        if self.rule._freq < len(freqOptions):
            return freqOptions[self.rule._freq]
        else:
            return "unsupported_frequency_{}".format(self.rule._freq) 
開發者ID:linuxsoftware,項目名稱:ls.joyous,代碼行數:12,代碼來源:recurrence.py


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