Create the HasDescriptors class.
(
mcls: type[MetaHasDescriptors],
name: str,
bases: tuple[type, ...],
classdict: dict[str, t.Any],
**kwds: t.Any,
)
| 958 | """ |
| 959 | |
| 960 | def __new__( |
| 961 | mcls: type[MetaHasDescriptors], |
| 962 | name: str, |
| 963 | bases: tuple[type, ...], |
| 964 | classdict: dict[str, t.Any], |
| 965 | **kwds: t.Any, |
| 966 | ) -> MetaHasDescriptors: |
| 967 | """Create the HasDescriptors class.""" |
| 968 | for k, v in classdict.items(): |
| 969 | # ---------------------------------------------------------------- |
| 970 | # Support of deprecated behavior allowing for TraitType types |
| 971 | # to be used instead of TraitType instances. |
| 972 | if inspect.isclass(v) and issubclass(v, TraitType): |
| 973 | warn( |
| 974 | "Traits should be given as instances, not types (for example, `Int()`, not `Int`)." |
| 975 | " Passing types is deprecated in traitlets 4.1.", |
| 976 | DeprecationWarning, |
| 977 | stacklevel=2, |
| 978 | ) |
| 979 | classdict[k] = v() |
| 980 | # ---------------------------------------------------------------- |
| 981 | |
| 982 | return super().__new__(mcls, name, bases, classdict, **kwds) |
| 983 | |
| 984 | def __init__( |
| 985 | cls, name: str, bases: tuple[type, ...], classdict: dict[str, t.Any], **kwds: t.Any |