You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Index: src/azul/collections.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================diff --git a/src/azul/collections.py b/src/azul/collections.py--- a/src/azul/collections.py (revision 3c97698e6421dd74eda0b9c2b031825ecdd51254)+++ b/src/azul/collections.py (date 1731976825362)@@ -85,20 +85,27 @@
{}
"""
- def __new__(cls, *dicts: Mapping) -> dict:- return cls.from_iterable(dicts)+ def __new__(cls, *dicts: Mapping, override: bool | None = None) -> dict:+ return cls.from_iterable(dicts, override=override)
@classmethod
- def from_iterable(cls, dicts: Iterable[Mapping], /) -> dict:+ def from_iterable(cls, dicts: Iterable[Mapping], /, override: bool | None = None) -> dict:
merged = {}
for m in dicts:
for k, v2 in m.items():
v1 = merged.setdefault(k, v2)
if v1 != v2:
if isinstance(v1, Mapping) and isinstance(v2, Mapping):
- merged[k] = deep_dict_merge(v1, v2)+ merged[k] = deep_dict_merge(v1, v2, override=override)
else:
- raise ValueError(f'{v1!r} != {v2!r}')+ if override is True:+ merged[k] = v2+ elif override is False:+ pass+ elif override is None:+ raise ValueError(f'{v1!r} != {v2!r}')+ else:+ raise ValueError('Expected boolean or None', override)
return merged
Needs doctests and doc updates.
Also consider eliminating dict_merge and replacing the sole call site with one to deep_dict_merge. Lastly, consider renaming deep_dict_merge to dict_merge.
The text was updated successfully, but these errors were encountered:
Needs doctests and doc updates.
Also consider eliminating
dict_merge
and replacing the sole call site with one todeep_dict_merge
. Lastly, consider renamingdeep_dict_merge
todict_merge
.The text was updated successfully, but these errors were encountered: