| 79 | return type.__new__(cls, name, bases, dict_) |
| 80 | |
| 81 | def __init__(cls, name: str, bases: tuple, dict_: dict[str, Any]) -> None: |
| 82 | super().__init__(name, bases, dict_) |
| 83 | |
| 84 | # Always register into class name dictionary. |
| 85 | class_name_dict[cls.__name__] = cls |
| 86 | |
| 87 | # Register into class identifier dictionary only if the class |
| 88 | # has an identifier and it is different from its parents'. |
| 89 | cid = getattr(cls, "_c_classid", None) |
| 90 | if cid is not None: |
| 91 | for base in bases: |
| 92 | pcid = getattr(base, "_c_classid", None) |
| 93 | if pcid == cid: |
| 94 | break |
| 95 | else: |
| 96 | class_id_dict[cid] = cls |
| 97 | |
| 98 | |
| 99 | class Node(metaclass=MetaNode): |