File size: 2,979 Bytes
3d5837a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import sys


class AnyType(str):
    def __ne__(self, __value: object) -> bool:
        return False


ANY = AnyType("*")


class Field:
    @staticmethod
    def field(field: str | list, data: dict = None) -> tuple[str | list, dict] | tuple[str | list]:
        if data:
            return (field, data,)
        return (field,)

    @staticmethod
    def boolean(

            default: float = False, force: bool = False

    ) -> tuple[str, dict]:
        field_data = {"default": default, "force": force}
        return Field.field("BOOLEAN", field_data)

    @staticmethod
    def float(

            default: float = 1, min: float = -sys.float_info.max, max: float = sys.float_info.max, step: float = 0.01,

            force: bool = False

    ) -> tuple[str, dict]:
        field_data = {"default": default, "min": min, "max": max, "step": step, "forceInput": force}
        return Field.field("FLOAT", field_data)

    @staticmethod
    def int(

            default: int = 1, min: int = -sys.maxsize, max: int = sys.maxsize, step: int = 1, force: bool = False

    ) -> tuple[str, dict]:
        field_data = {"default": default, "min": min, "max": max, "step": step, "forceInput": force}
        return Field.field("INT", field_data)

    @staticmethod
    def string(

            default: str = '',

            multiline: bool = False,

            force: bool = False,

            dynamicPrompts: bool = False

    ) -> tuple[str, dict]:
        field_data = {"default": default, 'multiline': multiline, "forceInput": force, "dynamicPrompts": dynamicPrompts}
        return Field.field("STRING", field_data)

    @staticmethod
    def any():
        return Field.field(ANY, {"forceInput": False})

    @staticmethod
    def latent(force: bool = False):
        field_data = {"forceInput": force}
        return Field.field("LATENT", field_data)

    @staticmethod
    def image(force: bool = False):
        field_data = {"forceInput": force}
        return Field.field("IMAGE", field_data)

    @staticmethod
    def model(force: bool = False):
        field_data = {"forceInput": force}
        return Field.field("MODEL", field_data)

    @staticmethod
    def lora(force: bool = False):
        field_data = {"forceInput": force}
        return Field.field("LORA", field_data)

    @staticmethod
    def vae(force: bool = False):
        field_data = {"forceInput": force}
        return Field.field("VAE", field_data)

    @staticmethod
    def conditioning(force: bool = False):
        field_data = {"forceInput": force}
        return Field.field("CONDITIONING", field_data)

    @staticmethod
    def clip(force: bool = False):
        field_data = {"forceInput": force}
        return Field.field("CLIP", field_data)

    @staticmethod
    def combo(data: list, force: bool = False):
        field_data = {"forceInput": force}
        return Field.field(data, field_data)