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