Get the __annotate__ function and call it. May not return a fresh dictionary.
(obj, format)
| 1112 | |
| 1113 | |
| 1114 | def _get_and_call_annotate(obj, format): |
| 1115 | """Get the __annotate__ function and call it. |
| 1116 | |
| 1117 | May not return a fresh dictionary. |
| 1118 | """ |
| 1119 | annotate = getattr(obj, "__annotate__", None) |
| 1120 | if annotate is not None: |
| 1121 | ann = call_annotate_function(annotate, format, owner=obj) |
| 1122 | if not isinstance(ann, dict): |
| 1123 | raise ValueError(f"{obj!r}.__annotate__ returned a non-dict") |
| 1124 | return ann |
| 1125 | return None |
| 1126 | |
| 1127 | |
| 1128 | _BASE_GET_ANNOTATIONS = type.__dict__["__annotations__"].__get__ |
no test coverage detected