Skip to content

Commit 0dd8d74

Browse files
committed
Retain default typing.
1 parent 5858176 commit 0dd8d74

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

pydantic_settings/sources.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from abc import ABC, abstractmethod
1111
from argparse import SUPPRESS, ArgumentParser, HelpFormatter, Namespace, _SubParsersAction
1212
from collections import deque
13-
from dataclasses import asdict, is_dataclass
13+
from dataclasses import is_dataclass
1414
from enum import Enum
1515
from pathlib import Path
1616
from types import FunctionType
@@ -265,12 +265,7 @@ def _get_defaults(self, settings_cls: type[BaseSettings]) -> dict[str, Any]:
265265
if field_info.validate_default is not False:
266266
resolved_name = self._get_resolved_name(field_name, field_info)
267267
if field_info.default not in (PydanticUndefined, None):
268-
if is_model_class(field_info.annotation):
269-
defaults[resolved_name] = field_info.default.model_dump()
270-
elif is_dataclass(field_info.annotation):
271-
defaults[resolved_name] = asdict(field_info.default)
272-
else:
273-
defaults[resolved_name] = field_info.default
268+
defaults[resolved_name] = field_info.default
274269
elif field_info.default_factory is not None:
275270
defaults[resolved_name] = field_info.default_factory
276271
return defaults
@@ -311,7 +306,7 @@ def __call__(self) -> dict[str, Any]:
311306
return self.defaults
312307

313308
def __repr__(self) -> str:
314-
return f'DefaultSettingsSource()'
309+
return 'DefaultSettingsSource()'
315310

316311

317312
class InitSettingsSource(PydanticBaseSettingsSource):

0 commit comments

Comments
 (0)