(self, n: ast3.Import)
| 1406 | |
| 1407 | # Import(alias* names) |
| 1408 | def visit_Import(self, n: ast3.Import) -> Import: |
| 1409 | names: list[tuple[str, str | None]] = [] |
| 1410 | for alias in n.names: |
| 1411 | name = self.translate_module_id(alias.name) |
| 1412 | asname = alias.asname |
| 1413 | if asname is None and name != alias.name: |
| 1414 | # if the module name has been translated (and it's not already |
| 1415 | # an explicit import-as), make it an implicit import-as the |
| 1416 | # original name |
| 1417 | asname = alias.name |
| 1418 | names.append((name, asname)) |
| 1419 | i = Import(names) |
| 1420 | self.imports.append(i) |
| 1421 | return self.set_line(i, n) |
| 1422 | |
| 1423 | # ImportFrom(identifier? module, alias* names, int? level) |
| 1424 | def visit_ImportFrom(self, n: ast3.ImportFrom) -> ImportBase: |
nothing calls this directly
no test coverage detected