Coverage for /home/martinb/.local/share/virtualenvs/camcops/lib/python3.6/site-packages/deform/decorator.py : 44%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Decorator."""
4class reify(object):
6 """Put the result of a method which uses this (non-data)
7 descriptor decorator in the instance dict after the first call,
8 effectively replacing the decorator with an instance variable."""
10 def __init__(self, wrapped):
11 self.wrapped = wrapped
13 def __get__(self, inst, objtype=None):
14 if inst is None:
15 return self
16 val = self.wrapped(inst)
17 setattr(inst, self.wrapped.__name__, val)
18 return val