ARG002/ARG005: fix

This commit is contained in:
Jörg Thalheim
2025-08-20 21:05:11 +02:00
parent 5233eb7fdb
commit 4986fe30c3
31 changed files with 67 additions and 22 deletions

View File

@@ -32,6 +32,7 @@ class MainApplication(Adw.Application):
}
def __init__(self, *args: Any, **kwargs: Any) -> None:
del args, kwargs # Unused but kept for API compatibility
super().__init__(
application_id="org.clan.vm-manager",
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
@@ -51,6 +52,7 @@ class MainApplication(Adw.Application):
self.connect("shutdown", self.on_shutdown)
def on_shutdown(self, source: "MainApplication") -> None:
del source # Unused but kept for API compatibility
log.debug("Shutting down Adw.Application")
if self.get_windows() == []:
@@ -103,6 +105,7 @@ class MainApplication(Adw.Application):
log.info("Dummy menu entry called")
def on_activate(self, source: "MainApplication") -> None:
del source # Unused but kept for API compatibility
if not self.window:
self.init_style()
self.window = MainWindow(config=ClanConfig(initial_view="list"))

View File

@@ -70,5 +70,6 @@ class EmptySplash(Gtk.Box):
"""Callback for the join button
Extracts the text from the entry and calls the on_join callback
"""
del button # Unused but kept for API compatibility
log.info(f"Splash screen: Joining {entry.get_text()}")
self.on_join(entry.get_text())

View File

@@ -90,7 +90,8 @@ LONG_PATH_PREFIX = "\\\\?\\"
# from pynicotine.gtkgui.widgets.theme import ICON_THEME
class IconTheme:
def lookup_icon(self, icon_name: str, **kwargs: Any) -> None:
return None
del icon_name
del kwargs
ICON_THEME = IconTheme()
@@ -177,7 +178,9 @@ class BaseImplementation:
self.application = application
self.menu_items: dict[int, Any] = {}
self.menu_item_id: int = 1
self.activate_callback: Callable = lambda a, b: self.update_window_visibility
self.activate_callback: Callable = (
lambda _a, _b: self.update_window_visibility()
)
self.is_visible: bool = True
self.create_menu()
@@ -275,9 +278,11 @@ class BaseImplementation:
pass
def set_download_status(self, status: str) -> None:
del status # Unused but kept for API compatibility
self.update_menu()
def set_upload_status(self, status) -> None:
del status # Unused but kept for API compatibility
self.update_menu()
def show_notification(self, title, message) -> None:

View File

@@ -49,6 +49,7 @@ class VMObject(GObject.Object):
data: HistoryEntry,
build_log_cb: Callable[[Gio.File], None],
) -> None:
del icon # Unused but kept for API compatibility
super().__init__()
# Store the data from the history entry
@@ -138,6 +139,7 @@ class VMObject(GObject.Object):
)
def _on_switch_toggle(self, switch: Gtk.Switch, user_state: bool) -> None:
del user_state # Unused but kept for API compatibility
if switch.get_active():
switch.set_state(False)
switch.set_sensitive(False)
@@ -265,6 +267,7 @@ class VMObject(GObject.Object):
other_file: Gio.File,
event_type: Gio.FileMonitorEvent,
) -> None:
del monitor, other_file # Unused but kept for API compatibility
if event_type == Gio.FileMonitorEvent.CHANGES_DONE_HINT:
# File was changed and the changes were written to disk
# wire up the callback for setting the logs

View File

@@ -47,7 +47,7 @@ class ToastOverlay:
if key not in self.active_toasts:
self.active_toasts.add(key)
self.overlay.add_toast(toast)
toast.connect("dismissed", lambda toast: self.active_toasts.remove(key))
toast.connect("dismissed", lambda _toast: self.active_toasts.remove(key))
class ErrorToast:

View File

@@ -75,6 +75,7 @@ class JoinList:
removed: int,
added: int,
) -> None:
del source, position, removed, added # Unused but kept for API compatibility
self.list_store.items_changed(
0,
self.list_store.get_n_items(),

View File

@@ -59,6 +59,7 @@ class Details(Gtk.Box):
boxed_list: Gtk.ListBox,
item: PreferencesValue,
) -> Gtk.Widget:
del boxed_list # Unused but kept for API compatibility
cores: int | None = os.cpu_count()
fcores = float(cores) if cores else 1.0

View File

@@ -61,6 +61,7 @@ class ClanList(Gtk.Box):
"""
def __init__(self, config: ClanConfig) -> None:
del config # Unused but kept for API compatibility
super().__init__(orientation=Gtk.Orientation.VERTICAL)
app = Gio.Application.get_default()
@@ -92,6 +93,7 @@ class ClanList(Gtk.Box):
self.splash = EmptySplash(on_join=lambda x: self.on_join_request(x, x))
def display_splash(self, source: GKVStore) -> None:
del source # Unused but kept for API compatibility
print("Displaying splash")
if (
ClanStore.use().clan_store.get_n_items() == 0
@@ -104,6 +106,7 @@ class ClanList(Gtk.Box):
boxed_list: Gtk.ListBox,
vm_store: VMStore,
) -> Gtk.Widget:
del boxed_list # Unused but kept for API compatibility
self.remove(self.splash)
vm = vm_store.first()
@@ -148,6 +151,7 @@ class ClanList(Gtk.Box):
return grp
def on_add(self, source: Any, parameter: Any) -> None:
del source # Unused but kept for API compatibility
target = parameter.get_string()
print("Adding new machine", target)
@@ -259,6 +263,7 @@ class ClanList(Gtk.Box):
return row
def on_edit(self, source: Any, parameter: Any) -> None:
del source # Unused but kept for API compatibility
target = parameter.get_string()
print("Editing settings for machine", target)
@@ -348,6 +353,7 @@ class ClanList(Gtk.Box):
return row
def on_join_request(self, source: Any, url: str) -> None:
del source # Unused but kept for API compatibility
log.debug("Join request: %s", url)
clan_uri = ClanURI.from_str(url)
JoinList.use().push(clan_uri, self.on_after_join)
@@ -367,6 +373,7 @@ class ClanList(Gtk.Box):
value.join()
def on_discard_clicked(self, value: JoinValue, source: Gtk.Widget) -> None:
del source # Unused but kept for API compatibility
JoinList.use().discard(value)
if JoinList.use().is_empty():
self.join_boxed_list.add_css_class("no-shadow")

View File

@@ -86,6 +86,7 @@ class MainWindow(Adw.ApplicationWindow):
ClanStore.use().kill_all()
def on_destroy(self, source: "Adw.ApplicationWindow") -> None:
del source # Unused but kept for API compatibility
log.info("====Destroying Adw.ApplicationWindow===")
ClanStore.use().kill_all()
self.tray_icon.destroy()