MCPcopy
hub / github.com/wechatpy/wechatpy / __get__

Method __get__

wechatpy/fields.py:31–43  ·  view source on GitHub ↗
(self, instance, instance_type=None)

Source from the content-addressed store, hash-verified

29 self.attr_name = field.name
30
31 def __get__(self, instance, instance_type=None):
32 if instance is not None:
33 value = instance._data.get(self.attr_name)
34 if value is None:
35 value = copy.deepcopy(self.field.default)
36 instance._data[self.attr_name] = value
37 if isinstance(value, dict):
38 value = ObjectDict(value)
39 if value and not isinstance(value, (dict, list, tuple)) and \
40 six.callable(self.field.converter):
41 value = self.field.converter(value)
42 return value
43 return self.field
44
45 def __set__(self, instance, value):
46 instance._data[self.attr_name] = value

Callers

nothing calls this directly

Calls 2

ObjectDictClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected