##// END OF EJS Templates
templater: drop hybrid-ness on unwrapvalue()...
Yuya Nishihara -
r38288:cf8d210d default
parent child Browse files
Show More
@@ -235,22 +235,12 b' class hybrid(wrapped):'
235 return gen
235 return gen
236
236
237 def tovalue(self, context, mapping):
237 def tovalue(self, context, mapping):
238 # TODO: return self._values and get rid of proxy methods
238 # TODO: make it non-recursive for trivial lists/dicts
239 return self
239 xs = self._values
240
240 if util.safehasattr(xs, 'get'):
241 def __contains__(self, x):
241 return {k: unwrapvalue(context, mapping, v)
242 return x in self._values
242 for k, v in xs.iteritems()}
243 def __getitem__(self, key):
243 return [unwrapvalue(context, mapping, x) for x in xs]
244 return self._values[key]
245 def __len__(self):
246 return len(self._values)
247 def __iter__(self):
248 return iter(self._values)
249 def __getattr__(self, name):
250 if name not in (r'get', r'items', r'iteritems', r'iterkeys',
251 r'itervalues', r'keys', r'values'):
252 raise AttributeError(name)
253 return getattr(self._values, name)
254
244
255 class mappable(wrapped):
245 class mappable(wrapped):
256 """Wrapper for non-list/dict object to support map operation
246 """Wrapper for non-list/dict object to support map operation
@@ -259,9 +249,6 b' class mappable(wrapped):'
259 - "{manifest}"
249 - "{manifest}"
260 - "{manifest % '{rev}:{node}'}"
250 - "{manifest % '{rev}:{node}'}"
261 - "{manifest.rev}"
251 - "{manifest.rev}"
262
263 Unlike a hybrid, this does not simulate the behavior of the underling
264 value.
265 """
252 """
266
253
267 def __init__(self, gen, key, value, makemap):
254 def __init__(self, gen, key, value, makemap):
General Comments 0
You need to be logged in to leave comments. Login now