From dedb9e69f74615857df211d0b00d90d38f449e30 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 13:58:37 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#174) --- src/cloudflare/_models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cloudflare/_models.py b/src/cloudflare/_models.py index 35a23a95cce..77c755b1358 100644 --- a/src/cloudflare/_models.py +++ b/src/cloudflare/_models.py @@ -538,12 +538,14 @@ class GenericModel(BaseGenericModel, BaseModel): if PYDANTIC_V2: + from pydantic import TypeAdapter as _TypeAdapter + + _CachedTypeAdapter = cast("TypeAdapter[object]", lru_cache(maxsize=None)(_TypeAdapter)) + if TYPE_CHECKING: from pydantic import TypeAdapter else: - from pydantic import TypeAdapter as _TypeAdapter - - TypeAdapter = lru_cache(_TypeAdapter) + TypeAdapter = _CachedTypeAdapter def _validate_non_model_type(*, type_: type[_T], value: object) -> _T: return TypeAdapter(type_).validate_python(value)