class Layout: def value_repr(self): return ReprFields(**{name: ReprSlice(field.offset, field.offset + field.width, field.shape.value_repr()) for name, field in self}) class Enum: def value_repr(self): return ReprFields( name = ReprEnum({e.value: e.name for e in self}), value = ReprInt(), ) class FixedPoint: def value_repr(self): return ReprFields( raw = ReprInt(), float = ReprFunction(lambda value: value.as_float()), )