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)
| 269 | yield d |
| 270 | |
| 271 | def between(self, after, before, inc=False, count=1): |
| 272 | """ Returns all the occurrences of the rrule between after and before. |
| 273 | The inc keyword defines what happens if after and/or before are |
| 274 | themselves occurrences. With inc=True, they will be included in the |
| 275 | list, if they are found in the recurrence set. """ |
| 276 | if self._cache_complete: |
| 277 | gen = self._cache |
| 278 | else: |
| 279 | gen = self |
| 280 | started = False |
| 281 | l = [] |
| 282 | if inc: |
| 283 | for i in gen: |
| 284 | if i > before: |
| 285 | break |
| 286 | elif not started: |
| 287 | if i >= after: |
| 288 | started = True |
| 289 | l.append(i) |
| 290 | else: |
| 291 | l.append(i) |
| 292 | else: |
| 293 | for i in gen: |
| 294 | if i >= before: |
| 295 | break |
| 296 | elif not started: |
| 297 | if i > after: |
| 298 | started = True |
| 299 | l.append(i) |
| 300 | else: |
| 301 | l.append(i) |
| 302 | return l |
| 303 | |
| 304 | |
| 305 | class rrule(rrulebase): |