Convert a value to a tagged representation if necessary.
(self, value: t.Any)
| 287 | self.order.insert(index, tag) |
| 288 | |
| 289 | def tag(self, value: t.Any) -> t.Any: |
| 290 | """Convert a value to a tagged representation if necessary.""" |
| 291 | for tag in self.order: |
| 292 | if tag.check(value): |
| 293 | return tag.tag(value) |
| 294 | |
| 295 | return value |
| 296 | |
| 297 | def untag(self, value: dict[str, t.Any]) -> t.Any: |
| 298 | """Convert a tagged representation back to the original type.""" |