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

Method write

python/pyfory/serializer.py:1681–1692  ·  view source on GitHub ↗
(self, write_context, value)

Source from the content-addressed store, hash-verified

1679 self._slot_field_names = sorted(slots)
1680
1681 def write(self, write_context, value):
1682 if self._slot_field_names is not None:
1683 sorted_field_names = self._slot_field_names
1684 else:
1685 value_dict = getattr(value, "__dict__", None)
1686 sorted_field_names = [] if value_dict is None else sorted(value_dict.keys())
1687
1688 write_context.write_var_uint32(len(sorted_field_names))
1689 for field_name in sorted_field_names:
1690 write_context.write_string(field_name)
1691 field_value = getattr(value, field_name)
1692 write_context.write_ref(field_value)
1693
1694 def read(self, read_context):
1695 policy = read_context.policy

Callers

nothing calls this directly

Calls 4

write_refMethod · 0.80
keysMethod · 0.45
write_var_uint32Method · 0.45
write_stringMethod · 0.45

Tested by

no test coverage detected