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

Class _PyCmp

tests/python/test_dataclass_compare.py:1306–1317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1304
1305@_py_class_cmp(_unique_key_cmp("PyCmp"))
1306class _PyCmp(_Object_cmp):
1307 key: int
1308 label: str
1309
1310 def __ffi_hash__(self, fn_hash: _Callable_cmp[..., _Any_cmp]) -> int:
1311 return fn_hash(self.key)
1312
1313 def __ffi_eq__(self, other: _PyCmp, fn_eq: _Callable_cmp[..., _Any_cmp]) -> bool:
1314 return fn_eq(self.key, other.key)
1315
1316 def __ffi_compare__(self, other: _PyCmp, fn_cmp: _Callable_cmp[..., _Any_cmp]) -> int:
1317 return fn_cmp(self.key, other.key)
1318
1319
1320def test_py_class_custom_eq_ignores_label() -> None:

Calls

no outgoing calls