Skip to content

Commit

Permalink
fix: avoid deprecation warning pydantic Extra
Browse files Browse the repository at this point in the history
  • Loading branch information
EspenAlbert committed Feb 7, 2024
1 parent 74bec1d commit 5affd69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions model_lib/src/model_lib/model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -31,15 +31,15 @@ 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,
)
else:

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
Expand Down

0 comments on commit 5affd69

Please sign in to comment.