MCPcopy Index your code
hub / github.com/SourceCode-AI/aura / extract

Function extract

ngrams.py:30–50  ·  view source on GitHub ↗
(pth: Path, mime: str, metadata, **kwargs)

Source from the content-addressed store, hash-verified

28
29@Analyzer.ID("ast_ngrams")
30def extract(pth: Path, mime: str, metadata, **kwargs):
31 if pth.suffix == '.py':
32 pass
33 elif mime != 'text/x-python':
34 return
35
36 spth = os.fspath(pth.absolute())
37
38 ast_tree = python_executor.run_with_interpreters(command=[INSPECTOR_PATH, spth], metadata=metadata)
39
40 pprint.pprint(ast_tree['ast_tree'])
41
42 identifier_tree = extract_identifier(ast_tree['ast_tree'])
43 tuple_identifiers = identifier_tree.to_tuple()
44
45 pprint.pprint(tuple_identifiers)
46 print('---')
47 for x in filter_pq_gram_duplicates(tuple_identifiers, 2, 3):
48 print(x)
49
50 yield from []
51
52
53def pq_gram_index(node: tuple, p: int, q: int, stem=None):

Callers

nothing calls this directly

Calls 4

extract_identifierFunction · 0.85
to_tupleMethod · 0.80
pprintMethod · 0.45

Tested by

no test coverage detected