<s> from inspect import isclass , ismodule <EOL> from . strings import cut_prefix <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> class cached_property ( object ) : <EOL> """<STR_LIT>""" <EOL> fset = fdel = None <EOL> def __init__ ( self , fget ) : <EOL> self . fget = fget <EOL> self . __doc__ = getattr ( fget , '<STR_LIT>' ) <EOL> def __get__ ( self , instance , type = None ) : <EOL> if instance is None : <EOL> return self <EOL> res = instance . __dict__ [ self . fget . __name__ ] = self . fget ( instance ) <EOL> return res <EOL> def monkey ( cls , name = None ) : <EOL> assert isclass ( cls ) or ismodule ( cls ) , "<STR_LIT>" <EOL> def decorator ( value ) : <EOL> func = getattr ( value , '<STR_LIT>' , value ) <EOL> func_name = name or cut_prefix ( func . __name__ , '<STR_LIT>' % cls . __name__ ) <EOL> func . __name__ = func_name <EOL> func . original = getattr ( cls , func_name , None ) <EOL> setattr ( cls , func_name , value ) <EOL> return value <EOL> return decorator </s>
