(outputs, inputs, state, extra_args, types)
| 20 | |
| 21 | |
| 22 | def validate_callback(outputs, inputs, state, extra_args, types): |
| 23 | Input, Output, State = types |
| 24 | if extra_args: |
| 25 | if not isinstance(extra_args[0], (Output, Input, State)): |
| 26 | raise exceptions.IncorrectTypeException( |
| 27 | dedent( |
| 28 | f""" |
| 29 | Callback arguments must be `Output`, `Input`, or `State` objects, |
| 30 | optionally wrapped in a list or tuple. We found (possibly after |
| 31 | unwrapping a list or tuple): |
| 32 | {repr(extra_args[0])} |
| 33 | """ |
| 34 | ) |
| 35 | ) |
| 36 | |
| 37 | raise exceptions.IncorrectTypeException( |
| 38 | dedent( |
| 39 | f""" |
| 40 | In a callback definition, you must provide all Outputs first, |
| 41 | then all Inputs, then all States. After this item: |
| 42 | {(outputs + inputs + state)[-1]!r} |
| 43 | we found this item next: |
| 44 | {extra_args[0]!r} |
| 45 | """ |
| 46 | ) |
| 47 | ) |
| 48 | |
| 49 | for args in [outputs, inputs, state]: |
| 50 | for arg in args: |
| 51 | validate_callback_arg(arg) |
| 52 | |
| 53 | |
| 54 | def validate_callback_arg(arg): |
no test coverage detected
searching dependent graphs…