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

Method _validate_coerce_renderers

plotly/io/_renderers.py:221–247  ·  view source on GitHub ↗

Input a string and validate that it contains the names of one or more valid renderers separated on '+' characters. If valid, return a list of the renderer names Parameters ---------- renderers_string: str Returns ------- lis

(self, renderers_string)

Source from the content-addressed store, hash-verified

219 ]
220
221 def _validate_coerce_renderers(self, renderers_string):
222 """
223 Input a string and validate that it contains the names of one or more
224 valid renderers separated on '+' characters. If valid, return
225 a list of the renderer names
226
227 Parameters
228 ----------
229 renderers_string: str
230
231 Returns
232 -------
233 list of str
234 """
235 # Validate value
236 if not isinstance(renderers_string, str):
237 raise ValueError("Renderer must be specified as a string")
238
239 renderer_names = renderers_string.split("+")
240 invalid = [name for name in renderer_names if name not in self]
241 if invalid:
242 raise ValueError(
243 """
244Invalid named renderer(s) received: {}""".format(str(invalid))
245 )
246
247 return renderer_names
248
249 def __repr__(self):
250 return """\

Callers 4

defaultMethod · 0.95
_build_mime_bundleMethod · 0.95
_renderers.pyFile · 0.80

Calls 2

splitMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected