-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdelay_node.py
More file actions
54 lines (42 loc) · 1.15 KB
/
Copy pathdelay_node.py
File metadata and controls
54 lines (42 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import time
class AnyType(str):
"""A special type that compares equal to everything, allowing any connection."""
def __ne__(self, __value: object) -> bool:
return False
any_type = AnyType("*")
class AddDelay:
"""
Adds a delay (sleep) in seconds, then passes the input through unchanged.
Default delay = 6.0 seconds.
"""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"input": (any_type,),
"delay": ("FLOAT", {
"default": 6.0,
"min": 0.0,
"max": 3600.0,
"step": 0.1
}),
}
}
RETURN_TYPES = (any_type,)
RETURN_NAMES = ("output",)
FUNCTION = "run"
CATEGORY = "flow-assistor"
def run(self, input, delay=6.0):
try:
d = float(delay)
except Exception:
d = 6.0
if d > 0:
time.sleep(d)
return (input,)
NODE_CLASS_MAPPINGS = {
"AddDelay": AddDelay,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"AddDelay": "Add Delay",
}