From 25428ad176bfc342e3ef1cad1c350c07bfeaec3c Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 30 Apr 2026 15:45:01 -0700 Subject: [PATCH] Fix argument type inference and organize imports --- modules/theme.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/theme.py b/modules/theme.py index ae696106e..0c184ed53 100644 --- a/modules/theme.py +++ b/modules/theme.py @@ -1,10 +1,18 @@ -import os import json +import os +from typing import TYPE_CHECKING, TypedDict + import gradio as gr -import modules.shared + import modules.extensions -from modules.logger import log +import modules.shared from modules.json_helpers import writefile +from modules.logger import log + +if TYPE_CHECKING: + class FontParams(TypedDict): + font: list[str] + font_mono: list[str] gradio_theme = gr.themes.Base() @@ -89,7 +97,7 @@ def list_themes(): def reload_gradio_theme(): global gradio_theme # pylint: disable=global-statement theme_name = modules.shared.opts.gradio_theme - default_font_params = { + default_font_params: FontParams = { 'font':['Helvetica', 'ui-sans-serif', 'system-ui', 'sans-serif'], 'font_mono':['IBM Plex Mono', 'ui-monospace', 'Consolas', 'monospace'] }