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

Method activate

plotly/io/_base_renderers.py:265–302  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

263 self.include_plotlyjs = "cdn" if self.connected else include_plotlyjs
264
265 def activate(self):
266 if self.global_init:
267 if not ipython_display:
268 raise ValueError(
269 "The {cls} class requires ipython but it is not installed".format(
270 cls=self.__class__.__name__
271 )
272 )
273
274 if self.connected:
275 script = """\
276 <script>
277 {win_config}
278 {mathjax_config}
279 </script>
280 <script type="module">import \"{plotly_cdn}\"</script>
281 """.format(
282 win_config=_window_plotly_config,
283 mathjax_config=_mathjax_config,
284 plotly_cdn=plotly_cdn_url().rstrip(".js"),
285 )
286
287 else:
288 # If not connected then we embed a copy of the plotly.js
289 # library in the notebook
290 script = """\
291 <script>
292 {win_config}
293 {mathjax_config}
294 </script>
295 <script>{script}</script>
296 """.format(
297 script=get_plotlyjs(),
298 win_config=_window_plotly_config,
299 mathjax_config=_mathjax_config,
300 )
301
302 ipython_display.display_html(script, raw=True)
303
304 def to_mimebundle(self, fig_dict):
305 from plotly.io import to_html

Callers

nothing calls this directly

Calls 3

plotly_cdn_urlFunction · 0.90
get_plotlyjsFunction · 0.90
formatMethod · 0.45

Tested by

no test coverage detected