Code Duplication    Length = 11-11 lines in 2 locations

src/ocrd_page_user_methods/get_AllRegions.py 1 location

@@ 31-41 (lines=11) @@
28
        ret += self._get_recursive_regions(more, level - 1 if level else 0, classes)
29
    return self._get_recursive_regions(ret, 1, classes)
30
31
def _get_recursive_reading_order(self, rogroup):
32
    if isinstance(rogroup, (OrderedGroupType, OrderedGroupIndexedType)): # pylint: disable=undefined-variable
33
        elements = rogroup.get_AllIndexed()
34
    if isinstance(rogroup, (UnorderedGroupType, UnorderedGroupIndexedType)): # pylint: disable=undefined-variable
35
        elements = (rogroup.get_RegionRef() + rogroup.get_OrderedGroup() + rogroup.get_UnorderedGroup())
36
    regionrefs = list()
37
    for elem in elements:
38
        regionrefs.append(elem.get_regionRef())
39
        if not isinstance(elem, (RegionRefType, RegionRefIndexedType)): # pylint: disable=undefined-variable
40
            regionrefs.extend(self._get_recursive_reading_order(elem))
41
    return regionrefs
42
43
def get_AllRegions(self, classes=None, order='document', depth=0):
44
    """

src/ocrd_models/ocrd_page_generateds.py 1 location

@@ 3754-3764 (lines=11) @@
3751
            ret += self._get_recursive_regions(more, level - 1 if level else 0, classes)
3752
        return self._get_recursive_regions(ret, 1, classes)
3753
    
3754
    def _get_recursive_reading_order(self, rogroup):
3755
        if isinstance(rogroup, (OrderedGroupType, OrderedGroupIndexedType)): # pylint: disable=undefined-variable
3756
            elements = rogroup.get_AllIndexed()
3757
        if isinstance(rogroup, (UnorderedGroupType, UnorderedGroupIndexedType)): # pylint: disable=undefined-variable
3758
            elements = (rogroup.get_RegionRef() + rogroup.get_OrderedGroup() + rogroup.get_UnorderedGroup())
3759
        regionrefs = list()
3760
        for elem in elements:
3761
            regionrefs.append(elem.get_regionRef())
3762
            if not isinstance(elem, (RegionRefType, RegionRefIndexedType)): # pylint: disable=undefined-variable
3763
                regionrefs.extend(self._get_recursive_reading_order(elem))
3764
        return regionrefs
3765
    
3766
    def get_AllRegions(self, classes=None, order='document', depth=0):
3767
        """