Code Duplication    Length = 37-37 lines in 2 locations

src/ocrd_models/ocrd_page_generateds.py 2 locations

@@ 7385-7421 (lines=37) @@
7382
        for UnorderedGroup_ in self.UnorderedGroup:
7383
            namespaceprefix_ = self.UnorderedGroup_nsprefix_ + ':' if (UseCapturedNS_ and self.UnorderedGroup_nsprefix_) else ''
7384
            UnorderedGroup_.export(outfile, level, namespaceprefix_, namespacedef_='', name_='UnorderedGroup', pretty_print=pretty_print)
7385
    def to_etree(self, parent_element=None, name_='UnorderedGroupIndexedType', mapping_=None, reverse_mapping_=None, nsmap_=None):
7386
        if parent_element is None:
7387
            element = etree_.Element('{http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15}' + name_, nsmap=nsmap_)
7388
        else:
7389
            element = etree_.SubElement(parent_element, '{http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15}' + name_, nsmap=nsmap_)
7390
        if self.id is not None:
7391
            element.set('id', self.gds_format_string(self.id))
7392
        if self.regionRef is not None:
7393
            element.set('regionRef', self.gds_format_string(self.regionRef))
7394
        if self.index is not None:
7395
            element.set('index', self.gds_format_integer(self.index))
7396
        if self.caption is not None:
7397
            element.set('caption', self.gds_format_string(self.caption))
7398
        if self.type_ is not None:
7399
            element.set('type', self.gds_format_string(self.type_))
7400
        if self.continuation is not None:
7401
            element.set('continuation', self.gds_format_boolean(self.continuation))
7402
        if self.custom is not None:
7403
            element.set('custom', self.gds_format_string(self.custom))
7404
        if self.comments is not None:
7405
            element.set('comments', self.gds_format_string(self.comments))
7406
        if self.UserDefined is not None:
7407
            UserDefined_ = self.UserDefined
7408
            UserDefined_.to_etree(element, name_='UserDefined', mapping_=mapping_, reverse_mapping_=reverse_mapping_, nsmap_=nsmap_)
7409
        for Labels_ in self.Labels:
7410
            Labels_.to_etree(element, name_='Labels', mapping_=mapping_, reverse_mapping_=reverse_mapping_, nsmap_=nsmap_)
7411
        for RegionRef_ in self.RegionRef:
7412
            RegionRef_.to_etree(element, name_='RegionRef', mapping_=mapping_, reverse_mapping_=reverse_mapping_, nsmap_=nsmap_)
7413
        for OrderedGroup_ in self.OrderedGroup:
7414
            OrderedGroup_.to_etree(element, name_='OrderedGroup', mapping_=mapping_, reverse_mapping_=reverse_mapping_, nsmap_=nsmap_)
7415
        for UnorderedGroup_ in self.UnorderedGroup:
7416
            UnorderedGroup_.to_etree(element, name_='UnorderedGroup', mapping_=mapping_, reverse_mapping_=reverse_mapping_, nsmap_=nsmap_)
7417
        if mapping_ is not None:
7418
            mapping_[id(self)] = element
7419
        if reverse_mapping_ is not None:
7420
            reverse_mapping_[element] = self
7421
        return element
7422
    def build(self, node, gds_collector_=None):
7423
        self.gds_collector_ = gds_collector_
7424
        if SaveElementTreeNode:
@@ 6897-6933 (lines=37) @@
6894
        for UnorderedGroupIndexed_ in self.UnorderedGroupIndexed:
6895
            namespaceprefix_ = self.UnorderedGroupIndexed_nsprefix_ + ':' if (UseCapturedNS_ and self.UnorderedGroupIndexed_nsprefix_) else ''
6896
            UnorderedGroupIndexed_.export(outfile, level, namespaceprefix_, namespacedef_='', name_='UnorderedGroupIndexed', pretty_print=pretty_print)
6897
    def to_etree(self, parent_element=None, name_='OrderedGroupIndexedType', mapping_=None, reverse_mapping_=None, nsmap_=None):
6898
        if parent_element is None:
6899
            element = etree_.Element('{http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15}' + name_, nsmap=nsmap_)
6900
        else:
6901
            element = etree_.SubElement(parent_element, '{http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15}' + name_, nsmap=nsmap_)
6902
        if self.id is not None:
6903
            element.set('id', self.gds_format_string(self.id))
6904
        if self.regionRef is not None:
6905
            element.set('regionRef', self.gds_format_string(self.regionRef))
6906
        if self.index is not None:
6907
            element.set('index', self.gds_format_integer(self.index))
6908
        if self.caption is not None:
6909
            element.set('caption', self.gds_format_string(self.caption))
6910
        if self.type_ is not None:
6911
            element.set('type', self.gds_format_string(self.type_))
6912
        if self.continuation is not None:
6913
            element.set('continuation', self.gds_format_boolean(self.continuation))
6914
        if self.custom is not None:
6915
            element.set('custom', self.gds_format_string(self.custom))
6916
        if self.comments is not None:
6917
            element.set('comments', self.gds_format_string(self.comments))
6918
        if self.UserDefined is not None:
6919
            UserDefined_ = self.UserDefined
6920
            UserDefined_.to_etree(element, name_='UserDefined', mapping_=mapping_, reverse_mapping_=reverse_mapping_, nsmap_=nsmap_)
6921
        for Labels_ in self.Labels:
6922
            Labels_.to_etree(element, name_='Labels', mapping_=mapping_, reverse_mapping_=reverse_mapping_, nsmap_=nsmap_)
6923
        for RegionRefIndexed_ in self.RegionRefIndexed:
6924
            RegionRefIndexed_.to_etree(element, name_='RegionRefIndexed', mapping_=mapping_, reverse_mapping_=reverse_mapping_, nsmap_=nsmap_)
6925
        for OrderedGroupIndexed_ in self.OrderedGroupIndexed:
6926
            OrderedGroupIndexed_.to_etree(element, name_='OrderedGroupIndexed', mapping_=mapping_, reverse_mapping_=reverse_mapping_, nsmap_=nsmap_)
6927
        for UnorderedGroupIndexed_ in self.UnorderedGroupIndexed:
6928
            UnorderedGroupIndexed_.to_etree(element, name_='UnorderedGroupIndexed', mapping_=mapping_, reverse_mapping_=reverse_mapping_, nsmap_=nsmap_)
6929
        if mapping_ is not None:
6930
            mapping_[id(self)] = element
6931
        if reverse_mapping_ is not None:
6932
            reverse_mapping_[element] = self
6933
        return element
6934
    def build(self, node, gds_collector_=None):
6935
        self.gds_collector_ = gds_collector_
6936
        if SaveElementTreeNode: