Skip to content

Commit 2bc7445

Browse files
authored
Merge pull request #663 from mickvangelderen/mick/simplify-extract-from-with-tagging
Simplify _extract_from_with_tagging
2 parents 9a1968d + 2b7c714 commit 2bc7445

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

serde/core.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,10 @@ def deserialize_union(self, cls: type[T], data: Any) -> T:
218218

219219

220220
def _extract_from_with_tagging(maybe_with_tagging: Any) -> tuple[Any, Tagging]:
221-
try:
222-
if isinstance(maybe_with_tagging, _WithTagging):
223-
union_cls = maybe_with_tagging.inner
224-
tagging = maybe_with_tagging.tagging
225-
else:
226-
raise Exception()
227-
except Exception:
228-
union_cls = maybe_with_tagging
229-
tagging = ExternalTagging
230-
231-
return (union_cls, tagging)
221+
if isinstance(maybe_with_tagging, _WithTagging):
222+
return maybe_with_tagging.inner, maybe_with_tagging.tagging
223+
else:
224+
return maybe_with_tagging, ExternalTagging
232225

233226

234227
CACHE = Cache()

0 commit comments

Comments
 (0)