(file_path: str, ext: str)
| 11 | |
| 12 | |
| 13 | def load_external_file(file_path: str, ext: str) -> str: |
| 14 | notebook: str = "" |
| 15 | if is_github_src(file_path, ext=ext): |
| 16 | notebook = ( |
| 17 | requests.get(get_github_src_url(file_path)) |
| 18 | .raise_for_status() |
| 19 | .text() |
| 20 | ) |
| 21 | elif is_url(file_path): |
| 22 | notebook = requests.get(file_path).raise_for_status().text() |
| 23 | else: |
| 24 | if not Path(file_path).exists(): |
| 25 | raise click.FileError(file_path, "File does not exist") |
| 26 | notebook = Path(file_path).read_text(encoding="utf-8") |
| 27 | |
| 28 | return notebook |
no test coverage detected
searching dependent graphs…