mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-12 18:27:04 +08:00
Improve documentation
Converted some comments to docstrings as per review
This commit is contained in:
parent
64e3a43527
commit
bb5de4dfd4
@ -136,9 +136,11 @@ class TopologicalSort:
|
|||||||
def is_empty(self):
|
def is_empty(self):
|
||||||
return len(self.pendingNodes) == 0
|
return len(self.pendingNodes) == 0
|
||||||
|
|
||||||
# ExecutionList implements a topological dissolve of the graph. After a node is staged for execution,
|
|
||||||
# it can still be returned to the graph after having further dependencies added.
|
|
||||||
class ExecutionList(TopologicalSort):
|
class ExecutionList(TopologicalSort):
|
||||||
|
"""
|
||||||
|
ExecutionList implements a topological dissolve of the graph. After a node is staged for execution,
|
||||||
|
it can still be returned to the graph after having further dependencies added.
|
||||||
|
"""
|
||||||
def __init__(self, dynprompt, output_cache):
|
def __init__(self, dynprompt, output_cache):
|
||||||
super().__init__(dynprompt)
|
super().__init__(dynprompt)
|
||||||
self.output_cache = output_cache
|
self.output_cache = output_cache
|
||||||
@ -216,18 +218,20 @@ class ExecutionList(TopologicalSort):
|
|||||||
to_remove = [node_id for node_id in blocked_by if len(blocked_by[node_id]) == 0]
|
to_remove = [node_id for node_id in blocked_by if len(blocked_by[node_id]) == 0]
|
||||||
return list(blocked_by.keys())
|
return list(blocked_by.keys())
|
||||||
|
|
||||||
# Return this from a node and any users will be blocked with the given error message.
|
|
||||||
# If the message is None, execution will be blocked silently instead.
|
|
||||||
# Generally, you should avoid using this functionality unless absolutley necessary. Whenever it's
|
|
||||||
# possible, a lazy input will be more efficient and have a better user experience.
|
|
||||||
# This functionality is useful in two cases:
|
|
||||||
# 1. You want to conditionally prevent an output node from executing. (Particularly a built-in node
|
|
||||||
# like SaveImage. For your own output nodes, I would recommend just adding a BOOL input and using
|
|
||||||
# lazy evaluation to let it conditionally disable itself.)
|
|
||||||
# 2. You have a node with multiple possible outputs, some of which are invalid and should not be used.
|
|
||||||
# (I would recommend not making nodes like this in the future -- instead, make multiple nodes with
|
|
||||||
# different outputs. Unfortunately, there are several popular existing nodes using this pattern.)
|
|
||||||
class ExecutionBlocker:
|
class ExecutionBlocker:
|
||||||
|
"""
|
||||||
|
Return this from a node and any users will be blocked with the given error message.
|
||||||
|
If the message is None, execution will be blocked silently instead.
|
||||||
|
Generally, you should avoid using this functionality unless absolutely necessary. Whenever it's
|
||||||
|
possible, a lazy input will be more efficient and have a better user experience.
|
||||||
|
This functionality is useful in two cases:
|
||||||
|
1. You want to conditionally prevent an output node from executing. (Particularly a built-in node
|
||||||
|
like SaveImage. For your own output nodes, I would recommend just adding a BOOL input and using
|
||||||
|
lazy evaluation to let it conditionally disable itself.)
|
||||||
|
2. You have a node with multiple possible outputs, some of which are invalid and should not be used.
|
||||||
|
(I would recommend not making nodes like this in the future -- instead, make multiple nodes with
|
||||||
|
different outputs. Unfortunately, there are several popular existing nodes using this pattern.)
|
||||||
|
"""
|
||||||
def __init__(self, message):
|
def __init__(self, message):
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user