From c7c1602f9be15906c542606e32a6ab068a495035 Mon Sep 17 00:00:00 2001 From: Israel Barth Rubio Date: Fri, 28 Jun 2024 13:15:33 -0300 Subject: [PATCH] Please `pyright` `pyright` was complaining about the `exec_diagnose`. That issue occurs because based on the Barman module version that is installed in the virtual environemnt, the signature of that method would have either 2 or 4 parameters. We had 2 options to handle that issue: * Add `pyright: ignore` directives to the source code where `exec_diagnose` is called; or * Change the implementation so instead of relying on `AttributeError` exception, it would handle the version for the Barman module. We chose the first option for now, so we unblock the release. The code with `AttributeError` exception has already been tested. If we were to go with the second option now, that would require changing the code, changing the unit tests and performing more tests, thus dealying the release. Signed-off-by: Israel Barth Rubio --- .../pg_backup_api/logic/utility_controller.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pg_backup_api/pg_backup_api/logic/utility_controller.py b/pg_backup_api/pg_backup_api/logic/utility_controller.py index fe17481..0c688e2 100644 --- a/pg_backup_api/pg_backup_api/logic/utility_controller.py +++ b/pg_backup_api/pg_backup_api/logic/utility_controller.py @@ -82,15 +82,20 @@ def diagnose() -> 'Response': for model in available_models: # pyright: ignore model_dict[model] = barman.__config__.get_model(model) - barman_diagnose.exec_diagnose(server_dict, - model_dict, - errors_list, - show_config_source=False) + barman_diagnose.exec_diagnose( + server_dict, + model_dict, + errors_list, + show_config_source=False, + ) # pyright: ignore [reportCallIssue] # An attribute error is thown when calling `model_names()` if using Barman # older than 3.10, in which case models are not yet implemented, so we fall # back to the old signature of diagnose command. except AttributeError: - barman_diagnose.exec_diagnose(server_dict, errors_list) + barman_diagnose.exec_diagnose( + server_dict, + errors_list, + ) # pyright: ignore [reportCallIssue] # new outputs are appended, so grab the last one stored_output = json.loads(output._writer.json_output["_INFO"][-1])