MCPcopy Create free account
hub / github.com/dateutil/dateutil / between

Method between

src/dateutil/rrule.py:286–317  ·  view source on GitHub ↗

Returns all the occurrences of the rrule between after and before. The inc keyword defines what happens if after and/or before are themselves occurrences. With inc=True, they will be included in the list, if they are found in the recurrence set.

(self, after, before, inc=False, count=1)

Source from the content-addressed store, hash-verified

284 yield d
285
286 def between(self, after, before, inc=False, count=1):
287 """ Returns all the occurrences of the rrule between after and before.
288 The inc keyword defines what happens if after and/or before are
289 themselves occurrences. With inc=True, they will be included in the
290 list, if they are found in the recurrence set. """
291 if self._cache_complete:
292 gen = self._cache
293 else:
294 gen = self
295 started = False
296 l = []
297 if inc:
298 for i in gen:
299 if i > before:
300 break
301 elif not started:
302 if i >= after:
303 started = True
304 l.append(i)
305 else:
306 l.append(i)
307 else:
308 for i in gen:
309 if i >= before:
310 break
311 elif not started:
312 if i > after:
313 started = True
314 l.append(i)
315 else:
316 l.append(i)
317 return l
318
319
320class rrule(rrulebase):

Callers 5

testMonthlyByWeekDayMethod · 0.80
testBetweenMethod · 0.80
testBetweenIncMethod · 0.80
test_mlk_dayFunction · 0.80

Calls 1

appendMethod · 0.80

Tested by 5

testMonthlyByWeekDayMethod · 0.64
testBetweenMethod · 0.64
testBetweenIncMethod · 0.64
test_mlk_dayFunction · 0.64