Python dateutil.rrule() Examples
The following are 11
code examples of dateutil.rrule().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
dateutil
, or try the search function
.
Example #1
Source File: test_imports.py From plugin.video.emby with GNU General Public License v3.0 | 7 votes |
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)
Example #2
Source File: test_import_star.py From plugin.video.emby with GNU General Public License v3.0 | 6 votes |
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)
Example #3
Source File: test_dates.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()
Example #4
Source File: test_dates.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()
Example #5
Source File: test_imports.py From bazarr with GNU General Public License v3.0 | 6 votes |
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)
Example #6
Source File: test_dates.py From coffeegrindsize with MIT License | 6 votes |
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()
Example #7
Source File: test_dates.py From coffeegrindsize with MIT License | 6 votes |
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()
Example #8
Source File: util.py From arctic with GNU Lesser General Public License v2.1 | 5 votes |
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
Example #9
Source File: serializers.py From karrot-backend with GNU Affero General Public License v3.0 | 5 votes |
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
Example #10
Source File: test_dates.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #11
Source File: test_dates.py From coffeegrindsize with MIT License | 5 votes |
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