(2hddlZddlmZmZmZmZddlZddlZddl Z d dZ dde de de fdZ d dZ d d Zd eeefd edefd ZdS)N)SequenceMappingAnyUnionreturncddl}ddl}ddlm}ddlm}m}|}||tj |}| ||||dS)zFind all custom nodes in the custom_nodes folder and add those node objects to NODE_CLASS_MAPPINGS This function sets up a new asyncio event loop, initializes the PromptServer, creates a PromptQueue, and initializes the custom nodes. rN)init_extra_nodes)apply_custom_pathsexecute_prestartup_script) asyncio executionnodesr mainr r new_event_loopset_event_loopserver PromptServer PromptQueue)r r r r r loopserver_instances >D:\ComfyUI_windows_portable\ComfyUI\comfyui_to_python_utils.pyimport_custom_nodesrs NNN&&&&&&BBBBBBBB  ! ! # #D 4   )$//O /***namepathc2|tj}|tj|vr6tj||}t |d||Stj|}||krdSt||S)z Recursively looks at parent folders starting from the given path until it finds the given name. Returns the path as a Path object if found, or None otherwise. Nz found: )osgetcwdlistdirrjoinprintdirname find_path)rr path_nameparent_directorys rr#r#"s  |y{{ rz$GLLt,,  **y**+++wt,,4t T+ , ,,rctd}|Stj|r6tj|t d|ddSdSdS)z' Add 'ComfyUI' to the sys.path ComfyUIN'z' added to sys.path)r#rrisdirsysappendr!) comfyui_paths r!add_comfyui_directory_to_sys_pathr-<slY''LBGMM,$?$?  %%% 3,33344444 rc ddlm}n%#t$rtdddlm}YnwxYwt d}| ||dStddS)zb Parse the optional extra_model_paths.yaml file and add the parsed paths to the sys.path. r)load_extra_path_configz\Could not import load_extra_path_config from main.py. Looking in utils.extra_config instead.zextra_model_paths.yamlNz1Could not find the extra_model_paths config file.)rr/ ImportErrorr!utils.extra_configr#)r/extra_model_pathss radd_extra_model_pathsr3Fs>/////// >>> j    >======= > "":;;$011111 ABBBBBs  ++objindexcP ||S#t$r|d|cYSwxYw)aReturns the value at the given index of a sequence or mapping. If the object is a sequence (like list or string), returns the value at the given index. If the object is a mapping (like a dictionary), returns the value at the index-th key. Some return a dictionary, in these cases, we look for the "results" key Args: obj (Union[Sequence, Mapping]): The object to retrieve the value from. index (int): The index of the value to retrieve. Returns: Any: The value at the given index. Raises: IndexError: If the index is out of bounds for the object and the object is not a mapping. result)KeyError)r4r5s rget_value_at_indexr9ZsA$$5z $$$8}U####$s  %%)rN)N)rtypingrrrrr*utils.json_utilutilsrrstrr#r-r3intr9rrr@s 000000000000      4--C-s-c----45555CCCC($E(G"34$S$S$$$$$$r