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

Class LiteralValidator

_plotly_utils/basevalidators.py:2242–2262  ·  view source on GitHub ↗

Validator for readonly literal values

Source from the content-addressed store, hash-verified

2240
2241
2242class LiteralValidator(BaseValidator):
2243 """
2244 Validator for readonly literal values
2245 """
2246
2247 def __init__(self, plotly_name, parent_name, val, **kwargs):
2248 super(LiteralValidator, self).__init__(
2249 plotly_name=plotly_name, parent_name=parent_name, **kwargs
2250 )
2251 self.val = val
2252
2253 def validate_coerce(self, v):
2254 if v != self.val:
2255 raise ValueError(
2256 """\
2257 The '{plotly_name}' property of {parent_name} is read-only""".format(
2258 plotly_name=self.plotly_name, parent_name=self.parent_name
2259 )
2260 )
2261 else:
2262 return v
2263
2264
2265class DashValidator(EnumeratedValidator):

Callers 2

get_validatorMethod · 0.90
validatorFunction · 0.90

Calls

no outgoing calls

Tested by 1

validatorFunction · 0.72