Conditions | 3 |
Total Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | def lazyproperty(fn): |
||
2 | attr_name = '__' + fn.__name__ |
||
3 | |||
4 | @property |
||
5 | def _lazyprop(self): |
||
6 | if not hasattr(self, attr_name): |
||
7 | setattr(self, attr_name, fn(self)) |
||
8 | return getattr(self, attr_name) |
||
9 | |||
10 | return _lazyprop |
||
11 |