Download tests/reader_sources.py from VoiceOfML/Search: direct link, hf CLI and curl.
- Browser
- Download file 637 Bytes
-
https://huggingface.co/spaces/VoiceOfML/Search/resolve/main/tests/reader_sources.py
- Command line
-
hf download hf://spaces/VoiceOfML/Search/tests/reader_sources.py
-
curl -L -o reader_sources.py https://huggingface.co/spaces/VoiceOfML/Search/resolve/main/tests/reader_sources.py
637 Bytes
| """Read the actual component graph for non-executing source smoke assertions.""" | |
| import re | |
| def read_reader_source(root): | |
| static = root / "static" | |
| barrel = static / "reader/reader-components.mjs" | |
| exports = barrel.read_text(encoding="utf-8") | |
| files = [static / "reader.js", *(barrel.parent / name for name in | |
| re.findall(r'from "\./([\w/-]+\.mjs)"', exports))] | |
| sources = [] | |
| for filename in files: | |
| source = filename.read_text(encoding="utf-8") | |
| source = re.sub(r"\breaderContext\.", "", source) | |
| sources.append(re.sub(r"^ ", "", source, flags=re.M)) | |
| return "\n".join(sources) | |