MCPcopy Index your code
hub / github.com/python/mypy / remove_imported_names_from_symtable

Function remove_imported_names_from_symtable

mypy/semanal.py:8250–8261  ·  view source on GitHub ↗

Remove all imported names from the symbol table of a module.

(names: SymbolTable, module: str)

Source from the content-addressed store, hash-verified

8248
8249
8250def remove_imported_names_from_symtable(names: SymbolTable, module: str) -> None:
8251 """Remove all imported names from the symbol table of a module."""
8252 removed: list[str] = []
8253 for name, node in names.items():
8254 if node.node is None:
8255 continue
8256 fullname = node.node.fullname
8257 prefix = fullname[: fullname.rfind(".")]
8258 if prefix != module:
8259 removed.append(name)
8260 for name in removed:
8261 del names[name]
8262
8263
8264def make_any_non_explicit(t: Type) -> Type:

Callers 1

cleanup_builtin_sccFunction · 0.90

Calls 3

rfindMethod · 0.80
appendMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…