(input_types)
| 33 | raise NotImplementedError("VariantSupport does not support VALIDATE_INPUTS yet") |
| 34 | else: |
| 35 | def validate_inputs(input_types): |
| 36 | inputs = cls.INPUT_TYPES() |
| 37 | for key, value in input_types.items(): |
| 38 | if isinstance(value, SmartType): |
| 39 | continue |
| 40 | if "required" in inputs and key in inputs["required"]: |
| 41 | expected_type = inputs["required"][key][0] |
| 42 | elif "optional" in inputs and key in inputs["optional"]: |
| 43 | expected_type = inputs["optional"][key][0] |
| 44 | else: |
| 45 | expected_type = None |
| 46 | if expected_type is not None and MakeSmartType(value) != expected_type: |
| 47 | return f"Invalid type of {key}: {value} (expected {expected_type})" |
| 48 | return True |
| 49 | setattr(cls, "VALIDATE_INPUTS", validate_inputs) |
| 50 | return cls |
| 51 | return decorator |
nothing calls this directly
no test coverage detected