AlenkaF commented on PR #55264:
URL: https://github.com/apache/arrow/pull/55264#issuecomment-6463891967

   I have started with reviewing pyarrow tests with running `mypy 
--check-untyped-defs --warn-unused-ignores pyarrow/tests/test_*` and looking at 
the ignores. The stubs seem to have changed since the last time type checkers 
were run on pyarrow tests, example:
   
   <details>
   <summary>click for output</summary>
   
   ```python
   $ mypy --check-untyped-defs --warn-unused-ignores 
pyarrow/tests/test_array.py 
   pyarrow/tests/test_array.py:21: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:22: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:25: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:80: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:790: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:986: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:1300: error: List item 3 has incompatible type 
"None"; expected "int"  [list-item]
   pyarrow/tests/test_array.py:1302: error: List item 1 has incompatible type 
"None"; expected "list[tuple[bytes, int]]"  [list-item]
   pyarrow/tests/test_array.py:1313: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:1320: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:1324: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:1348: error: List item 0 has incompatible type 
"None"; expected "list[tuple[bytes, int]]"  [list-item]
   pyarrow/tests/test_array.py:1348: error: List item 1 has incompatible type 
"None"; expected "list[tuple[bytes, int]]"  [list-item]
   pyarrow/tests/test_array.py:1362: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:2513: error: Need type annotation for "buffers" 
(hint: "buffers: list[<type>] = ...")  [var-annotated]
   pyarrow/tests/test_array.py:2539: error: "object" has no attribute "dtype"  
[attr-defined]
   pyarrow/tests/test_array.py:2541: error: Value of type "object" is not 
indexable  [index]
   pyarrow/tests/test_array.py:2542: error: Value of type "object" is not 
indexable  [index]
   pyarrow/tests/test_array.py:2543: error: Value of type "object" is not 
indexable  [index]
   pyarrow/tests/test_array.py:2885: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:2917: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:2938: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:2939: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:3183: error: Value of type "object" is not 
indexable  [index]
   pyarrow/tests/test_array.py:3299: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:3720: error: Incompatible types in assignment 
(expression has type "None", variable has type "ndarray[tuple[Any, ...], 
dtype[Any]]")  [assignment]
   pyarrow/tests/test_array.py:3729: error: Value of type "object" is not 
indexable  [index]
   pyarrow/tests/test_array.py:3740: error: Value of type "object" is not 
indexable  [index]
   pyarrow/tests/test_array.py:3817: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:4004: error: Incompatible types in assignment 
(expression has type "MyArrayInvalid", variable has type "MyArray")  
[assignment]
   pyarrow/tests/test_array.py:4017: error: Incompatible types in assignment 
(expression has type "MyArray2", variable has type "MyArray")  [assignment]
   pyarrow/tests/test_array.py:4031: error: Incompatible types in assignment 
(expression has type "MyArray3", variable has type "MyArray")  [assignment]
   pyarrow/tests/test_array.py:4095: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:4099: error: Unused "type: ignore" comment  
[unused-ignore]
   pyarrow/tests/test_array.py:4315: error: List item 3 has incompatible type 
"None"; expected "int"  [list-item]
   pyarrow/tests/test_array.py:4319: error: List item 5 has incompatible type 
"None"; expected "int"  [list-item]
   pyarrow/tests/test_array.py:4324: error: List item 2 has incompatible type 
"None"; expected "int"  [list-item]
   pyarrow/tests/test_array.py:4324: error: List item 4 has incompatible type 
"None"; expected "int"  [list-item]
   pyarrow/tests/test_array.py:4395: error: List item 1 has incompatible type 
"None"; expected "int"  [list-item]
   pyarrow/tests/test_array.py:4407: error: List item 0 has incompatible type 
"None"; expected "int"  [list-item]
   Found 40 errors in 1 file (checked 1 source file)
   ```
   </details>
   
   Type checkers are currently configured to skip `python/pyarrow` folder (too 
much noise) so the changes are not caught. Maybe we could start with adding 
`mypy --check-untyped-defs --warn-unused-ignores pyarrow/tests/test_*` for 
specific files that can already be type checked.
   
   I propose to temporarily add the `mypy` command explicitly naming files 
which bypasses the exclude setting to 
`ci/scripts/python_test_type_annotations.sh`. Will also push the updates of 
ignores in the tests once I go through the ones connected to this PR.


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

Reply via email to