Docs: Add global example documentation.

* merge_models: Use deecopy to not change input data.
This commit is contained in:
Dominique Lasserre
2025-01-20 23:39:43 +01:00
parent c1dd31528b
commit 5bd8321e95
3 changed files with 152 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ Key Features:
import json
import re
from copy import deepcopy
from typing import Any, Dict, List, Optional, Type, Union
from zoneinfo import ZoneInfo
@@ -45,7 +46,7 @@ def merge_models(source: BaseModel, update_dict: dict[str, Any]) -> dict[str, An
return update_dict
source_dict = source.model_dump(exclude_unset=True)
merged_dict = deep_update(source_dict, update_dict)
merged_dict = deep_update(source_dict, deepcopy(update_dict))
return merged_dict