|
10 | 10 | from abc import ABC, abstractmethod
|
11 | 11 | from argparse import SUPPRESS, ArgumentParser, HelpFormatter, Namespace, _SubParsersAction
|
12 | 12 | from collections import deque
|
13 |
| -from dataclasses import asdict, is_dataclass |
| 13 | +from dataclasses import is_dataclass |
14 | 14 | from enum import Enum
|
15 | 15 | from pathlib import Path
|
16 | 16 | from types import FunctionType
|
@@ -265,12 +265,7 @@ def _get_defaults(self, settings_cls: type[BaseSettings]) -> dict[str, Any]:
|
265 | 265 | if field_info.validate_default is not False:
|
266 | 266 | resolved_name = self._get_resolved_name(field_name, field_info)
|
267 | 267 | 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 |
274 | 269 | elif field_info.default_factory is not None:
|
275 | 270 | defaults[resolved_name] = field_info.default_factory
|
276 | 271 | return defaults
|
@@ -311,7 +306,7 @@ def __call__(self) -> dict[str, Any]:
|
311 | 306 | return self.defaults
|
312 | 307 |
|
313 | 308 | def __repr__(self) -> str:
|
314 |
| - return f'DefaultSettingsSource()' |
| 309 | + return 'DefaultSettingsSource()' |
315 | 310 |
|
316 | 311 |
|
317 | 312 | class InitSettingsSource(PydanticBaseSettingsSource):
|
|
0 commit comments