MCPcopy Create free account
hub / github.com/pytorch/executorch / _fbs_default_to_python

Function _fbs_default_to_python

backends/mlx/serialization/generate.py:538–555  ·  view source on GitHub ↗

Convert FBS default value to Python.

(default: Optional[str], fbs_type: str)

Source from the content-addressed store, hash-verified

536
537
538def _fbs_default_to_python(default: Optional[str], fbs_type: str) -> Optional[str]:
539 """Convert FBS default value to Python."""
540 if default is None:
541 return None
542
543 if default == "false":
544 return "False"
545 if default == "true":
546 return "True"
547 if default == "null":
548 return "None"
549
550 # Handle enum defaults like 'TensorSlot'
551 if fbs_type == "SlotType":
552 return f"SlotType.{default}"
553
554 # Numeric defaults
555 return default
556
557
558def generate_python_serializers(schema: FBSSchema) -> str:

Callers 2

_generate_dataclassFunction · 0.85
generate_python_schemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected