Completed
Pull Request — master (#19)
by Ionel Cristian
01:00
created

src.hunter.cached_property.__get__()   A

Complexity

Conditions 2

Size

Total Lines 5

Duplication

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