@@ -30,9 +30,12 @@ except ImportError:
3030 yaml = None
3131
3232try :
33- import pydantic
33+ from pydantic_settings import BaseSettings as PydanticSettings
3434except ImportError :
35- pydantic = None
35+ try :
36+ from pydantic import BaseSettings as PydanticSettings
37+ except ImportError :
38+ PydanticSettings = Any
3639
3740from . import resources
3841
@@ -272,7 +275,7 @@ class Configuration(Object[Any]):
272275 ini_files : Optional [_Iterable [Union [Path , str ]]] = None ,
273276 yaml_files : Optional [_Iterable [Union [Path , str ]]] = None ,
274277 json_files : Optional [_Iterable [Union [Path , str ]]] = None ,
275- pydantic_settings : Optional [_Iterable [PydanticSettings ]] = None ,
278+ pydantic_settings : Optional [_Iterable [Union [ PydanticSettings , Type [ PydanticSettings ]] ]] = None ,
276279 ) -> None : ...
277280 def __enter__ (self ) -> _Self : ...
278281 def __exit__ (self , * exc_info : Any ) -> None : ...
@@ -292,8 +295,8 @@ class Configuration(Object[Any]):
292295 def set_yaml_files (self , files : _Iterable [Union [Path , str ]]) -> _Self : ...
293296 def get_json_files (self ) -> _List [Union [Path , str ]]: ...
294297 def set_json_files (self , files : _Iterable [Union [Path , str ]]) -> _Self : ...
295- def get_pydantic_settings (self ) -> _List [PydanticSettings ]: ...
296- def set_pydantic_settings (self , settings : _Iterable [PydanticSettings ]) -> _Self : ...
298+ def get_pydantic_settings (self ) -> _List [Union [ PydanticSettings , Type [ PydanticSettings ]] ]: ...
299+ def set_pydantic_settings (self , settings : _Iterable [Union [ PydanticSettings , Type [ PydanticSettings ]] ]) -> _Self : ...
297300 def load (self , required : bool = False , envs_required : bool = False ) -> None : ...
298301 def get (self , selector : str ) -> Any : ...
299302 def set (self , selector : str , value : Any ) -> OverridingContext [P ]: ...
@@ -319,7 +322,7 @@ class Configuration(Object[Any]):
319322 envs_required : bool = False ,
320323 ) -> None : ...
321324 def from_pydantic (
322- self , settings : PydanticSettings , required : bool = False , ** kwargs : Any
325+ self , settings : Union [ PydanticSettings , Type [ PydanticSettings ]] , required : bool = False , ** kwargs : Any
323326 ) -> None : ...
324327 def from_dict (self , options : _Dict [str , Any ], required : bool = False ) -> None : ...
325328 def from_env (
@@ -630,8 +633,3 @@ if yaml:
630633
631634else :
632635 class YamlLoader : ...
633-
634- if pydantic :
635- PydanticSettings = pydantic .BaseSettings
636- else :
637- PydanticSettings = Any
0 commit comments