MCPcopy
hub / github.com/plotly/dash / validate_output_spec

Function validate_output_spec

dash/_validate.py:120–140  ·  view source on GitHub ↗

This validation is for security and internal debugging, not for users, so the messages are not intended to be clear. `output` comes from the callback definition, `output_spec` from the request.

(output, output_spec, Output)

Source from the content-addressed store, hash-verified

118
119
120def validate_output_spec(output, output_spec, Output):
121 """
122 This validation is for security and internal debugging, not for users,
123 so the messages are not intended to be clear.
124 `output` comes from the callback definition, `output_spec` from the request.
125 """
126 if not isinstance(output, (list, tuple)):
127 output, output_spec = [output], [output_spec]
128 elif len(output) != len(output_spec):
129 raise exceptions.CallbackException("Wrong length output_spec")
130
131 for outi, speci in zip(output, output_spec):
132 speci_list = speci if isinstance(speci, (list, tuple)) else [speci]
133 for specij in speci_list:
134 if (
135 not Output(specij["id"], clean_property_name(specij["property"]))
136 == outi
137 ):
138 raise exceptions.CallbackException(
139 "Output does not match callback definition"
140 )
141
142
143def validate_and_group_input_args(flat_args, arg_index_grouping):

Callers

nothing calls this directly

Calls 2

clean_property_nameFunction · 0.85
OutputClass · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…