Skip to content
Open
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
8 changes: 4 additions & 4 deletions comfyui_to_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import random
import sys
import re
from typing import Dict, List, Any, Callable, Tuple, TextIO
from typing import Dict, List, Any, Callable, Tuple, TextIO, Union
from argparse import ArgumentParser

import black
Expand Down Expand Up @@ -36,7 +36,7 @@ class FileHandler:
"""

@staticmethod
def read_json_file(file_path: str | TextIO, encoding: str = "utf-8") -> dict:
def read_json_file(file_path: Union[str, TextIO], encoding: str = "utf-8") -> dict:
"""
Reads a JSON file and returns its contents as a dictionary.

Expand All @@ -58,7 +58,7 @@ def read_json_file(file_path: str | TextIO, encoding: str = "utf-8") -> dict:
return data

@staticmethod
def write_code_to_file(file_path: str | TextIO, code: str) -> None:
def write_code_to_file(file_path: Union[str, TextIO], code: str) -> None:
"""Write the specified code to a Python file.

Args:
Expand Down Expand Up @@ -511,7 +511,7 @@ def __init__(
self,
workflow: str = "",
input_file: str = "",
output_file: str | TextIO = "",
output_file: Union[str, TextIO] = "",
queue_size: int = 1,
node_class_mappings: Dict = NODE_CLASS_MAPPINGS,
needs_init_custom_nodes: bool = False,
Expand Down