Skip to content

Commit

Permalink
replace string concatenation with f-string
Browse files Browse the repository at this point in the history
  • Loading branch information
M4hbod committed Dec 26, 2022
1 parent 218730a commit 42d8ed5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 2 additions & 2 deletions namizun_core/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 42d8ed5

Please sign in to comment.