| 159 | kind: str |
| 160 | |
| 161 | def __init__(cls, name: str, bases: tuple, dict_: dict[str, Any]) -> None: |
| 162 | super().__init__(name, bases, dict_) |
| 163 | |
| 164 | kind = dict_.get("kind") |
| 165 | itemsize = dict_.get("itemsize") |
| 166 | type_ = dict_.get("type") |
| 167 | deftype = dict_.get("_deftype") |
| 168 | |
| 169 | if kind and deftype: |
| 170 | deftype_from_kind[kind] = deftype |
| 171 | |
| 172 | if type_: |
| 173 | all_types.add(type_) |
| 174 | |
| 175 | if kind and itemsize and not hasattr(itemsize, "__int__"): |
| 176 | # Atom classes with a non-fixed item size do have an |
| 177 | # ``itemsize``, but it's not a number (e.g. property). |
| 178 | atom_map[kind] = cls |
| 179 | return |
| 180 | |
| 181 | if kind: # first definition of kind, make new entry |
| 182 | atom_map[kind] = {} |
| 183 | |
| 184 | if itemsize and hasattr(itemsize, "__int__"): # fixed |
| 185 | kind = cls.kind # maybe from superclasses |
| 186 | atom_map[kind][int(itemsize)] = cls |
| 187 | |
| 188 | |
| 189 | class Atom(metaclass=MetaAtom): |