Remove attributes not defined in all subclasses from always defined attrs.
(cl: ClassIR, seen: set[ClassIR])
| 398 | |
| 399 | |
| 400 | def update_always_defined_attrs_using_subclasses(cl: ClassIR, seen: set[ClassIR]) -> None: |
| 401 | """Remove attributes not defined in all subclasses from always defined attrs.""" |
| 402 | if cl in seen: |
| 403 | return |
| 404 | if cl.children is None: |
| 405 | # Subclasses are unknown |
| 406 | return |
| 407 | removed = set() |
| 408 | for attr in cl._always_initialized_attrs: |
| 409 | for child in cl.children: |
| 410 | update_always_defined_attrs_using_subclasses(child, seen) |
| 411 | if attr not in child._always_initialized_attrs: |
| 412 | removed.add(attr) |
| 413 | cl._always_initialized_attrs -= removed |
| 414 | seen.add(cl) |
| 415 | |
| 416 | |
| 417 | def detect_undefined_bitmap(cl: ClassIR, seen: set[ClassIR]) -> None: |
no test coverage detected
searching dependent graphs…