Add utils.collect_iterable decorator.
This commit is contained in:
parent
9155905398
commit
e8d7d1f4d1
1 changed files with 7 additions and 0 deletions
|
|
@ -29,3 +29,10 @@ def cached_property(fun):
|
||||||
ret = self._cache[fun] = fun(self)
|
ret = self._cache[fun] = fun(self)
|
||||||
return ret
|
return ret
|
||||||
return property(get)
|
return property(get)
|
||||||
|
|
||||||
|
|
||||||
|
def collect_iterable(func):
|
||||||
|
@functools.wraps(func)
|
||||||
|
def collect(*args, **kwargs):
|
||||||
|
return list(func(*args, **kwargs))
|
||||||
|
return collect
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue