Download comfyui-moonpack/utils.py from MarkLilly/mis-custom-nodes: direct link, hf CLI and curl.
- Browser
- Download file 887 Bytes
-
https://huggingface.co/MarkLilly/mis-custom-nodes/resolve/main/comfyui-moonpack/utils.py
- Command line
-
hf download hf://MarkLilly/mis-custom-nodes/comfyui-moonpack/utils.py
-
curl -L -o utils.py https://huggingface.co/MarkLilly/mis-custom-nodes/resolve/main/comfyui-moonpack/utils.py
887 Bytes
| class AnyType(str): | |
| """A special class that is always equal in not equal comparisons. Credit to pythongosssss""" | |
| def __ne__(self, __value: object) -> bool: | |
| return False | |
| class FlexibleOptionalInputType(dict): | |
| """A special class to make flexible nodes that pass data to our python handlers.""" | |
| def __init__(self, type, data: dict | None = None): | |
| """Initializes the FlexibleOptionalInputType.""" | |
| self.type = type | |
| self.data = data | |
| if self.data is not None: | |
| for k, v in self.data.items(): | |
| self[k] = v | |
| def __getitem__(self, key): | |
| if self.data is not None and key in self.data: | |
| val = self.data[key] | |
| return val | |
| return (self.type,) | |
| def __contains__(self, key): | |
| """Always contain a key, and we'll always return the tuple above when asked for it.""" | |
| return True | |
| any_type = AnyType("*") | |