Setup descriptor instance on the class This sets the :attr:`this_class` and :attr:`name` attributes of each BaseDescriptor in the class dict of the newly created ``cls`` before calling their :attr:`class_init` method.
(cls: MetaHasDescriptors, classdict: dict[str, t.Any])
| 989 | cls.setup_class(classdict) |
| 990 | |
| 991 | def setup_class(cls: MetaHasDescriptors, classdict: dict[str, t.Any]) -> None: |
| 992 | """Setup descriptor instance on the class |
| 993 | |
| 994 | This sets the :attr:`this_class` and :attr:`name` attributes of each |
| 995 | BaseDescriptor in the class dict of the newly created ``cls`` before |
| 996 | calling their :attr:`class_init` method. |
| 997 | """ |
| 998 | cls._descriptors = [] |
| 999 | cls._instance_inits: list[t.Any] = [] |
| 1000 | for k, v in classdict.items(): |
| 1001 | if isinstance(v, BaseDescriptor): |
| 1002 | v.class_init(cls, k) # type:ignore[arg-type] |
| 1003 | |
| 1004 | for _, v in getmembers(cls): |
| 1005 | if isinstance(v, BaseDescriptor): |
| 1006 | v.subclass_init(cls) # type:ignore[arg-type] |
| 1007 | cls._descriptors.append(v) |
| 1008 | |
| 1009 | |
| 1010 | class MetaHasTraits(MetaHasDescriptors): |
nothing calls this directly
no test coverage detected