MCPcopy Index your code
hub / github.com/plotly/plotly.py / raise_invalid_val

Method raise_invalid_val

_plotly_utils/basevalidators.py:290–324  ·  view source on GitHub ↗

Helper method to raise an informative exception when an invalid value is passed to the validate_coerce method. Parameters ---------- v : Value that was input to validate_coerce and could not be coerced inds: list of int or None (default)

(self, v, inds=None)

Source from the content-addressed store, hash-verified

288 raise NotImplementedError()
289
290 def raise_invalid_val(self, v, inds=None):
291 """
292 Helper method to raise an informative exception when an invalid
293 value is passed to the validate_coerce method.
294
295 Parameters
296 ----------
297 v :
298 Value that was input to validate_coerce and could not be coerced
299 inds: list of int or None (default)
300 Indexes to display after property name. e.g. if self.plotly_name
301 is 'prop' and inds=[2, 1] then the name in the validation error
302 message will be 'prop[2][1]`
303 Raises
304 -------
305 ValueError
306 """
307 name = self.plotly_name
308 if inds:
309 for i in inds:
310 name += "[" + str(i) + "]"
311
312 raise ValueError(
313 """
314 Invalid value of type {typ} received for the '{name}' property of {pname}
315 Received value: {v}
316
317{valid_clr_desc}""".format(
318 name=name,
319 pname=self.parent_name,
320 typ=type_str(v),
321 v=repr(v),
322 valid_clr_desc=self.description(),
323 )
324 )
325
326 def raise_invalid_elements(self, invalid_els):
327 if invalid_els:

Callers 15

validate_coerceMethod · 0.80
validate_coerceMethod · 0.80
validate_coerceMethod · 0.80
validate_coerceMethod · 0.80
validate_coerceMethod · 0.80
validate_coerceMethod · 0.80
validate_coerceMethod · 0.80
validate_coerceMethod · 0.80
validate_coerceMethod · 0.80
validate_coerceMethod · 0.80
validate_coerceMethod · 0.80
validate_coerceMethod · 0.80

Calls 3

descriptionMethod · 0.95
type_strFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected