Show More
@@ -2146,6 +2146,9 b' class baseset(list):' | |||||
2146 | l = [r for r in x if r not in s] |
|
2146 | l = [r for r in x if r not in s] | |
2147 | return baseset(list(self) + l) |
|
2147 | return baseset(list(self) + l) | |
2148 |
|
2148 | |||
|
2149 | def filter(self, l): | |||
|
2150 | return lazyset(self, l) | |||
|
2151 | ||||
2149 | class lazyset(object): |
|
2152 | class lazyset(object): | |
2150 | """Duck type for baseset class which iterates lazily over the revisions in |
|
2153 | """Duck type for baseset class which iterates lazily over the revisions in | |
2151 | the subset and contains a function which tests for membership in the |
|
2154 | the subset and contains a function which tests for membership in the | |
@@ -2210,6 +2213,9 b' class lazyset(object):' | |||||
2210 | def set(self): |
|
2213 | def set(self): | |
2211 | return set([r for r in self]) |
|
2214 | return set([r for r in self]) | |
2212 |
|
2215 | |||
|
2216 | def filter(self, l): | |||
|
2217 | return lazyset(self, l) | |||
|
2218 | ||||
2213 | class orderedlazyset(lazyset): |
|
2219 | class orderedlazyset(lazyset): | |
2214 | """Subclass of lazyset which subset can be ordered either ascending or |
|
2220 | """Subclass of lazyset which subset can be ordered either ascending or | |
2215 | descendingly |
|
2221 | descendingly | |
@@ -2218,6 +2224,9 b' class orderedlazyset(lazyset):' | |||||
2218 | super(orderedlazyset, self).__init__(subset, condition) |
|
2224 | super(orderedlazyset, self).__init__(subset, condition) | |
2219 | self._ascending = ascending |
|
2225 | self._ascending = ascending | |
2220 |
|
2226 | |||
|
2227 | def filter(self, l): | |||
|
2228 | return orderedlazyset(self, l, ascending=self._ascending) | |||
|
2229 | ||||
2221 | class generatorset(object): |
|
2230 | class generatorset(object): | |
2222 | """Wrapper structure for generators that provides lazy membership and can |
|
2231 | """Wrapper structure for generators that provides lazy membership and can | |
2223 | be iterated more than once. |
|
2232 | be iterated more than once. | |
@@ -2357,5 +2366,11 b' class spanset(object):' | |||||
2357 | def set(self): |
|
2366 | def set(self): | |
2358 | return self |
|
2367 | return self | |
2359 |
|
2368 | |||
|
2369 | def filter(self, l): | |||
|
2370 | if self._start <= self._end: | |||
|
2371 | return orderedlazyset(self, l) | |||
|
2372 | else: | |||
|
2373 | return orderedlazyset(self, l, ascending=False) | |||
|
2374 | ||||
2360 | # tell hggettext to extract docstrings from these functions: |
|
2375 | # tell hggettext to extract docstrings from these functions: | |
2361 | i18nfunctions = symbols.values() |
|
2376 | i18nfunctions = symbols.values() |
General Comments 0
You need to be logged in to leave comments.
Login now