mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-26 17:05:31 +01:00
14 lines
291 B
Python
14 lines
291 B
Python
|
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
|