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

Method _get_field_names

python/pyfory/struct.py:500–510  ·  view source on GitHub ↗
(self, clz)

Source from the content-addressed store, hash-verified

498 ]
499
500 def _get_field_names(self, clz):
501 if hasattr(clz, "__dict__"):
502 if dataclasses.is_dataclass(clz):
503 return [field.name for field in dataclasses.fields(clz)]
504 return sorted(self._type_hints.keys())
505 if hasattr(clz, "__slots__"):
506 slots = clz.__slots__
507 if isinstance(slots, str):
508 return [slots]
509 return sorted(slots)
510 return []
511
512 def _compute_unwrapped_hints(self):
513 return {field_name: unwrap_optional(hint)[0] for field_name, hint in self._type_hints.items()}

Callers 1

__init__Method · 0.95

Calls 2

fieldsMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected