-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathloop_basic_batch.py
More file actions
39 lines (34 loc) · 1.23 KB
/
loop_basic_batch.py
File metadata and controls
39 lines (34 loc) · 1.23 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
class Everything(str):
def __ne__(self, __value: object) -> bool:
return False
class LoopBasicBatch:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"nb_loops": ("INT", {"default": 1, "min": 0, "max": 1000, "step": 1}),
"default_text": ("STRING", {"default": "Default input"})
},
"optional": {
"input": (Everything("*"),)
},
}
RETURN_TYPES = (Everything("*"),)
RETURN_NAMES = ("output",)
OUTPUT_IS_LIST = (True,)
FUNCTION = "create_loop_basic_batch"
CATEGORY = "Bjornulf"
def create_loop_basic_batch(self, nb_loops, default_text, input=None):
if input is not None:
return ([input] * nb_loops,)
# Determine the type of the default_text
if default_text.isdigit():
self.RETURN_TYPES = ("INT",)
output = int(default_text)
elif default_text.replace('.', '', 1).isdigit() and default_text.count('.') == 1:
self.RETURN_TYPES = ("FLOAT",)
output = float(default_text)
else:
self.RETURN_TYPES = ("STRING",)
output = default_text
return ([output] * nb_loops,)