Yields the path of a temporary HTML file containing data.
(data: str)
| 371 | |
| 372 | @contextmanager |
| 373 | def temp_html_filepath(data: str) -> Iterator[str]: |
| 374 | """Yields the path of a temporary HTML file containing data.""" |
| 375 | filepath = "" |
| 376 | try: |
| 377 | fid, filepath = tempfile.mkstemp(suffix=".html", prefix="folium_") |
| 378 | os.write(fid, data.encode("utf8") if isinstance(data, str) else data) |
| 379 | os.close(fid) |
| 380 | yield filepath |
| 381 | finally: |
| 382 | if os.path.isfile(filepath): |
| 383 | os.remove(filepath) |
| 384 | |
| 385 | |
| 386 | def deep_copy(item_original: Element) -> Element: |
no outgoing calls