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

Function infer_format

plotly/io/_kaleido.py:206–222  ·  view source on GitHub ↗
(path: Union[Path, None], format: Union[str, None])

Source from the content-addressed store, hash-verified

204
205
206def infer_format(path: Union[Path, None], format: Union[str, None]) -> Union[str, None]:
207 if path is not None and format is None:
208 ext = path.suffix
209 if ext:
210 format = ext.lstrip(".")
211 else:
212 raise ValueError(
213 f"""
214Cannot infer image type from output path '{path}'.
215Please specify the type using the format parameter, or add a file extension.
216For example:
217
218 >>> import plotly.io as pio
219 >>> pio.write_image(fig, file_path, format='png')
220"""
221 )
222 return format
223
224
225def to_image(

Callers 2

write_imageFunction · 0.85
write_imagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected