Show More
@@ -2885,12 +2885,17 class baseset(abstractsmartset): | |||||
2885 |
|
2885 | |||
2886 | Every method in this class should be implemented by any smartset class. |
|
2886 | Every method in this class should be implemented by any smartset class. | |
2887 | """ |
|
2887 | """ | |
2888 | def __init__(self, data=()): |
|
2888 | def __init__(self, data=(), datarepr=None): | |
|
2889 | """ | |||
|
2890 | datarepr: a tuple of (format, obj, ...), a function or an object that | |||
|
2891 | provides a printable representation of the given data. | |||
|
2892 | """ | |||
2889 | if not isinstance(data, list): |
|
2893 | if not isinstance(data, list): | |
2890 | if isinstance(data, set): |
|
2894 | if isinstance(data, set): | |
2891 | self._set = data |
|
2895 | self._set = data | |
2892 | data = list(data) |
|
2896 | data = list(data) | |
2893 | self._list = data |
|
2897 | self._list = data | |
|
2898 | self._datarepr = datarepr | |||
2894 | self._ascending = None |
|
2899 | self._ascending = None | |
2895 |
|
2900 | |||
2896 | @util.propertycache |
|
2901 | @util.propertycache | |
@@ -2974,7 +2979,10 class baseset(abstractsmartset): | |||||
2974 |
|
2979 | |||
2975 | def __repr__(self): |
|
2980 | def __repr__(self): | |
2976 | d = {None: '', False: '-', True: '+'}[self._ascending] |
|
2981 | d = {None: '', False: '-', True: '+'}[self._ascending] | |
2977 | return '<%s%s %r>' % (type(self).__name__, d, self._list) |
|
2982 | s = _formatsetrepr(self._datarepr) | |
|
2983 | if not s: | |||
|
2984 | s = repr(self._list) | |||
|
2985 | return '<%s%s %s>' % (type(self).__name__, d, s) | |||
2978 |
|
2986 | |||
2979 | class filteredset(abstractsmartset): |
|
2987 | class filteredset(abstractsmartset): | |
2980 | """Duck type for baseset class which iterates lazily over the revisions in |
|
2988 | """Duck type for baseset class which iterates lazily over the revisions in |
General Comments 0
You need to be logged in to leave comments.
Login now