Download data2/step22/debug_parser.py from SciCode/dataset-builder: direct link, hf CLI and curl.
- Browser
- Download file 707 Bytes
-
https://huggingface.co/SciCode/dataset-builder/resolve/6ae52c9bb8f9ec00c6d53dfa41e6e3f73cd76e31/data2/step22/debug_parser.py
- Command line
-
hf download hf://SciCode/dataset-builder@6ae52c9bb8f9ec00c6d53dfa41e6e3f73cd76e31/data2/step22/debug_parser.py
-
curl -L -o debug_parser.py https://huggingface.co/SciCode/dataset-builder/resolve/6ae52c9bb8f9ec00c6d53dfa41e6e3f73cd76e31/data2/step22/debug_parser.py
707 Bytes
| from tree_sitter import Language, Parser | |
| import os | |
| LANG_SO = "build/my-languages.so" | |
| LANGUAGES = ["python", "c", "cpp", "java", "go", "rust", "julia"] | |
| def test_load(): | |
| print(f"CWD: {os.getcwd()}") | |
| print(f"LANG_SO path: {os.path.abspath(LANG_SO)}") | |
| print(f"Exists: {os.path.exists(LANG_SO)}") | |
| for lang in LANGUAGES: | |
| try: | |
| language = Language(LANG_SO, lang) | |
| parser = Parser() | |
| parser.set_language(language) | |
| print(f"Successfully loaded {lang}") | |
| except Exception as e: | |
| print(f"Failed to load {lang}: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| if __name__ == "__main__": | |
| test_load() | |