Extract the animation section containing the specified line number
(self, code: str, line_number: int)
| 191 | return "\n".join(lines[start:end]) |
| 192 | |
| 193 | def _extract_animation_section(self, code: str, line_number: int) -> str: |
| 194 | """Extract the animation section containing the specified line number""" |
| 195 | lines = code.split("\n") |
| 196 | |
| 197 | # Find the animation section that contains the error line |
| 198 | section_start = None |
| 199 | section_end = None |
| 200 | |
| 201 | for i, line in enumerate(lines): |
| 202 | if re.match(r"\s*# === Animation for Lecture Line \d+ ===", line): |
| 203 | if section_start is None: |
| 204 | section_start = i |
| 205 | elif i > line_number: |
| 206 | section_end = i |
| 207 | break |
| 208 | |
| 209 | if section_start is not None: |
| 210 | if section_end is None: |
| 211 | section_end = len(lines) |
| 212 | return "\n".join(lines[section_start:section_end]) |
| 213 | |
| 214 | return self._extract_function_containing_line(code, line_number) |
| 215 | |
| 216 | def _get_manim_suggestions(self, undefined_name: str) -> List[str]: |
| 217 | """Get suggestions for Manim-related undefined names""" |
no test coverage detected