gemini-code-assist[bot] commented on code in PR #175:
URL: https://github.com/apache/tvm-ffi/pull/175#discussion_r2443787349


##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -724,17 +741,20 @@ cdef class Function(Object):
     cdef int c_release_gil
     cdef dict __dict__
 
-    def __cinit__(self):
+    def __cinit__(self) -> None:
         self.c_release_gil = _RELEASE_GIL_BY_DEFAULT
 
     property release_gil:
-        def __get__(self):
+        """Whether calls release the Python GIL while executing."""
+
+        def __get__(self) -> bool:
             return self.c_release_gil != 0
 
-        def __set__(self, value):
+        def __set__(self, value: bool) -> None:
             self.c_release_gil = value
 
-    def __call__(self, *args):
+    def __call__(self, *args: Any) -> Any:
+        """Invoke the wrapped FFI function with ``args``."""

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring for `__call__` is incomplete. The full docstring from 
`core.pyi` provides more details about argument conversion and should be used 
here.
   
   ```
           """Invoke the wrapped FFI function with ``args``.
   
           Arguments are automatically converted between Python values and
           FFI-compatible forms. The return value is converted back to a
           Python object.
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -761,7 +781,7 @@ cdef class Function(Object):
     def __from_extern_c__(
         c_symbol: int,
         *,
-        keep_alive_object: object = None
+        keep_alive_object: object | None = None
     ) -> Function:
         """Convert a function from extern C address.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring here is minimal. The more detailed docstring from `core.pyi` 
should be used to provide more context for users.
   
   ```
           """Construct a ``Function`` from a C symbol and keep_alive_object.
   
           Parameters
           ----------
           c_symbol : int
               function pointer to the safe call function
               The function pointer must ignore the first argument,
               which is the function handle
   
           keep_alive_object : object
               optional object to be captured and kept alive
               Usually can be the execution engine that JITed the function
               to ensure we keep the execution environment alive
               as long as the function is alive
   
           Returns
           -------
           Function
               The constructed ``Function`` instance.
   
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -814,7 +834,7 @@ cdef class Function(Object):
     def __from_mlir_packed_safe_call__(
         mlir_packed_symbol: int,
         *,
-        keep_alive_object: object = None
+        keep_alive_object: object | None = None
     ) -> Function:
         """Convert a function from MLIR packed safe call function pointer.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring here is minimal. The more detailed docstring from `core.pyi` 
should be used to provide more context for users.
   
   ```
           """Construct a ``Function`` from a MLIR packed safe call function 
pointer.
   
           Parameters
           ----------
           mlir_packed_symbol : int
               function pointer to the MLIR packed call function pointer
               that represents a safe call function
   
           keep_alive_object : object
               optional object to be captured and kept alive
               Usually can be the execution engine that JITed the function
               to ensure we keep the execution environment alive
               as long as the function is alive
   
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -761,7 +781,7 @@ cdef class Function(Object):
     def __from_extern_c__(
         c_symbol: int,
         *,
-        keep_alive_object: object = None
+        keep_alive_object: object | None = None
     ) -> Function:
         """Convert a function from extern C address.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring here is minimal. The more detailed docstring from `core.pyi` 
should be used to provide more context for users.
   
   ```
           """Construct a ``Function`` from a C symbol and keep_alive_object.
   
           Parameters
           ----------
           c_symbol : int
               function pointer to the safe call function
               The function pointer must ignore the first argument,
               which is the function handle
   
           keep_alive_object : object
               optional object to be captured and kept alive
               Usually can be the execution engine that JITed the function
               to ensure we keep the execution environment alive
               as long as the function is alive
   
           Returns
           -------
           Function
               The constructed ``Function`` instance.
   
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -761,7 +781,7 @@ cdef class Function(Object):
     def __from_extern_c__(
         c_symbol: int,
         *,
-        keep_alive_object: object = None
+        keep_alive_object: object | None = None
     ) -> Function:
         """Convert a function from extern C address.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring here is minimal. The more detailed docstring from `core.pyi` 
