MCPcopy Create free account
hub / github.com/apache/fory / _build_union

Method _build_union

python/pyfory/union.py:164–170  ·  view source on GitHub ↗
(self, case_id: int, value: object)

Source from the content-addressed store, hash-verified

162 return typeinfo
163
164 def _build_union(self, case_id: int, value: object):
165 if case_id not in self._case_types:
166 raise ValueError(f"unknown union case id: {case_id}")
167 builder = getattr(self.type_, "_from_case_id", None)
168 if builder is None:
169 raise TypeError(f"{self.type_} must define _from_case_id for union deserialization")
170 return builder(case_id, value)
171
172 def _write_typing_union(self, write_context, value):
173 active_index = None

Callers 1

readMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected