本文整理汇总了Python中dateutil.rrule方法的典型用法代码示例。如果您正苦于以下问题:Python dateutil.rrule方法的具体用法?Python dateutil.rrule怎么用?Python dateutil.rrule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dateutil
的用法示例。
在下文中一共展示了dateutil.rrule方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testImportedModules
# 需要导入模块: import dateutil [as 别名]
# 或者: from dateutil import rrule [as 别名]
def testImportedModules(self):
import dateutil.easter
import dateutil.parser
import dateutil.relativedelta
import dateutil.rrule
import dateutil.tz
import dateutil.utils
import dateutil.zoneinfo
self.assertEquals(dateutil.easter, new_locals.pop("easter"))
self.assertEquals(dateutil.parser, new_locals.pop("parser"))
self.assertEquals(dateutil.relativedelta, new_locals.pop("relativedelta"))
self.assertEquals(dateutil.rrule, new_locals.pop("rrule"))
self.assertEquals(dateutil.tz, new_locals.pop("tz"))
self.assertEquals(dateutil.utils, new_locals.pop("utils"))
self.assertEquals(dateutil.zoneinfo, new_locals.pop("zoneinfo"))
self.assertFalse(new_locals)
示例2: testRRuleAll
# 需要导入模块: import dateutil [as 别名]
# 或者: from dateutil import rrule [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)
示例3: test_RRuleLocator
# 需要导入模块: import dateutil [as 别名]
# 或者: from dateutil import rrule [as 别名]
def test_RRuleLocator():
import matplotlib.testing.jpl_units as units
units.register()
# This will cause the RRuleLocator to go out of bounds when it tries
# to add padding to the limits, so we make sure it caps at the correct
# boundary values.
t0 = datetime.datetime(1000, 1, 1)
tf = datetime.datetime(6000, 1, 1)
fig = plt.figure()
ax = plt.subplot(111)
ax.set_autoscale_on(True)
ax.plot([t0, tf], [0.0, 1.0], marker='o')
rrule = mdates.rrulewrapper(dateutil.rrule.YEARLY, interval=500)
locator = mdates.RRuleLocator(rrule)
ax.xaxis.set_major_locator(locator)
ax.xaxis.set_major_formatter(mdates.AutoDateFormatter(locator))
ax.autoscale_view()
fig.autofmt_xdate()
示例4: test_DateFormatter
# 需要导入模块: import dateutil [as 别名]
# 或者: from dateutil import rrule [as 别名]
def test_DateFormatter():
import matplotlib.testing.jpl_units as units
units.register()
# Lets make sure that DateFormatter will allow us to have tick marks
# at intervals of fractional seconds.
t0 = datetime.datetime(2001, 1, 1, 0, 0, 0)
tf = datetime.datetime(2001, 1, 1, 0, 0, 1)
fig = plt.figure()
ax = plt.subplot(111)
ax.set_autoscale_on(True)
ax.plot([t0, tf], [0.0, 1.0], marker='o')
# rrule = mpldates.rrulewrapper( dateutil.rrule.YEARLY, interval=500 )
# locator = mpldates.RRuleLocator( rrule )
# ax.xaxis.set_major_locator( locator )
# ax.xaxis.set_major_formatter( mpldates.AutoDateFormatter(locator) )
ax.autoscale_view()
fig.autofmt_xdate()
示例5: get_large_ts
# 需要导入模块: import dateutil [as 别名]
# 或者: from dateutil import rrule [as 别名]
def get_large_ts(size=2500):
timestamps = list(rrule(DAILY, count=size, dtstart=dt(1970, 1, 1), interval=1))
pd = pandas.DataFrame(index=timestamps, data={'n' + str(i): np.random.random_sample(size) for i in range(size)})
pd.index.name = 'index'
return pd
示例6: validate_rule
# 需要导入模块: import dateutil [as 别名]
# 或者: from dateutil import rrule [as 别名]
def validate_rule(self, rule_string):
try:
rrule = dateutil.rrule.rrulestr(rule_string)
except ValueError:
raise serializers.ValidationError(_('Invalid recurrence rule.'))
if not isinstance(rrule, dateutil.rrule.rrule):
raise serializers.ValidationError(_('Only single recurrence rules are allowed.'))
return rule_string
示例7: _test_rrulewrapper
# 需要导入模块: import dateutil [as 别名]
# 或者: from dateutil import rrule [as 别名]
def _test_rrulewrapper(attach_tz, get_tz):
SYD = get_tz('Australia/Sydney')
dtstart = attach_tz(datetime.datetime(2017, 4, 1, 0), SYD)
dtend = attach_tz(datetime.datetime(2017, 4, 4, 0), SYD)
rule = mdates.rrulewrapper(freq=dateutil.rrule.DAILY, dtstart=dtstart)
act = rule.between(dtstart, dtend)
exp = [datetime.datetime(2017, 4, 1, 13, tzinfo=dateutil.tz.tzutc()),
datetime.datetime(2017, 4, 2, 14, tzinfo=dateutil.tz.tzutc())]
assert act == exp