os.system replaced by subprocess.run
unused vars renamed to _<var>
This commit is contained in:
2026-06-02 14:16:11 +02:00
parent 706a4dd47d
commit fe160487ba
+5 -5
View File
@@ -1,4 +1,3 @@
from core.tracker import Tracker
from config import ADMIN_PASSWORD from config import ADMIN_PASSWORD
@@ -13,9 +12,10 @@ class CLI:
self._show_main_menu() self._show_main_menu()
def _clear_screen(self): def _clear_screen(self):
import subprocess
import os import os
os.system("cls" if os.name == "nt" else "clear") subprocess.run("cls" if os.name == "nt" else "clear")
def _show_main_menu(self): def _show_main_menu(self):
print("=" * 50) print("=" * 50)
@@ -117,7 +117,7 @@ class CLI:
menu_items = self.tracker.get_items() menu_items = self.tracker.get_items()
item_list = list(menu_items.items()) item_list = list(menu_items.items())
for i, (item_id, item) in enumerate(item_list, 1): for i, (_item_id, item) in enumerate(item_list, 1):
print(f"{i}. {item.name} - ${item.price:.2f}") print(f"{i}. {item.name} - ${item.price:.2f}")
print(f"{len(item_list) + 1}. Cancel") print(f"{len(item_list) + 1}. Cancel")
@@ -199,7 +199,7 @@ class CLI:
print("No users with debt.") print("No users with debt.")
else: else:
total = 0 total = 0
for user_id, debt_info in all_debts.items(): for _user_id, debt_info in all_debts.items():
amount = debt_info["debt"] amount = debt_info["debt"]
print(f"{debt_info['name']:.<30} ${amount:>7.2f}") print(f"{debt_info['name']:.<30} ${amount:>7.2f}")
total += amount total += amount
@@ -322,7 +322,7 @@ class CLI:
confirm = input(f"Clear ${debt_amount:.2f}? (y/n): ").strip().lower() confirm = input(f"Clear ${debt_amount:.2f}? (y/n): ").strip().lower()
if confirm == "y": if confirm == "y":
result = self.tracker.adjust_debt( _result = self.tracker.adjust_debt(
user_id, debt_amount, ADMIN_PASSWORD user_id, debt_amount, ADMIN_PASSWORD
) )