From 231018927bdf7fa4773b732ab63a547a356ce941 Mon Sep 17 00:00:00 2001 From: Alessandro De Maria Date: Fri, 29 Mar 2024 13:17:16 +0000 Subject: [PATCH] Fix warnings --- kadet/__init__.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kadet/__init__.py b/kadet/__init__.py index cb47e79..413d06f 100644 --- a/kadet/__init__.py +++ b/kadet/__init__.py @@ -5,9 +5,11 @@ import hashlib import json from typing import Annotated + import yaml from box import Box, BoxList -from pydantic import BaseModel as PydanticBaseModel, Field +from pydantic import BaseModel as PydanticBaseModel +from pydantic import Field from typeguard import check_type ABORT_EXCEPTION_TYPE = ValueError @@ -194,6 +196,11 @@ def sha256(self): class BaseModel(PydanticBaseModel): root: Annotated[Dict, Field(repr=False)] = Dict() + model_config: Dict = { + # https://docs.pydantic.dev/latest/migration/#changes-to-config + "arbitrary_types_allowed": True, + "extra": "allow", + } def __init__(self, **data): super().__init__(**data) @@ -250,9 +257,3 @@ def _dump(self, obj): def dump(self): """Return object dict/list.""" return self._dump(self) - - class Config: - arbitrary_types_allowed = True # allow all types e.g. BaseObj - copy_on_model_validation = False # performance? - underscore_attrs_are_private = True - extra = "allow"