Actions
Bug #38628
closedrestful/api is not Python 3 compatible
Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
restful module
Target version:
-
% Done:
0%
Source:
Community (dev)
Tags:
QA
Backport:
nautilus
Regression:
No
Severity:
3 - minor
Reviewed:
Description
src/scripts/run_mypy.sh
revealed some Python 3 problems:
pybind/mgr/restful/module.py: note: In member "run" of class "CommandsRequest": pybind/mgr/restful/module.py:87: error: "CommandResult" has no attribute "command" pybind/mgr/restful/api/doc.py: note: In member "get" of class "Doc": pybind/mgr/restful/api/doc.py:15: error: Module has no attribute "api" pybind/mgr/restful/decorators.py: note: In function "auth": pybind/mgr/restful/decorators.py:21: error: Argument 1 to "split" of "bytes" has incompatible type "str"; expected "Optional[bytes]" pybind/mgr/restful/api/mon.py: note: In member "get" of class "MonName": pybind/mgr/restful/api/mon.py:24: error: Argument 1 to "len" has incompatible type "Iterator[Any]"; expected "Sized" pybind/mgr/restful/api/mon.py:28: error: Value of type "Iterator[Any]" is not indexable pybind/mgr/restful/api/request.py: note: In member "get" of class "RequestId": pybind/mgr/restful/api/request.py:24: error: Argument 1 to "len" has incompatible type "Iterator[Any]"; expected "Sized" pybind/mgr/restful/api/request.py:28: error: Value of type "Iterator[Any]" is not indexable pybind/mgr/restful/api/request.py: note: In member "delete" of class "Request": pybind/mgr/restful/api/request.py:69: error: Incompatible types in assignment (expression has type "Iterator[Any]", variable has type "List[Any]")
In Python 3, filter
returns an Iterator
instead of a list. Even though some of the errors may be false-positives, they should be investigated.
Actions