refactor(src/utils): remove unused imports and functions

This commit is contained in:
sankalp committed 2026-07-09 15:45:39 +05:45
1 parent bb3a92416f
commit f9bef457ca
2 files changed
-65

No files matched your search

-41
View File
@@ -1,7 +1,5 @@
import ctypes
import html
import json
import os
import subprocess
import threading
from typing import Dict, NamedTuple, Optional, TypeVar
@@ -60,38 +58,6 @@ def thread(target, *args, **kwargs) -> threading.Thread:
return th
def run_in_thread(func):
"""
Decorator to run the decorated function in a thread.
"""
def wrapper(*args, **kwargs):
return thread(func, *args, **kwargs)
return wrapper
def write_json_file(data: Dict, path: str):
try:
with open(path, "w") as f:
json.dump(data, f, indent=4, ensure_ascii=False)
except Exception as e:
logger.warning(f"Failed to write json: {e}")
def read_json_file(file_path: str) -> Optional[Dict]:
if not os.path.exists(file_path):
logger.error(f"JSON file {file_path} does not exist.")
return None
with open(file_path, "r") as file:
try:
return json.load(file)
except json.JSONDecodeError as e:
logger.error(f"Failed to read JSON file {file_path}: {e}")
return None
def get_wifi_icon_for_strength(strength: int) -> str:
"""
Get the appropriate WiFi icon based on signal strength.
@@ -228,13 +194,6 @@ def find_process_pid(process_name: str, timeout: float | None = None) -> list[st
return []
def toggle_command(command: str, full_command: str):
if is_process_running(command):
kill_process(command)
else:
spawn_detached(full_command.split(" "))
# --- Binary lookup ---