# HG changeset patch # User Paul Boddie # Date 1508799908 -7200 # Node ID 7e316a669ac2c24f92c5ffd42be789e72126b47e # Parent 90a602ef7884193d1cf7928a22406819cb1664e6 Added a method to expose the recurrence iterator. Fixed the materialise method's docstring, removing mentions of the count parameter. diff -r 90a602ef7884 -r 7e316a669ac2 vRecurrence.py --- a/vRecurrence.py Tue Oct 24 00:43:43 2017 +0200 +++ b/vRecurrence.py Tue Oct 24 01:05:08 2017 +0200 @@ -710,12 +710,11 @@ return "%s(%r, %r, %r, %r)" % (self.__class__.__name__, self.level, self.args, self.qualifier, self.first) - def materialise(self, start, end, inclusive=False): + def select(self, start, end, inclusive=False): """ - Starting at 'start', materialise instances up to but not including any - at 'end' or later, returning at most 'count' if specified. A list of - instances is returned. + Return an iterator over instances starting at 'start' and continuing up + to but not including any at 'end' or later. If 'inclusive' is specified, the selection of instances will include the end of the search period if present in the results. @@ -723,8 +722,19 @@ start = to_tuple(start) end = to_tuple(end) - results = self.materialise_items(start, start, end, inclusive) - return list(results) + return self.materialise_items(start, start, end, inclusive) + + def materialise(self, start, end, inclusive=False): + + """ + Starting at 'start', materialise instances up to but not including any + at 'end' or later. A list of instances is returned. + + If 'inclusive' is specified, the selection of instances will include the + end of the search period if present in the results. + """ + + return list(self.select(start, end, inclusive)) class Pattern(Selector):