should be used to provide more context for users.
   
   ```
           """Construct a ``Function`` from a C symbol and keep_alive_object.
   
           Parameters
           ----------
           c_symbol : int
               function pointer to the safe call function
               The function pointer must ignore the first argument,
               which is the function handle
   
           keep_alive_object : object
               optional object to be captured and kept alive
               Usually can be the execution engine that JITed the function
               to ensure we keep the execution environment alive
               as long as the function is alive
   
           Returns
           -------
           Function
               The constructed ``Function`` instance.
   
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -724,17 +741,20 @@ cdef class Function(Object):
     cdef int c_release_gil
     cdef dict __dict__
 
-    def __cinit__(self):
+    def __cinit__(self) -> None:
         self.c_release_gil = _RELEASE_GIL_BY_DEFAULT
 
     property release_gil:
-        def __get__(self):
+        """Whether calls release the Python GIL while executing."""
+
+        def __get__(self) -> bool:
             return self.c_release_gil != 0
 
-        def __set__(self, value):
+        def __set__(self, value: bool) -> None:
             self.c_release_gil = value

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring for the `release_gil` setter was removed from `core.pyi` but 
not added here. Please add the docstring to improve documentation.
   
   ```
               """Configure GIL release behavior for this function."""
               self.c_release_gil = value
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -724,17 +741,20 @@ cdef class Function(Object):
     cdef int c_release_gil
     cdef dict __dict__
 
-    def __cinit__(self):
+    def __cinit__(self) -> None:
         self.c_release_gil = _RELEASE_GIL_BY_DEFAULT
 
     property release_gil:
-        def __get__(self):
+        """Whether calls release the Python GIL while executing."""
+
+        def __get__(self) -> bool:
             return self.c_release_gil != 0
 
-        def __set__(self, value):
+        def __set__(self, value: bool) -> None:
             self.c_release_gil = value

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring for the `release_gil` setter was removed from `core.pyi` but 
not added here. Please add the docstring to improve documentation.
   
   ```
               """Configure GIL release behavior for this function."""
               self.c_release_gil = value
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -814,7 +834,7 @@ cdef class Function(Object):
     def __from_mlir_packed_safe_call__(
         mlir_packed_symbol: int,
         *,
-        keep_alive_object: object = None
+        keep_alive_object: object | None = None
     ) -> Function:
         """Convert a function from MLIR packed safe call function pointer.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring here is minimal. The more detailed docstring from `core.pyi` 
should be used to provide more context for users.
   
   ```
           """Construct a ``Function`` from a MLIR packed safe call function 
pointer.
   
           Parameters
           ----------
           mlir_packed_symbol : int
               function pointer to the MLIR packed call function pointer
               that represents a safe call function
   
           keep_alive_object : object
               optional object to be captured and kept alive
               Usually can be the execution engine that JITed the function
               to ensure we keep the execution environment alive
               as long as the function is alive
   
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -724,17 +741,20 @@ cdef class Function(Object):
     cdef int c_release_gil
     cdef dict __dict__
 
-    def __cinit__(self):
+    def __cinit__(self) -> None:
         self.c_release_gil = _RELEASE_GIL_BY_DEFAULT
 
     property release_gil:
-        def __get__(self):
+        """Whether calls release the Python GIL while executing."""
+
+        def __get__(self) -> bool:
             return self.c_release_gil != 0
 
-        def __set__(self, value):
+        def __set__(self, value: bool) -> None:
             self.c_release_gil = value
 
-    def __call__(self, *args):
+    def __call__(self, *args: Any) -> Any:
+        """Invoke the wrapped FFI function with ``args``."""

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring for `__call__` is incomplete. The full docstring from 
`core.pyi` provides more details about argument conversion and should be used 
here.
   
   ```
           """Invoke the wrapped FFI function with ``args``.
   
           Arguments are automatically converted between Python values and
           FFI-compatible forms. The return value is converted back to a
           Python object.
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -724,17 +741,20 @@ cdef class Function(Object):
     cdef int c_release_gil
     cdef dict __dict__
 
-    def __cinit__(self):
+    def __cinit__(self) -> None:
         self.c_release_gil = _RELEASE_GIL_BY_DEFAULT
 
     property release_gil:
-        def __get__(self):
+        """Whether calls release the Python GIL while executing."""
+
+        def __get__(self) -> bool:
             return self.c_release_gil != 0
 
