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.
Updated by Kefu Chai almost 5 years ago
- Assignee deleted (
Kefu Chai)
pybind/mgr/restful/decorators.py:21: error: Argument 1 to "split" of "bytes" has incompatible type "str"; expected "Optional[bytes]"
is tracked by #38522. and was already fixed.
Updated by Lenz Grimmer almost 5 years ago
- Related to Bug #38522: restful module traceback when querying any endpoint that require auth added
Updated by Kefu Chai almost 5 years ago
- Status changed from New to Fix Under Review
- Assignee set to Kefu Chai
- Pull request ID set to 27925
Updated by Kefu Chai almost 5 years ago
- Status changed from Fix Under Review to Resolved
Updated by Sebastian Wagner almost 5 years ago
- Status changed from Resolved to Pending Backport
- Backport set to nautilus
Updated by Nathan Cutler almost 5 years ago
- Copied to Backport #39695: nautilus: restful/api is not Python 3 compatible added
Updated by Nathan Cutler almost 4 years ago
- Status changed from Pending Backport to Resolved
While running with --resolve-parent, the script "backport-create-issue" noticed that all backports of this issue are in status "Resolved" or "Rejected".
Actions