MCPcopy Index your code
hub / github.com/apache/fory / read

Method read

python/pyfory/serializer.py:1694–1709  ·  view source on GitHub ↗
(self, read_context)

Source from the content-addressed store, hash-verified

1692 write_context.write_ref(field_value)
1693
1694 def read(self, read_context):
1695 policy = read_context.policy
1696 policy.authorize_instantiation(self.type_)
1697 obj = self.type_.__new__(self.type_)
1698 read_context.reference(obj)
1699 num_fields = read_context.read_var_uint32()
1700 _check_non_negative_size(num_fields, "object field")
1701 state = {}
1702 for _ in range(num_fields):
1703 field_name = read_context.read_string()
1704 field_value = read_context.read_ref()
1705 state[field_name] = field_value
1706 policy.intercept_setstate(obj, state)
1707 for field_name, field_value in state.items():
1708 setattr(obj, field_name, field_value)
1709 return obj
1710
1711
1712class _DefaultPolicyObjectSerializer(ObjectSerializer):

Callers

nothing calls this directly

Calls 8

_check_non_negative_sizeFunction · 0.85
itemsMethod · 0.80
referenceMethod · 0.65
read_var_uint32Method · 0.45
read_stringMethod · 0.45
read_refMethod · 0.45
intercept_setstateMethod · 0.45

Tested by

no test coverage detected