From 038341c1f602021861754f1c5a75d4b284192885 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:55:04 +0000 Subject: [PATCH] chore(internal): add type construction helper (#270) --- src/python_intercom/_models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/python_intercom/_models.py b/src/python_intercom/_models.py index eb7ce3bd..5148d5a7 100644 --- a/src/python_intercom/_models.py +++ b/src/python_intercom/_models.py @@ -406,6 +406,15 @@ def build( return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs)) +def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: + """Loose coercion to the expected type with construction of nested values. + + Note: the returned value from this function is not guaranteed to match the + given type. + """ + return cast(_T, construct_type(value=value, type_=type_)) + + def construct_type(*, value: object, type_: object) -> object: """Loose coercion to the expected type with construction of nested values.