Completed
Push — master ( b2b0a5...3849b1 )
by Ionel Cristian
57s
created

src.lazy_object_proxy.cached_property   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 9
Duplicated Lines 0 %
Metric Value
dl 0
loc 9
rs 10
wmc 3
1
def identity(obj):
2
    return obj
3
4
5
class cached_property(object):
6
    def __init__(self, func):
7
        self.func = func
8
9
    def __get__(self, obj, cls):
10
        if obj is None:
11
            return self
12
        value = obj.__dict__[self.func.__name__] = self.func(obj)
13
        return value
14