Transform a magic assignment found by the ``find()`` classmethod.
(self, lines: List[str])
| 224 | return cls(line[assign_ix+1].start) |
| 225 | |
| 226 | def transform(self, lines: List[str]): |
| 227 | """Transform a magic assignment found by the ``find()`` classmethod. |
| 228 | """ |
| 229 | start_line, start_col = self.start_line, self.start_col |
| 230 | lhs = lines[start_line][:start_col] |
| 231 | end_line = find_end_of_continued_line(lines, start_line) |
| 232 | rhs = assemble_continued_line(lines, (start_line, start_col), end_line) |
| 233 | assert rhs.startswith('%'), rhs |
| 234 | magic_name, _, args = rhs[1:].partition(' ') |
| 235 | |
| 236 | lines_before = lines[:start_line] |
| 237 | call = "get_ipython().run_line_magic({!r}, {!r})".format(magic_name, args) |
| 238 | new_line = lhs + call + '\n' |
| 239 | lines_after = lines[end_line+1:] |
| 240 | |
| 241 | return lines_before + [new_line] + lines_after |
| 242 | |
| 243 | |
| 244 | class SystemAssign(TokenTransformBase): |
nothing calls this directly
no test coverage detected