Iteratively build *one* class.
| 643 | |
| 644 | |
| 645 | class _ClassBuilder: |
| 646 | """ |
| 647 | Iteratively build *one* class. |
| 648 | """ |
| 649 | |
| 650 | __slots__ = ( |
| 651 | "_add_method_dunders", |
| 652 | "_attr_names", |
| 653 | "_attrs", |
| 654 | "_base_attr_map", |
| 655 | "_base_names", |
| 656 | "_cache_hash", |
| 657 | "_cls", |
| 658 | "_cls_dict", |
| 659 | "_delete_attribs", |
| 660 | "_frozen", |
| 661 | "_has_custom_setattr", |
| 662 | "_has_post_init", |
| 663 | "_has_pre_init", |
| 664 | "_is_exc", |
| 665 | "_on_setattr", |
| 666 | "_pre_init_has_args", |
| 667 | "_repr_added", |
| 668 | "_script_snippets", |
| 669 | "_slots", |
| 670 | "_weakref_slot", |
| 671 | "_wrote_own_setattr", |
| 672 | ) |
| 673 | |
| 674 | def __init__( |
| 675 | self, |
| 676 | cls: type, |
| 677 | these, |
| 678 | auto_attribs: bool, |
| 679 | props: ClassProps, |
| 680 | has_custom_setattr: bool, |
| 681 | ): |
| 682 | attrs, base_attrs, base_map = _transform_attrs( |
| 683 | cls, |
| 684 | these, |
| 685 | auto_attribs, |
| 686 | props.kw_only, |
| 687 | props.collected_fields_by_mro, |
| 688 | props.field_transformer, |
| 689 | ) |
| 690 | |
| 691 | self._cls = cls |
| 692 | self._cls_dict = dict(cls.__dict__) if props.is_slotted else {} |
| 693 | self._attrs = attrs |
| 694 | self._base_names = {a.name for a in base_attrs} |
| 695 | self._base_attr_map = base_map |
| 696 | self._attr_names = tuple(a.name for a in attrs) |
| 697 | self._slots = props.is_slotted |
| 698 | self._frozen = props.is_frozen |
| 699 | self._weakref_slot = props.has_weakref_slot |
| 700 | self._cache_hash = ( |
| 701 | props.hashability is ClassProps.Hashability.HASHABLE_CACHED |
| 702 | ) |
no outgoing calls