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

Method visit_ImportFrom

mypy/fastparse.py:1424–1436  ·  view source on GitHub ↗
(self, n: ast3.ImportFrom)

Source from the content-addressed store, hash-verified

1422
1423 # ImportFrom(identifier? module, alias* names, int? level)
1424 def visit_ImportFrom(self, n: ast3.ImportFrom) -> ImportBase:
1425 assert n.level is not None
1426 if len(n.names) == 1 and n.names[0].name == "*":
1427 mod = n.module if n.module is not None else ""
1428 i: ImportBase = ImportAll(mod, n.level)
1429 else:
1430 i = ImportFrom(
1431 self.translate_module_id(n.module) if n.module is not None else "",
1432 n.level,
1433 [(a.name, a.asname) for a in n.names],
1434 )
1435 self.imports.append(i)
1436 return self.set_line(i, n)
1437
1438 # Global(identifier* names)
1439 def visit_Global(self, n: ast3.Global) -> GlobalDecl:

Callers

nothing calls this directly

Calls 6

translate_module_idMethod · 0.95
set_lineMethod · 0.95
ImportAllClass · 0.90
ImportFromClass · 0.90
lenFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected