(path: Union[Path, None], format: Union[str, None])
| 204 | |
| 205 | |
| 206 | def 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""" |
| 214 | Cannot infer image type from output path '{path}'. |
| 215 | Please specify the type using the format parameter, or add a file extension. |
| 216 | For example: |
| 217 | |
| 218 | >>> import plotly.io as pio |
| 219 | >>> pio.write_image(fig, file_path, format='png') |
| 220 | """ |
| 221 | ) |
| 222 | return format |
| 223 | |
| 224 | |
| 225 | def to_image( |
no outgoing calls
no test coverage detected