From e60f2f6fc78aa3e0a3f8b09fec4eaf6d42fcdc90 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 22 Nov 2023 11:22:11 +0100 Subject: [PATCH] refactor: Clean code --- powerapi/cli/common_cli_parsing_manager.py | 10 ++++++---- tests/integration/database/test_prometheus_db.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/powerapi/cli/common_cli_parsing_manager.py b/powerapi/cli/common_cli_parsing_manager.py index a854eeb1..92207239 100644 --- a/powerapi/cli/common_cli_parsing_manager.py +++ b/powerapi/cli/common_cli_parsing_manager.py @@ -42,6 +42,8 @@ POWERAPI_PRE_PROCESSOR_ENVIRONMENT_VARIABLE_PREFIX = POWERAPI_ENVIRONMENT_VARIABLE_PREFIX + 'PRE_PROCESSOR_' POWERAPI_POST_PROCESSOR_ENVIRONMENT_VARIABLE_PREFIX = POWERAPI_ENVIRONMENT_VARIABLE_PREFIX + 'POST_PROCESSOR' +TAGS_ARGUMENT_HELP_TEXT = 'specify report tags' + def extract_file_names(arg, val, args, acc): """ @@ -253,7 +255,7 @@ def __init__(self): ) subparser_prometheus_output = SubgroupConfigParsingManager("prometheus") - subparser_prometheus_output.add_argument("t", "tags", help_text="specify report tags") + subparser_prometheus_output.add_argument("t", "tags", help_text=TAGS_ARGUMENT_HELP_TEXT) subparser_prometheus_output.add_argument("u", "uri", help_text="specify server uri", default_value=DEFAULT_ADDRESS) subparser_prometheus_output.add_argument( @@ -296,7 +298,7 @@ def __init__(self): default_value="PowerReport", ) - subparser_csv_output.add_argument("t", "tags", help_text="specify report tags") + subparser_csv_output.add_argument("t", "tags", help_text=TAGS_ARGUMENT_HELP_TEXT) subparser_csv_output.add_argument( "n", "name", help_text="specify pusher name", default_value="pusher_csv" ) @@ -307,7 +309,7 @@ def __init__(self): subparser_influx_output = SubgroupConfigParsingManager("influxdb") subparser_influx_output.add_argument("u", "uri", help_text="specify InfluxDB uri") - subparser_influx_output.add_argument("t", "tags", help_text="specify report tags") + subparser_influx_output.add_argument("t", "tags", help_text=TAGS_ARGUMENT_HELP_TEXT) subparser_influx_output.add_argument( "d", "db", help_text="specify InfluxDB database name" ) @@ -353,7 +355,7 @@ def __init__(self): subparser_influx2_output = SubgroupConfigParsingManager("influxdb2") subparser_influx2_output.add_argument("u", "uri", help_text="specify InfluxDB uri") - subparser_influx2_output.add_argument("t", "tags", help_text="specify report tags") + subparser_influx2_output.add_argument("t", "tags", help_text=TAGS_ARGUMENT_HELP_TEXT) subparser_influx2_output.add_argument("k", "token", help_text="specify token for accessing the database") subparser_influx2_output.add_argument("g", "org", diff --git a/tests/integration/database/test_prometheus_db.py b/tests/integration/database/test_prometheus_db.py index 8ec51081..172a5042 100644 --- a/tests/integration/database/test_prometheus_db.py +++ b/tests/integration/database/test_prometheus_db.py @@ -125,7 +125,7 @@ def _gen_url(port): def test_create_direct_prometheus_db_and_connect_it_must_launch_web_server_on_given_address(db_info): - db, url = db_info + _, url = db_info r = requests.get(url) assert r.status_code == 200