From 2abe7dfe6e1bd6767e304ee5e7bd1eb1e4306621 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Mon, 25 Mar 2024 13:58:30 +0000 Subject: [PATCH] feat(api): update via SDK Studio --- 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)