File size: 1,265 Bytes
3719834
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Hack: string type that is always equal in not equal comparisons
class AnyType(str):
    def __ne__(self, __value: object) -> bool:
        return False


# Our any instance wants to be a wildcard string
any = AnyType("*")


class ReroutePrimitive:
    @classmethod
    def INPUT_TYPES(cls):
        return {
            "required": {"value": (any, )},
        }

    @classmethod
    def VALIDATE_INPUTS(s, **kwargs):
        return True

    RETURN_TYPES = (any,)
    FUNCTION = "route"
    CATEGORY = "__hidden__"

    def route(self, value):
        return (value,)


class MultiPrimitive:
    @classmethod
    def INPUT_TYPES(cls):
        return {
            "required": {},
            "optional": {"value": (any, )},
        }

    @classmethod
    def VALIDATE_INPUTS(s, **kwargs):
        return True

    RETURN_TYPES = (any,)
    FUNCTION = "listify"
    CATEGORY = "utils"
    OUTPUT_IS_LIST = (True,)

    def listify(self, **kwargs):
        return (list(kwargs.values()),)


NODE_CLASS_MAPPINGS = {
    "ReroutePrimitive|pysssss": ReroutePrimitive,
    # "MultiPrimitive|pysssss": MultiPrimitive,
}

NODE_DISPLAY_NAME_MAPPINGS = {
    "ReroutePrimitive|pysssss": "Reroute Primitive 🐍",
    # "MultiPrimitive|pysssss": "Multi Primitive 🐍",
}