summaryrefslogtreecommitdiff
path: root/venv/Lib/site-packages/lazy_object_proxy/utils.py
blob: ceb3050f7675c8bba747ef33b0164162085e31c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
def identity(obj):
    return obj


class cached_property(object):
    def __init__(self, func):
        self.func = func

    def __get__(self, obj, cls):
        if obj is None:
            return self
        value = obj.__dict__[self.func.__name__] = self.func(obj)
        return value