MCPcopy Index your code
hub / github.com/reactive-python/reactpy / _literal_include

Function _literal_include

docs/source/_exts/reactpy_example.py:106–121  ·  view source on GitHub ↗
(path: Path, linenos: bool)

Source from the content-addressed store, hash-verified

104
105
106def _literal_include(path: Path, linenos: bool):
107 try:
108 language = {
109 ".py": "python",
110 ".js": "javascript",
111 ".json": "json",
112 }[path.suffix]
113 except KeyError:
114 msg = f"Unknown extension type {path.suffix!r}"
115 raise ValueError(msg) from None
116
117 return _literal_include_template.format(
118 name=str(path.relative_to(SOURCE_DIR)),
119 language=language,
120 options=_join_options(_get_file_options(path)),
121 )
122
123
124def _join_options(option_strings: list[str]) -> str:

Callers 1

runMethod · 0.85

Calls 2

_join_optionsFunction · 0.85
_get_file_optionsFunction · 0.85

Tested by

no test coverage detected