(pth: Path, mime: str, metadata, **kwargs)
| 28 | |
| 29 | @Analyzer.ID("ast_ngrams") |
| 30 | def 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 | |
| 53 | def pq_gram_index(node: tuple, p: int, q: int, stem=None): |
nothing calls this directly
no test coverage detected