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

src.hunter.cached_property.__init__()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 3
rs 10
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