(class_node: ast.ClassDef, module_qn: str)
| 131 | |
| 132 | |
| 133 | def base_qns(class_node: ast.ClassDef, module_qn: str) -> list[str]: |
| 134 | out: list[str] = [] |
| 135 | for base in class_node.bases: |
| 136 | if isinstance(base, ast.Name): |
| 137 | # Bare name — qualify within the same module by default. |
| 138 | out.append(f"{module_qn}.{base.id}") |
| 139 | elif isinstance(base, ast.Attribute): |
| 140 | # mod.SubClass |
| 141 | try: |
| 142 | text = ast.unparse(base) # type: ignore[attr-defined] |
| 143 | except Exception: |
| 144 | continue |
| 145 | out.append(text) |
| 146 | return out |
| 147 | |
| 148 | |
| 149 | @dataclasses.dataclass |