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

Function iso_to_plotly_time_string

_plotly_utils/utils.py:343–357  ·  view source on GitHub ↗

Remove timezone info and replace 'T' delimeter with ' ' (ws).

(iso_string)

Source from the content-addressed store, hash-verified

341
342
343def iso_to_plotly_time_string(iso_string):
344 """Remove timezone info and replace 'T' delimeter with ' ' (ws)."""
345 # make sure we don't send timezone info to plotly
346 if (iso_string.split("-")[:3] == "00:00") or (iso_string.split("+")[0] == "00:00"):
347 raise Exception(
348 "Plotly won't accept timestrings with timezone info.\n"
349 "All timestrings are assumed to be in UTC."
350 )
351
352 iso_string = iso_string.replace("-00:00", "").replace("+00:00", "")
353
354 if iso_string.endswith("T00:00:00"):
355 return iso_string.replace("T00:00:00", "")
356 else:
357 return iso_string.replace("T", " ")
358
359
360def template_doc(**names):

Callers 1

encode_as_dateMethod · 0.85

Calls 2

splitMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected