(self, code_content: str)
| 60 | return ['py'] |
| 61 | |
| 62 | def parse(self, code_content: str) -> List[ImportInfo]: |
| 63 | imports = [] |
| 64 | |
| 65 | # Pattern 1: from ... import ... |
| 66 | from_pattern = r'^\s*from\s+([\w.]+)\s+import\s+(?:\(([^)]+)\)|([^\n]+))' |
| 67 | for match in re.finditer(from_pattern, code_content, |
| 68 | re.MULTILINE | re.DOTALL): |
| 69 | info = self._extract_from_import(match, code_content) |
| 70 | if info: |
| 71 | imports.append(info) |
| 72 | |
| 73 | # Pattern 2: import ... |
| 74 | import_pattern = r'^\s*import\s+([\w.,\s]+)' |
| 75 | for match in re.finditer(import_pattern, code_content, re.MULTILINE): |
| 76 | infos = self._extract_simple_import(match) |
| 77 | imports.extend(infos) |
| 78 | |
| 79 | return imports |
| 80 | |
| 81 | def _extract_from_import(self, match, |
| 82 | code_content) -> Optional[ImportInfo]: |
nothing calls this directly
no test coverage detected