From 42d8ed5fa5a1667e7ae94fc044c5531258b5c0bf Mon Sep 17 00:00:00 2001 From: M4hbod <74229780+M4hbod@users.noreply.github.com> Date: Mon, 26 Dec 2022 12:47:34 +0330 Subject: [PATCH] replace string concatenation with f-string --- menu.py | 8 ++++---- namizun_core/database.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/menu.py b/menu.py index 34da0f3..7ca0e00 100644 --- a/menu.py +++ b/menu.py @@ -93,16 +93,16 @@ def reload_namizun_service(): def fake_udp_uploader_running_status(): if database.get_parameter('fake_udp_uploader_running'): - return display.green + "True" + return f"{display.green}True" else: - return display.red + "False" + return f"{display.red}False" def speedtest_uploader_running_status(): if database.get_parameter('speedtest_uploader_running'): - return display.green + "True" + return f"{display.green}True" else: - return display.red + "False" + return f"{display.red}False" def main_menu(): diff --git a/namizun_core/database.py b/namizun_core/database.py index 7d26238..0d8b478 100644 --- a/namizun_core/database.py +++ b/namizun_core/database.py @@ -8,7 +8,7 @@ 'total_upload_before_reboot', 'total_download_before_reboot', 'in_submenu'] namizun_db = None prefix = 'namizun_' -ip_prefix = prefix + 'ip_' +ip_prefix = f'{prefix}ip_' cache_parameters = {} buffers_weight = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] @@ -110,7 +110,7 @@ def set_ip_port_to_database(target_ip, target_port): def get_ip_ports_from_database(): my_db = singleton() result = {} - keys = my_db.keys(ip_prefix + "*") + keys = my_db.keys(f"{ip_prefix}*") if len(keys) > 0: for key in keys: if isinstance(key, bytes):