| 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 |
| 783 | # refers to a shape name as well as any additional |
| 784 | # member traits that are then merged over the shape |
| 785 | # definition. For example: |
| 786 | # {"shape": "StringType", "locationName": "Foobar"} |
| 787 | if len(shape_ref) == 1 and 'shape' in shape_ref: |
| 788 | # It's just a shape ref with no member traits, we can avoid |
| 789 | # a .copy(). This is the common case so it's specifically |
| 790 | # called out here. |
| 791 | return self.get_shape_by_name(shape_ref['shape']) |
| 792 | else: |
| 793 | member_traits = shape_ref.copy() |
| 794 | try: |
| 795 | shape_name = member_traits.pop('shape') |
| 796 | except KeyError: |
| 797 | raise InvalidShapeReferenceError( |
| 798 | f"Invalid model, missing shape reference: {shape_ref}" |
| 799 | ) |
| 800 | return self.get_shape_by_name(shape_name, member_traits) |
| 801 | |
| 802 | |
| 803 | class UnresolvableShapeMap: |