MCPcopy
hub / github.com/marimo-team/marimo / load_external_file

Function load_external_file

marimo/_cli/convert/utils.py:13–28  ·  view source on GitHub ↗
(file_path: str, ext: str)

Source from the content-addressed store, hash-verified

11
12
13def 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

Callers 1

convertFunction · 0.90

Calls 8

is_github_srcFunction · 0.90
get_github_src_urlFunction · 0.90
is_urlFunction · 0.90
raise_for_statusMethod · 0.80
getMethod · 0.65
textMethod · 0.45
existsMethod · 0.45
read_textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…