当前位置: 首页>>代码示例>>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;未经允许,请勿转载。