Skip to content

Commit aeafcc1

Browse files
committed
[section] Refactor merge strict policy
1 parent a8c49e7 commit aeafcc1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

odml/section.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,18 +410,18 @@ def merge_check(self, source_section, strict=True):
410410
the Section attributes definition and reference differ in source and destination.
411411
412412
:param source_section: an odML Section.
413-
:param strict: If strict is True, the dtypes of same named Properties on the same
414-
tree level in source and destination have to be identical to pass
415-
the check.
413+
:param strict: If True, definition and reference attributes of any merged Sections
414+
as well as most attributes of merged Properties on the same
415+
tree level in source and destination have to be identical.
416416
"""
417-
if self.definition is not None and source_section.definition is not None:
417+
if strict and self.definition is not None and source_section.definition is not None:
418418
self_def = ''.join(map(str.strip, self.definition.split())).lower()
419419
other_def = ''.join(map(str.strip, source_section.definition.split())).lower()
420420
if self_def != other_def:
421421
raise ValueError(
422422
"odml.Section.merge: src and dest definitions do not match!")
423423

424-
if self.reference is not None and source_section.reference is not None:
424+
if strict and self.reference is not None and source_section.reference is not None:
425425
self_ref = ''.join(map(str.strip, self.reference.lower().split()))
426426
other_ref = ''.join(map(str.strip, source_section.reference.lower().split()))
427427
if self_ref != other_ref:

0 commit comments

Comments
 (0)