-
Notifications
You must be signed in to change notification settings - Fork 3
/
number.py
32 lines (28 loc) · 955 Bytes
/
number.py
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
import yaml, os
module_root_directory = os.path.dirname(os.path.realpath(__file__))
config_file = os.path.join(module_root_directory,'config.yaml')
def read_config(item):
with open(config_file, 'r') as file:
return yaml.safe_load(file)[item]
class CommonSizes:
CATEGORY = "quicknodes"
@classmethod
def INPUT_TYPES(s):
return { "required": { "size": (read_config('sizes'), {}) } }
RETURN_TYPES = ("INT","INT")
RETURN_NAMES = ("width","height")
FUNCTION = "func"
def func(self,size:str):
x, y = [int(v) for v in size.split('x')]
return (x,y)
class JustAnInteger:
CATEGORY = "quicknodes"
@classmethod
def INPUT_TYPES(s):
return { "required": { "number": ("INT", {"default":0}) } }
RETURN_TYPES = ("INT",)
RETURN_NAMES = ("number",)
FUNCTION = "func"
def func(self,number):
return (number,)
CLAZZES = [CommonSizes, JustAnInteger]