MCPcopy
hub / github.com/opentrace/opentrace / getPythonParser

Function getPythonParser

ui/src/components/pipeline/__tests__/helpers.ts:37–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35let pyParser: Parser | null = null;
36
37export async function getPythonParser(): Promise<Parser> {
38 await initTreeSitter();
39 if (!pyParser) {
40 pyParser = new Parser();
41 const buf = await readFile(getWasmPath('python'));
42 const lang = await Language.load(buf);
43 pyParser.setLanguage(lang);
44 }
45 return pyParser;
46}
47
48export async function parsePython(source: string): Promise<SyntaxNode> {
49 const parser = await getPythonParser();

Callers 6

pipeline.test.tsFile · 0.90
github.test.tsFile · 0.90
cross-repo.test.tsFile · 0.90
parsing.test.tsFile · 0.90
fixture.test.tsFile · 0.90
parsePythonFunction · 0.85

Calls 4

getWasmPathFunction · 0.90
initTreeSitterFunction · 0.85
readFileFunction · 0.85
loadMethod · 0.80

Tested by

no test coverage detected