Given an element from the ast which is an import statement, return a Variable that points_to the module being imported. For now, the points_to is a string but that is resolved later. :param element ast: :rtype: Variable
(element)
| 83 | |
| 84 | |
| 85 | def process_import(element): |
| 86 | """ |
| 87 | Given an element from the ast which is an import statement, return a |
| 88 | Variable that points_to the module being imported. For now, the |
| 89 | points_to is a string but that is resolved later. |
| 90 | |
| 91 | :param element ast: |
| 92 | :rtype: Variable |
| 93 | """ |
| 94 | ret = [] |
| 95 | |
| 96 | for single_import in element.names: |
| 97 | assert isinstance(single_import, ast.alias) |
| 98 | token = single_import.asname or single_import.name |
| 99 | rhs = single_import.name |
| 100 | |
| 101 | if hasattr(element, 'module') and element.module: |
| 102 | rhs = djoin(element.module, rhs) |
| 103 | ret.append(Variable(token, points_to=rhs, line_number=element.lineno)) |
| 104 | return ret |
| 105 | |
| 106 | |
| 107 | def make_local_variables(lines, parent): |
no test coverage detected