Add types hints everywhere, checked mypy 0.942 (mypy --config mypy.ini amarna). The only remaining warnings are for
amarna/rules/local_rules/UnusedImportRule.py:60: error: Unsupported operand types for + ("str" and "Tree[Any]")
amarna/rules/local_rules/UnusedImportRule.py:60: note: Right operand is of type "Union[Any, Tree[Any]]"
amarna/rules/local_rules/UnusedImportRule.py:65: error: Item "Tree[Any]" of "Union[Any, Tree[Any]]" has no attribute "value"
amarna/rules/local_rules/UnusedImportRule.py:76: error: Item "Tree[Any]" of "Union[Any, Tree[Any]]" has no attribute "line"
amarna/rules/local_rules/UnusedImportRule.py:76: error: Item "Tree[Any]" of "Union[Any, Tree[Any]]" has no attribute "column"
amarna/rules/local_rules/UnusedImportRule.py:76: error: Item "Tree[Any]" of "Union[Any, Tree[Any]]" has no attribute "end_line"
amarna/rules/local_rules/UnusedImportRule.py:76: error: Item "Tree[Any]" of "Union[Any, Tree[Any]]" has no attribute "end_column"
But I am a bit unsure about the types for all_hints and unused_imports there
Additionally, there were a lot of places where # type: ignore was needed, mostly due to patterns like children_id.children[0].value, where mypy can't understand the underlying type. I am not too familiar with lark, but the documentation mentions type annotation support, so we might be able to improve this.
Add types hints everywhere, checked
mypy
0.942 (mypy --config mypy.ini amarna
). The only remaining warnings are forBut I am a bit unsure about the types for
all_hints
andunused_imports
thereAdditionally, there were a lot of places where
# type: ignore
was needed, mostly due to patterns likechildren_id.children[0].value
, where mypy can't understand the underlying type. I am not too familiar with lark, but the documentation mentions type annotation support, so we might be able to improve this.Built on top of #3 and #4