gemini-code-assist[bot] commented on code in PR #175:
URL: https://github.com/apache/tvm-ffi/pull/175#discussion_r2443851708
##########
python/tvm_ffi/cython/object.pxi:
##########
@@ -104,19 +149,19 @@ cdef class Object:
else:
self.chandle = NULL
- def __repr__(self):
+ def __repr__(self) -> str:
# exception safety handling for chandle=None
if self.chandle == NULL:
return type(self).__name__ + "(chandle=None)"
return str(__object_repr__(self))
- def __eq__(self, other):
+ def __eq__(self, other: "Object") -> bool:
return self.same_as(other)
- def __ne__(self, other):
+ def __ne__(self, other: "Object") -> bool:
Review Comment:

The type hint for `other` in `__ne__` should be `object` for consistency
with `__eq__` and to correctly handle comparisons with non-Object types.
```
def __ne__(self, other: object) -> bool:
```
##########
python/tvm_ffi/cython/object.pxi:
##########
@@ -104,19 +149,19 @@ cdef class Object:
else:
self.chandle = NULL
- def __repr__(self):
+ def __repr__(self) -> str:
# exception safety handling for chandle=None
if self.chandle == NULL:
return type(self).__name__ + "(chandle=None)"
return str(__object_repr__(self))
- def __eq__(self, other):
+ def __eq__(self, other: "Object") -> bool:
Review Comment:

The type hint for `other` in `__eq__` should be `object` for broader
compatibility and to correctly handle comparisons with non-Object types. The
`same_as` method, which is called here, already handles non-Object types
gracefully by returning `False`.
```
def __eq__(self, other: object) -> bool:
```
##########
python/tvm_ffi/cython/object.pxi:
##########
@@ -104,19 +149,19 @@ cdef class Object:
else:
self.chandle = NULL
- def __repr__(self):
+ def __repr__(self) -> str:
# exception safety handling for chandle=None
if self.chandle == NULL:
return type(self).__name__ + "(chandle=None)"
return str(__object_repr__(self))
- def __eq__(self, other):
+ def __eq__(self, other: "Object") -> bool:
return self.same_as(other)
- def __ne__(self, other):
+ def __ne__(self, other: "Object") -> bool:
Review Comment:

The type hint for `other` in `__ne__` should be `object` for consistency
with `__eq__` and to correctly handle comparisons with non-Object types.
```
def __ne__(self, other: object) -> bool:
```
##########
python/tvm_ffi/cython/object.pxi:
##########
@@ -104,19 +149,19 @@ cdef class Object:
else:
self.chandle = NULL
- def __repr__(self):
+ def __repr__(self) -> str:
# exception safety handling for chandle=None
if self.chandle == NULL:
return type(self).__name__ + "(chandle=None)"
return str(__object_repr__(self))
- def __eq__(self, other):
+ def __eq__(self, other: "Object") -> bool:
Review Comment:

The type hint for `other` in `__eq__` should be `object` for broader
compatibility and to correctly handle comparisons with non-Object types. The
`same_as` method, which is called here, already handles non-Object types
gracefully by returning `False`.
```
def __eq__(self, other: object) -> bool:
```
--
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]