From 82fb69fc8a4e4f763d1a31b66a843f5ba5b8f1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 16 Jun 2024 05:18:37 +0200 Subject: [PATCH] load_theme needs package_name for loading by name It is provided in every case, so add an assert to tell mypy about it. --- qubes_config/widgets/gtk_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qubes_config/widgets/gtk_utils.py b/qubes_config/widgets/gtk_utils.py index 09bf865b..ae2a1fd5 100644 --- a/qubes_config/widgets/gtk_utils.py +++ b/qubes_config/widgets/gtk_utils.py @@ -205,10 +205,12 @@ def load_theme(widget: Gtk.Widget, light_theme_path: Optional[str] = None, :param dark_file_name: name of the css file with dark theme """ if not light_theme_path and light_file_name: + assert package_name css_path = importlib.resources.files(package_name) / light_file_name with importlib.resources.as_file(css_path) as resource_path: light_theme_path = str(resource_path) if not dark_theme_path and dark_file_name: + assert package_name css_path = importlib.resources.files(package_name) / dark_file_name with importlib.resources.as_file(css_path) as resource_path: dark_theme_path = str(resource_path)