junrushao commented on code in PR #35:
URL: https://github.com/apache/tvm-ffi/pull/35#discussion_r2369791157
##########
python/tvm_ffi/access_path.py:
##########
@@ -39,11 +39,28 @@ class AccessKind(IntEnum):
class AccessStep(core.Object):
"""Access step container."""
+ kind: AccessKind
+ key: Any
+
@register_object("ffi.reflection.AccessPath")
class AccessPath(core.Object):
"""Access path container."""
+ parent: "AccessPath"
+
+ @staticmethod
+ def _root() -> "AccessPath": ... # type: ignore[empty-body]
+ def _path_equal(self, other: "AccessPath") -> bool: ... # type:
ignore[empty-body]
+ def _is_prefix_of(self, other: "AccessPath") -> bool: ... # type:
ignore[empty-body]
+ def _attr(self, attr_key: str) -> "AccessPath": ... # type:
ignore[empty-body]
+ def _attr_missing(self, attr_key: str) -> "AccessPath": ... # type:
ignore[empty-body]
+ def _array_item(self, index: int) -> "AccessPath": ... # type:
ignore[empty-body]
+ def _array_item_missing(self, index: int) -> "AccessPath": ... # type:
ignore[empty-body]
+ def _map_item(self, key: Any) -> "AccessPath": ... # type:
ignore[empty-body]
+ def _map_item_missing(self, key: Any) -> "AccessPath": ... # type:
ignore[empty-body]
+ def _to_steps(self) -> list["AccessStep"]: ... # type: ignore[empty-body]
Review Comment:
A reasonable balance to keep is:
- reflected fields are annotated without `TYPE_CHECKING`
- reflected methods are NOT explicitly written out, and warnings for them
are suppressed individually, e.g.
```
return self._map_item(key) # type: ignore[attr-defined]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]