Check if a class inherits from BasePyModule. Parameters ---------- node : doc.ClassDef The class definition node to check. Returns ------- bool True if the class inherits from BasePyModule, False otherwise.
(node: doc.ClassDef)
| 178 | |
| 179 | |
| 180 | def _check_base_py_module_inheritance(node: doc.ClassDef) -> bool: |
| 181 | """Check if a class inherits from BasePyModule. |
| 182 | |
| 183 | Parameters |
| 184 | ---------- |
| 185 | node : doc.ClassDef |
| 186 | The class definition node to check. |
| 187 | |
| 188 | Returns |
| 189 | ------- |
| 190 | bool |
| 191 | True if the class inherits from BasePyModule, False otherwise. |
| 192 | """ |
| 193 | if not node.bases: |
| 194 | return False |
| 195 | |
| 196 | # Check each base class |
| 197 | for base in node.bases: |
| 198 | if hasattr(base, "id"): |
| 199 | if base.id == "BasePyModule": |
| 200 | return True |
| 201 | elif hasattr(base, "attr"): |
| 202 | if base.attr == "BasePyModule": |
| 203 | return True |
| 204 | elif hasattr(base, "value") and hasattr(base.value, "id"): |
| 205 | if ( |
| 206 | base.value.id in ["BasePyModule", "tvm", "relax"] |
| 207 | and hasattr(base, "attr") |
| 208 | and base.attr == "BasePyModule" |
| 209 | ): |
| 210 | return True |
| 211 | |
| 212 | return False |
no outgoing calls
no test coverage detected
searching dependent graphs…