MCPcopy Create free account
hub / github.com/apache/tvm-ffi / decorator

Function decorator

python/tvm_ffi/dataclasses/c_class.py:153–172  ·  view source on GitHub ↗
(cls: _T)

Source from the content-addressed store, hash-verified

151 )
152
153 def decorator(cls: _T) -> _T:
154 cls = register_object(type_key, init=False)(cls)
155 type_info = getattr(cls, "__tvm_ffi_type_info__", None)
156 assert type_info is not None
157 _warn_missing_field_annotations(cls, type_info, stacklevel=2)
158 _attach_field_objects(cls, type_info)
159 _install_dataclass_dunders(
160 cls,
161 init=init,
162 repr=repr,
163 eq=eq,
164 order=order,
165 unsafe_hash=unsafe_hash,
166 match_args=match_args,
167 )
168 # Marker: distinguishes @c_class / @py_class types from FFI containers
169 # (Array, List, Map, Dict) that also have __tvm_ffi_type_info__ but are
170 # not dataclasses. Used by is_dataclass() in common.py.
171 setattr(cls, "__tvm_ffi_is_dataclass__", True)
172 return cls
173
174 return decorator

Callers

nothing calls this directly

Calls 4

register_objectFunction · 0.85
_attach_field_objectsFunction · 0.85

Tested by

no test coverage detected