Remove type hints

This commit is contained in:
Christian Bastian
2024-01-21 07:36:02 -05:00
parent 3f20fefbb1
commit 1d158ab885
2 changed files with 7 additions and 7 deletions

View File

@@ -31,8 +31,8 @@ image_extensions = (".apng", ".gif", ".jpeg", ".jpg", ".png", ".webp")
#hash_buffer_size = 4096 #hash_buffer_size = 4096
_folder_names_and_paths: dict[str, tuple[list[str], list[str]]] = None _folder_names_and_paths = None # dict[str, tuple[list[str], list[str]]]
def folder_paths_folder_names_and_paths(refresh = False) -> dict[str, tuple[list[str], list[str]]]: def folder_paths_folder_names_and_paths(refresh = False):
global _folder_names_and_paths global _folder_names_and_paths
if refresh or _folder_names_and_paths is None: if refresh or _folder_names_and_paths is None:
_folder_names_and_paths = {} _folder_names_and_paths = {}
@@ -50,7 +50,7 @@ def folder_paths_folder_names_and_paths(refresh = False) -> dict[str, tuple[list
_folder_names_and_paths[item_name] = (dir_paths, extensions) _folder_names_and_paths[item_name] = (dir_paths, extensions)
return _folder_names_and_paths return _folder_names_and_paths
def folder_paths_get_folder_paths(folder_name, refresh = False) -> list[str]: # API function crashes querying unknown model folder def folder_paths_get_folder_paths(folder_name, refresh = False): # API function crashes querying unknown model folder
paths = folder_paths_folder_names_and_paths(refresh) paths = folder_paths_folder_names_and_paths(refresh)
if folder_name in paths: if folder_name in paths:
return paths[folder_name][0] return paths[folder_name][0]
@@ -60,7 +60,7 @@ def folder_paths_get_folder_paths(folder_name, refresh = False) -> list[str]: #
return [maybe_path] return [maybe_path]
return [] return []
def folder_paths_get_supported_pt_extensions(folder_name, refresh = False) -> list[str]: # Missing API function def folder_paths_get_supported_pt_extensions(folder_name, refresh = False): # Missing API function
paths = folder_paths_folder_names_and_paths(refresh) paths = folder_paths_folder_names_and_paths(refresh)
if folder_name in paths: if folder_name in paths:
return paths[folder_name][1] return paths[folder_name][1]
@@ -309,7 +309,7 @@ async def load_download_models(request):
return web.json_response(models) return web.json_response(models)
def linear_directory_list(refresh = False) -> dict[str, list]: def linear_directory_list(refresh = False):
model_paths = folder_paths_folder_names_and_paths(refresh) model_paths = folder_paths_folder_names_and_paths(refresh)
dir_list = [] dir_list = []
dir_list.append({ "name": "", "childIndex": 1, "childCount": len(model_paths) }) dir_list.append({ "name": "", "childIndex": 1, "childCount": len(model_paths) })
@@ -360,7 +360,7 @@ def linear_directory_list(refresh = False) -> dict[str, list]:
return dir_list return dir_list
@server.PromptServer.instance.routes.get("/model-manager/directory-list") @server.PromptServer.instance.routes.get("/model-manager/model-directory-list")
async def directory_list(request): async def directory_list(request):
#body = await request.json() #body = await request.json()
dir_list = linear_directory_list(True) dir_list = linear_directory_list(True)

View File

@@ -833,7 +833,7 @@ class ModelManager extends ComfyDialog {
async #modelGridRefresh() { async #modelGridRefresh() {
this.#data.models = await request("/model-manager/models"); this.#data.models = await request("/model-manager/models");
this.#data.modelDirectories = await request("/model-manager/directory-list"); this.#data.modelDirectories = await request("/model-manager/model-directory-list");
this.#modelGridUpdate(); this.#modelGridUpdate();
}; };