| 762 | self._shape_cache = {} |
| 763 | |
| 764 | def get_shape_by_name(self, shape_name, member_traits=None): |
| 765 | try: |
| 766 | shape_model = self._shape_map[shape_name] |
| 767 | except KeyError: |
| 768 | raise NoShapeFoundError(shape_name) |
| 769 | try: |
| 770 | shape_cls = self.SHAPE_CLASSES.get(shape_model['type'], Shape) |
| 771 | except KeyError: |
| 772 | raise InvalidShapeError( |
| 773 | f"Shape is missing required key 'type': {shape_model}" |
| 774 | ) |
| 775 | if member_traits: |
| 776 | shape_model = shape_model.copy() |
| 777 | shape_model.update(member_traits) |
| 778 | result = shape_cls(shape_name, shape_model, self) |
| 779 | return result |
| 780 | |
| 781 | def resolve_shape_ref(self, shape_ref): |
| 782 | # A shape_ref is a dict that has a 'shape' key that |