本文整理匯總了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