-        def __set__(self, value):
+        def __set__(self, value: bool) -> None:
             self.c_release_gil = value

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring for the `release_gil` setter was removed from `core.pyi` but 
not added here. Please add the docstring to improve documentation.
   
   ```
               """Configure GIL release behavior for this function."""
               self.c_release_gil = value
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -814,7 +834,7 @@ cdef class Function(Object):
     def __from_mlir_packed_safe_call__(
         mlir_packed_symbol: int,
         *,
-        keep_alive_object: object = None
+        keep_alive_object: object | None = None
     ) -> Function:
         """Convert a function from MLIR packed safe call function pointer.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring here is minimal. The more detailed docstring from `core.pyi` 
should be used to provide more context for users.
   
   ```
           """Construct a ``Function`` from a MLIR packed safe call function 
pointer.
   
           Parameters
           ----------
           mlir_packed_symbol : int
               function pointer to the MLIR packed call function pointer
               that represents a safe call function
   
           keep_alive_object : object
               optional object to be captured and kept alive
               Usually can be the execution engine that JITed the function
               to ensure we keep the execution environment alive
               as long as the function is alive
   
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -724,17 +741,20 @@ cdef class Function(Object):
     cdef int c_release_gil
     cdef dict __dict__
 
-    def __cinit__(self):
+    def __cinit__(self) -> None:
         self.c_release_gil = _RELEASE_GIL_BY_DEFAULT
 
     property release_gil:
-        def __get__(self):
+        """Whether calls release the Python GIL while executing."""
+
+        def __get__(self) -> bool:
             return self.c_release_gil != 0
 
-        def __set__(self, value):
+        def __set__(self, value: bool) -> None:
             self.c_release_gil = value

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring for the `release_gil` setter was removed from `core.pyi` but 
not added here. Please add the docstring to improve documentation.
   
   ```
               """Configure GIL release behavior for this function."""
               self.c_release_gil = value
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -724,17 +741,20 @@ cdef class Function(Object):
     cdef int c_release_gil
     cdef dict __dict__
 
-    def __cinit__(self):
+    def __cinit__(self) -> None:
         self.c_release_gil = _RELEASE_GIL_BY_DEFAULT
 
     property release_gil:
-        def __get__(self):
+        """Whether calls release the Python GIL while executing."""
+
+        def __get__(self) -> bool:
             return self.c_release_gil != 0
 
-        def __set__(self, value):
+        def __set__(self, value: bool) -> None:
             self.c_release_gil = value
 
-    def __call__(self, *args):
+    def __call__(self, *args: Any) -> Any:
+        """Invoke the wrapped FFI function with ``args``."""

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring for `__call__` is incomplete. The full docstring from 
`core.pyi` provides more details about argument conversion and should be used 
here.
   
   ```
           """Invoke the wrapped FFI function with ``args``.
   
           Arguments are automatically converted between Python values and
           FFI-compatible forms. The return value is converted back to a
           Python object.
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -724,17 +741,20 @@ cdef class Function(Object):
     cdef int c_release_gil
     cdef dict __dict__
 
-    def __cinit__(self):
+    def __cinit__(self) -> None:
         self.c_release_gil = _RELEASE_GIL_BY_DEFAULT
 
     property release_gil:
-        def __get__(self):
+        """Whether calls release the Python GIL while executing."""
+
+        def __get__(self) -> bool:
             return self.c_release_gil != 0
 
-        def __set__(self, value):
+        def __set__(self, value: bool) -> None:
             self.c_release_gil = value
 
-    def __call__(self, *args):
+    def __call__(self, *args: Any) -> Any:
+        """Invoke the wrapped FFI function with ``args``."""

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring for `__call__` is incomplete. The full docstring from 
`core.pyi` provides more details about argument conversion and should be used 
here.
   
   ```
           """Invoke the wrapped FFI function with ``args``.
   
           Arguments are automatically converted between Python values and
           FFI-compatible forms. The return value is converted back to a
           Python object.
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -761,7 +781,7 @@ cdef class Function(Object):
     def __from_extern_c__(
         c_symbol: int,
         *,
-        keep_alive_object: object = None
+        keep_alive_object: object | None = None
     ) -> Function:
         """Convert a function from extern C address.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring here is minimal. The more detailed docstring from `core.pyi` 
should be used to provide more context for users.
   
   ```
           """Construct a ``Function`` from a C symbol and keep_alive_object.
   
           Parameters
           ----------
           c_symbol : int
               function pointer to the safe call function
               The function pointer must ignore the first argument,
               which is the function handle
   
           keep_alive_object : object
               optional object to be captured and kept alive
               Usually can be the execution engine that JITed the function
               to ensure we keep the execution environment alive
               as long as the function is alive
   
           Returns
           -------
           Function
               The constructed ``Function`` instance.
   
           """
   ```



##########
python/tvm_ffi/cython/function.pxi:
##########
@@ -814,7 +834,7 @@ cdef class Function(Object):
     def __from_mlir_packed_safe_call__(
         mlir_packed_symbol: int,
         *,
-        keep_alive_object: object = None
+        keep_alive_object: object | None = None
     ) -> Function:
         """Convert a function from MLIR packed safe call function pointer.

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The docstring here is minimal. The more detailed docstring from `core.pyi` 
should be used to provide more context for users.
   
   ```
           """Construct a ``Function`` from a MLIR packed safe call function 
pointer.
   
           Parameters
           ----------
           mlir_packed_symbol : int
               function pointer to the MLIR packed call function pointer
               that represents a safe call function
   
           keep_alive_object : object
               optional object to be captured and kept alive
               Usually can be the execution engine that JITed the function
               to ensure we keep the execution environment alive
               as long as the function is alive
   
           """
   ```



-- 
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]

Reply via email to