Skip to content
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

Fix type errors in orm.code modules #5819

Closed
chrisjsewell opened this issue Dec 5, 2022 · 0 comments · Fixed by #5830
Closed

Fix type errors in orm.code modules #5819

chrisjsewell opened this issue Dec 5, 2022 · 0 comments · Fixed by #5830
Assignees
Labels
Milestone

Comments

@chrisjsewell
Copy link
Member

chrisjsewell commented Dec 5, 2022

If the orm code modules are removed from the pre-commit mypy excluded list, below are the current errors.

  1. Issues assuming that a computer has been set
  2. Issues about what type is used for the executable path (see also Add support for pathlib.Path in the Transport interface #5797 (comment))

It would be good to get these fixed

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

aiida/orm/nodes/data/code/portable.py:57: error: Incompatible types in assignment (expression has type "str", variable has type "PurePath")  [assignment]
aiida/orm/nodes/data/code/portable.py:58: error: Argument 1 to "put_object_from_tree" of "NodeRepository" has incompatible type "Path"; expected "str"  [arg-type]
aiida/orm/nodes/data/code/portable.py:94: error: Incompatible return value type (got "PurePath", expected "Path")  [return-value]
aiida/orm/nodes/data/code/installed.py:45: error: Incompatible types in assignment (expression has type "str", variable has type "PurePath")  [assignment]
aiida/orm/nodes/data/code/installed.py:74: error: Item "None" of "Optional[Computer]" has no attribute "get_transport"  [union-attr]
aiida/orm/nodes/data/code/installed.py:93: error: Item "None" of "Optional[Computer]" has no attribute "pk"  [union-attr]
aiida/orm/nodes/data/code/installed.py:100: error: Incompatible return value type (got "PurePath", expected "Path")  [return-value]
aiida/orm/nodes/data/code/installed.py:111: error: Item "None" of "Optional[Computer]" has no attribute "label"  [union-attr]
aiida/orm/nodes/data/code/legacy.py:144: error: Item "None" of "Optional[Computer]" has no attribute "label"  [union-attr]
aiida/orm/nodes/data/code/legacy.py:152: error: Item "None" of "Optional[Computer]" has no attribute "label"  [union-attr]
aiida/orm/nodes/data/code/legacy.py:160: error: Item "None" of "Optional[Computer]" has no attribute "label"  [union-attr]
aiida/orm/nodes/data/code/legacy.py:169: error: Item "None" of "Optional[Computer]" has no attribute "label"  [union-attr]
aiida/orm/nodes/data/code/legacy.py:208: error: Item "List[Any]" of "Union[List[Any], Any]" has no attribute "pk"  [union-attr]
aiida/orm/nodes/data/code/legacy.py:212: error: Value of type "Optional[List[Any]]" is not indexable  [index]
aiida/orm/nodes/data/code/legacy.py:306: error: Item "List[Any]" of "Union[List[Any], Any]" has no attribute "label"  [union-attr]
aiida/orm/nodes/data/code/legacy.py:308: error: Item "List[Any]" of "Union[List[Any], Any]" has no attribute "pk"  [union-attr]
aiida/orm/nodes/data/code/legacy.py:352: error: Item "None" of "Optional[Computer]" has no attribute "get_transport"  [union-attr]
Found 17 errors in 3 files (checked 728 source files)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants