From 5affd69a62a4dfdc9344b5181568bcd89cfc4c42 Mon Sep 17 00:00:00 2001 From: EspenAlbert Date: Wed, 7 Feb 2024 09:15:08 +0700 Subject: [PATCH] fix: avoid deprecation warning pydantic Extra --- model_lib/src/model_lib/model_base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/model_lib/src/model_lib/model_base.py b/model_lib/src/model_lib/model_base.py index 67fa1a9..79c1248 100644 --- a/model_lib/src/model_lib/model_base.py +++ b/model_lib/src/model_lib/model_base.py @@ -3,7 +3,7 @@ from functools import cached_property from typing import Generic, Iterable, List, Sequence, Type, TypeVar -from pydantic import BaseModel, ConfigDict, Extra +from pydantic import BaseModel, ConfigDict from model_lib.errors import ClsNameAlreadyExist, UnknownModelError from model_lib.pydantic_utils import IS_PYDANTIC_V2, model_dump @@ -31,7 +31,7 @@ class _Model(BaseModel): if IS_PYDANTIC_V2: model_config = ConfigDict( # type: ignore use_enum_values=True, - extra=Extra.allow, + extra="allow", arbitrary_types_allowed=True, populate_by_name=True, ) @@ -39,7 +39,7 @@ class _Model(BaseModel): class Config: use_enum_values = True - extra = Extra.allow + extra = "allow" arbitrary_types_allowed = True keep_untouched = (cached_property, Exception) allow_population_by_field_name = True