MCPcopy Index your code
hub / github.com/plotly/dash / _raise_invalid

Function _raise_invalid

dash/_validate.py:219–257  ·  view source on GitHub ↗
(bad_val, outer_val, path, index=None, toplevel=False)

Source from the content-addressed store, hash-verified

217 valid_props = (str, int, float, type(None), tuple, MutableSequence, NoUpdate)
218
219 def _raise_invalid(bad_val, outer_val, path, index=None, toplevel=False):
220 bad_type = type(bad_val).__name__
221 outer_id = f"(id={outer_val.id:s})" if getattr(outer_val, "id", False) else ""
222 outer_type = type(outer_val).__name__
223 if toplevel:
224 location = dedent(
225 """
226 The value in question is either the only value returned,
227 or is in the top level of the returned list,
228 """
229 )
230 else:
231 index_string = "[*]" if index is None else f"[{index:d}]"
232 location = dedent(
233 f"""
234 The value in question is located at
235 {index_string} {outer_type} {outer_id}
236 {path},
237 """
238 )
239
240 obj = "tree with one value" if not toplevel else "value"
241 raise exceptions.InvalidCallbackReturnValue(
242 dedent(
243 f"""
244 The callback for `{output!r}`
245 returned a {obj:s} having type `{bad_type}`
246 which is not JSON serializable.
247
248 {location}
249 and has string representation
250 `{bad_val}`
251
252 In general, Dash properties can only be
253 dash components, strings, dictionaries, numbers, None,
254 or lists of those.
255 """
256 )
257 )
258
259 def _valid_child(val):
260 return isinstance(val, valid_children)

Callers 1

_validate_valueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…