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

Method present

_plotly_utils/basevalidators.py:362–389  ·  view source on GitHub ↗

Convert output value of a previous call to `validate_coerce` into a form suitable to be returned to the user on upon property access. Note: The value returned by present must be either immutable or an instance of BasePlotlyType, otherwise the value could be

(self, v)

Source from the content-addressed store, hash-verified

360 raise NotImplementedError()
361
362 def present(self, v):
363 """
364 Convert output value of a previous call to `validate_coerce` into a
365 form suitable to be returned to the user on upon property
366 access.
367
368 Note: The value returned by present must be either immutable or an
369 instance of BasePlotlyType, otherwise the value could be mutated by
370 the user and we wouldn't get notified about the change.
371
372 Parameters
373 ----------
374 v
375 A value that was the ouput of a previous call the
376 `validate_coerce` method on the same object
377
378 Returns
379 -------
380
381 """
382 if is_homogeneous_array(v):
383 # Note: numpy array was already coerced into read-only form so
384 # we don't need to copy it here.
385 return v
386 elif is_simple_array(v):
387 return tuple(v)
388 else:
389 return v
390
391
392class DataArrayValidator(BaseValidator):

Callers 15

presentMethod · 0.45
__getitem__Method · 0.45
__getitem__Method · 0.45
__getattr__Method · 0.45
test_acceptanceFunction · 0.45
test_acceptance_emptyFunction · 0.45
test_acceptance_dictFunction · 0.45
test_acceptance_aokFunction · 0.45
test_acceptance_aok_2DFunction · 0.45
test_coercion_aok_listFunction · 0.45
test_acceptance_arrayFunction · 0.45

Calls 2

is_homogeneous_arrayFunction · 0.85
is_simple_arrayFunction · 0.85