Convert an annotation dict containing values to approximately the STRING format. Always returns a fresh a dictionary.
(annotations)
| 1091 | |
| 1092 | |
| 1093 | def annotations_to_string(annotations): |
| 1094 | """Convert an annotation dict containing values to approximately the STRING format. |
| 1095 | |
| 1096 | Always returns a fresh a dictionary. |
| 1097 | """ |
| 1098 | return { |
| 1099 | n: t if isinstance(t, str) else type_repr(t) |
| 1100 | for n, t in annotations.items() |
| 1101 | } |
| 1102 | |
| 1103 | |
| 1104 | def _rewrite_star_unpack(arg): |