-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply mypy in pre-commit/CI #96
Labels
enhancement
New feature or request
Comments
First run of ❱ pre-commit run mypy --all-files
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1
tests/test_jpk.py:35: error: Incompatible types in assignment (expression has type "float", variable has type "type[float]") [assignment]
tests/test_ibw.py:31: error: Incompatible types in assignment (expression has type "float", variable has type "type[float]") [assignment]
AFMReader/io.py:287: error: Unsupported operand types for + ("bytes" and "str") [operator]
AFMReader/io.py:318: error: "str" has no attribute "decode"; maybe "encode"? [attr-defined]
tests/test_io.py:149: error: Value of type "object" is not indexable [index]
tests/test_io.py:150: error: Value of type "object" is not indexable [index]
tests/test_io.py:180: error: Value of type "object" is not indexable [index]
tests/test_io.py:181: error: Value of type "object" is not indexable [index]
AFMReader/gwy.py:48: error: Item "str" of "Path | str" has no attribute "stem" [union-attr]
AFMReader/gwy.py:50: error: Need type annotation for "image_data_dict" (hint: "image_data_dict: dict[<type>, <type>] = ...") [var-annotated]
AFMReader/gwy.py:51: error: Argument 1 to "open" of "Path" has incompatible type "Path | str"; expected "Path" [arg-type]
AFMReader/gwy.py:56: error: Argument 1 to "gwy_read_object" has incompatible type "IO[Any]"; expected "TextIOWrapper[_WrappedBuffer]" [arg-type]
AFMReader/gwy.py:66: error: Item "str" of "Path | str" has no attribute "suffix" [union-attr]
AFMReader/gwy.py:104: error: Argument 1 to "read_uint32" has incompatible type "TextIOWrapper[_WrappedBuffer]"; expected "BinaryIO" [arg-type]
AFMReader/gwy.py:140: error: Need type annotation for "sub_dict" (hint: "sub_dict: dict[<type>, <type>] = ...") [var-annotated]
AFMReader/gwy.py:148: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]
AFMReader/gwy.py:148: error: Argument "open_file" to "read_uint32" has incompatible type "TextIOWrapper[_WrappedBuffer]"; expected "BinaryIO" [arg-type]
AFMReader/gwy.py:152: error: Incompatible types in assignment (expression has type "float", variable has type "str") [assignment]
AFMReader/gwy.py:152: error: Argument "open_file" to "read_double" has incompatible type "TextIOWrapper[_WrappedBuffer]"; expected "BinaryIO" [arg-type]
AFMReader/gwy.py:160: error: Argument "open_file" to "read_uint32" has incompatible type "TextIOWrapper[_WrappedBuffer]"; expected "BinaryIO" [arg-type]
AFMReader/gwy.py:165: error: Argument "open_file" to "read_double" has incompatible type "TextIOWrapper[_WrappedBuffer]"; expected "BinaryIO" [arg-type]
AFMReader/gwy.py:239: error: "str" has no attribute "decode"; maybe "encode"? [attr-defined]
AFMReader/asd.py:324: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:327: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:329: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:330: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:332: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:334: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:335: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:337: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:338: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:340: error: Incompatible types in assignment (expression has type "float", target has type "str") [assignment]
AFMReader/asd.py:342: error: Incompatible types in assignment (expression has type "float", target has type "str") [assignment]
AFMReader/asd.py:344: error: Incompatible types in assignment (expression has type "float", target has type "str") [assignment]
AFMReader/asd.py:349: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:350: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:350: error: Unsupported operand types for ^ ("int" and "str") [operator]
AFMReader/asd.py:352: error: Incompatible types in assignment (expression has type "bool", target has type "str") [assignment]
AFMReader/asd.py:354: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:358: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:359: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:360: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:361: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:362: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:363: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:365: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:367: error: Incompatible types in assignment (expression has type "float", target has type "str") [assignment]
AFMReader/asd.py:368: error: Incompatible types in assignment (expression has type "float", target has type "str") [assignment]
AFMReader/asd.py:374: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:376: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:378: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:380: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:382: error: Argument "length_bytes" to "read_null_separated_utf8" has incompatible type "str"; expected "int" [arg-type]
AFMReader/asd.py:384: error: Incompatible types in assignment (expression has type "float", target has type "str") [assignment]
AFMReader/asd.py:386: error: Incompatible types in assignment (expression has type "float", target has type "str") [assignment]
AFMReader/asd.py:388: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
AFMReader/asd.py:390: error: Argument 2 to "skip_bytes" has incompatible type "str"; expected "int" [arg-type]
AFMReader/asd.py:393: error: No overload variant of "range" matches argument type "str" [call-overload]
AFMReader/asd.py:393: note: Possible overload variants:
AFMReader/asd.py:393: note: def range(SupportsIndex, /) -> range
AFMReader/asd.py:393: note: def range(SupportsIndex, SupportsIndex, SupportsIndex = ..., /) -> range
AFMReader/asd.py:433: error: Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
AFMReader/asd.py:434: error: Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
AFMReader/asd.py:464: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:466: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:468: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:476: error: Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
AFMReader/asd.py:482: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:483: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:485: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:486: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:487: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:489: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:495: error: Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
AFMReader/asd.py:501: error: Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
AFMReader/asd.py:539: error: Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
AFMReader/asd.py:540: error: Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
AFMReader/asd.py:570: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:572: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:574: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:582: error: Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
AFMReader/asd.py:588: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:589: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:591: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:592: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:593: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:595: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:601: error: Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
AFMReader/asd.py:607: error: Incompatible types in assignment (expression has type "str", target has type "int") [assignment]
AFMReader/asd.py:614: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:686: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:687: error: Incompatible types in assignment (expression has type "float", target has type "int") [assignment]
AFMReader/asd.py:702: error: "VoltageLevelConverter" has no attribute "level_to_voltage" [attr-defined]
AFMReader/asd.py:704: error: "bytes" has no attribute "reshape" [attr-defined]
tests/test_topostats.py:47: error: Missing positional argument "self" in call to "keys" of "dict" [call-arg]
tests/test_gwy.py:31: error: Need type annotation for "test_dict" (hint: "test_dict: dict[<type>, <type>] = ...") [var-annotated]
tests/test_gwy.py:32: error: Argument "open_file" to "gwy_read_object" has incompatible type "BufferedReader"; expected "TextIOWrapper[_WrappedBuffer]" [arg-type]
tests/test_gwy.py:42: error: Need type annotation for "test_dict" (hint: "test_dict: dict[<type>, <type>] = ...") [var-annotated]
tests/test_gwy.py:43: error: Argument "open_file" to "gwy_read_component" has incompatible type "BufferedReader"; expected "TextIOWrapper[_WrappedBuffer]" [arg-type]
tests/test_gwy.py:111: error: Argument 1 to "read_gwy_component_dtype" has incompatible type "BufferedReader"; expected "TextIOWrapper[_WrappedBuffer]" [arg-type]
tests/test_asd.py:28: error: Argument 1 to "len" has incompatible type "type[list[Any]]"; expected "Sized" [arg-type]
Found 98 errors in 9 files (checked 17 source files) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Typehints are already good in this codebase but it would be useful to add in mypy checks
via a pre-commit hook.
To help with this we can try running RighTyper against the code base as it
analyses and informs what the typehints should be for a code base. It only works with Python >= 3.12 though (and
currently we can not support Python >= 3.12 with TopoStats due to as yet unresolved issues with the
topoly
dependency,see Performance regression of Topoly with Python 3.12 · Issue #927 ·
AFM-SPM/TopoStats). However we should be able to add support for
Python 3.12 in AFMReader.
The text was updated successfully, but these errors were encountered: