Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type hinting in shared.py #15211

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions modules/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from modules import shared_cmd_options, shared_gradio_themes, options, shared_items, sd_models_types
from modules.paths_internal import models_path, script_path, data_path, sd_configs_path, sd_default_config, sd_model_file, default_sd_model_file, extensions_dir, extensions_builtin_dir # noqa: F401
from modules import util
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from modules import shared_state, styles, interrogate, shared_total_tqdm, memmon

cmd_opts = shared_cmd_options.cmd_opts
parser = shared_cmd_options.parser
Expand All @@ -16,33 +20,33 @@
config_filename = cmd_opts.ui_settings_file
hide_dirs = {"visible": not cmd_opts.hide_ui_dir_config}

demo = None
demo: gr.Blocks = None

device = None
device: str = None

weight_load_location = None
weight_load_location: str = None

xformers_available = False

hypernetworks = {}

loaded_hypernetworks = []

state = None
state: 'shared_state.State' = None

prompt_styles = None
prompt_styles: 'styles.StyleDatabase' = None

interrogator = None
interrogator: 'interrogate.InterrogateModels' = None

face_restorers = []

options_templates = None
opts = None
restricted_opts = None
options_templates: dict = None
opts: options.Options = None
restricted_opts: set[str] = None

sd_model: sd_models_types.WebuiSdModel = None

settings_components = None
settings_components: dict = None
"""assigned from ui.py, a mapping on setting names to gradio components repsponsible for those settings"""

tab_names = []
Expand All @@ -65,9 +69,9 @@

gradio_theme = gr.themes.Base()

total_tqdm = None
total_tqdm: 'shared_total_tqdm.TotalTQDM' = None

mem_mon = None
mem_mon: 'memmon.MemUsageMonitor' = None

options_section = options.options_section
OptionInfo = options.OptionInfo
Expand Down
Loading