Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pydantic_settings/sources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,11 @@ class Settings(BaseSettings):
values[name] = value
continue

if _lenient_issubclass(sub_model_field.annotation, BaseModel) and isinstance(value, dict):
if (
sub_model_field is not None
and _lenient_issubclass(sub_model_field.annotation, BaseModel)
and isinstance(value, dict)
):
values[field_key] = self._replace_field_names_case_insensitively(sub_model_field, value)
else:
values[field_key] = value
Expand Down
2 changes: 1 addition & 1 deletion pydantic_settings/sources/providers/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def parse_args_insensitive_method(
if matched:
arg = matched.group(1).lower() + matched.group(2)
insensitive_args.append(arg)
return parser_method(root_parser, insensitive_args, namespace) # type: ignore
return parser_method(root_parser, insensitive_args, namespace)

return parse_args_insensitive_method

Expand Down
Loading