Retrieve the symbol table for the module (or None on failure). 1) Use inspect to retrieve the source code of the module 2) Use symtable to parse the source (and use what symtable knows for its purposes)
(runtime: types.ModuleType)
| 329 | |
| 330 | @functools.lru_cache |
| 331 | def _module_symbol_table(runtime: types.ModuleType) -> symtable.SymbolTable | None: |
| 332 | """Retrieve the symbol table for the module (or None on failure). |
| 333 | |
| 334 | 1) Use inspect to retrieve the source code of the module |
| 335 | 2) Use symtable to parse the source (and use what symtable knows for its purposes) |
| 336 | """ |
| 337 | try: |
| 338 | source = inspect.getsource(runtime) |
| 339 | except (OSError, TypeError, SyntaxError): |
| 340 | return None |
| 341 | |
| 342 | try: |
| 343 | return symtable.symtable(source, runtime.__name__, "exec") |
| 344 | except SyntaxError: |
| 345 | return None |
| 346 | |
| 347 | |
| 348 | @verify.register(nodes.MypyFile) |
no outgoing calls
no test coverage detected
searching dependent graphs…