wazuh-qa
wazuh-qa copied to clipboard
DTT2 - Allocation module python enhancements
| Target version | Related issue | Related PR/dev branch |
|---|---|---|
| 4.9.0 | #5340 | 4495-dtt1-release |
Description
During the PR #5343 revision, I found some Python idiomatic enhancements to implement on the Allocation module.
-
Reorder import statements https://github.com/wazuh/wazuh-qa/blob/079f1ae3119bf35125f7551f281d1542c7cb4b20/deployability/modules/allocation/allocation.py#L5-L9
The Python Linter marks that the order of the sentences does not conform to the PEP 8 standards:
- Standard libraries must come first (Pathlib, logging, time, etc)
- Third-party packages come next (Paramiko)
- Local modules and packages are the last ones to import.
-
Change the bool comparison https://github.com/wazuh/wazuh-qa/blob/079f1ae3119bf35125f7551f281d1542c7cb4b20/deployability/modules/allocation/allocation.py#L67
Use the standard Python comparison
if not check_connection: -
Remove unnecessary f-string https://github.com/wazuh/wazuh-qa/blob/079f1ae3119bf35125f7551f281d1542c7cb4b20/deployability/modules/allocation/allocation.py#L69 Replace the f-string with a string.