15 lines
442 B
Python
15 lines
442 B
Python
class MultiInput(str):
|
|
def __new__(cls, string, allowed_types="*"):
|
|
res = super().__new__(cls, string)
|
|
res.allowed_types = allowed_types
|
|
return res
|
|
|
|
def __ne__(self, other):
|
|
if self.allowed_types == "*" or other == "*":
|
|
return False
|
|
return other not in self.allowed_types
|
|
|
|
|
|
imageOrLatent = MultiInput("IMAGE", ["IMAGE", "LATENT"])
|
|
floatOrInt = MultiInput("FLOAT", ["FLOAT", "INT"])
|