Skip to content

Commit 31b8ff1

Browse files
committed
[section] Add merge 'strict' param
Closes #270
1 parent 1ed148d commit 31b8ff1

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

odml/section.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,19 @@ def contains(self, obj):
399399
raise ValueError("odml.Section.contains:"
400400
"Section or Property object expected.")
401401

402-
def merge(self, section=None):
402+
def merge(self, section=None, strict=True):
403403
"""
404-
Merges this section with another *section*
404+
Merges this section with another *section*.
405405
See also: :py:attr:`odml.section.BaseSection.link`
406406
If section is none, sets the link/include attribute (if _link or
407407
_include are set), causing the section to be automatically merged
408408
to the referenced section.
409+
410+
:param section: an odML Section. If section is None, *link* or *include*
411+
will be resolved instead.
412+
:param strict: Bool value to indicate whether the attributes of affected
413+
child Properties except their ids and values have to be identical
414+
to be merged. Default is True.
409415
"""
410416
if section is None:
411417
# for the high level interface
@@ -418,7 +424,7 @@ def merge(self, section=None):
418424
for obj in section:
419425
mine = self.contains(obj)
420426
if mine is not None:
421-
mine.merge(obj)
427+
mine.merge(obj, strict)
422428
else:
423429
mine = obj.clone()
424430
mine._merged = obj

0 commit comments

Comments
 (0)