Code Duplication    Length = 35-35 lines in 2 locations

src/ocrd_models/ocrd_page_generateds.py 2 locations

@@ 7554-7588 (lines=35) @@
7551
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
7552
            self.buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
7553
        return self
7554
    def buildAttributes(self, node, attrs, already_processed):
7555
        value = find_attr_value_('id', node)
7556
        if value is not None and 'id' not in already_processed:
7557
            already_processed.add('id')
7558
            self.id = value
7559
        value = find_attr_value_('regionRef', node)
7560
        if value is not None and 'regionRef' not in already_processed:
7561
            already_processed.add('regionRef')
7562
            self.regionRef = value
7563
        value = find_attr_value_('caption', node)
7564
        if value is not None and 'caption' not in already_processed:
7565
            already_processed.add('caption')
7566
            self.caption = value
7567
        value = find_attr_value_('type', node)
7568
        if value is not None and 'type' not in already_processed:
7569
            already_processed.add('type')
7570
            self.type_ = value
7571
            self.validate_GroupTypeSimpleType(self.type_)    # validate type GroupTypeSimpleType
7572
        value = find_attr_value_('continuation', node)
7573
        if value is not None and 'continuation' not in already_processed:
7574
            already_processed.add('continuation')
7575
            if value in ('true', '1'):
7576
                self.continuation = True
7577
            elif value in ('false', '0'):
7578
                self.continuation = False
7579
            else:
7580
                raise_parse_error(node, 'Bad boolean attribute')
7581
        value = find_attr_value_('custom', node)
7582
        if value is not None and 'custom' not in already_processed:
7583
            already_processed.add('custom')
7584
            self.custom = value
7585
        value = find_attr_value_('comments', node)
7586
        if value is not None and 'comments' not in already_processed:
7587
            already_processed.add('comments')
7588
            self.comments = value
7589
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
7590
        if nodeName_ == 'UserDefined':
7591
            obj_ = UserDefinedType.factory(parent_object_=self)
@@ 7102-7136 (lines=35) @@
7099
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
7100
            self.buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
7101
        return self
7102
    def buildAttributes(self, node, attrs, already_processed):
7103
        value = find_attr_value_('id', node)
7104
        if value is not None and 'id' not in already_processed:
7105
            already_processed.add('id')
7106
            self.id = value
7107
        value = find_attr_value_('regionRef', node)
7108
        if value is not None and 'regionRef' not in already_processed:
7109
            already_processed.add('regionRef')
7110
            self.regionRef = value
7111
        value = find_attr_value_('caption', node)
7112
        if value is not None and 'caption' not in already_processed:
7113
            already_processed.add('caption')
7114
            self.caption = value
7115
        value = find_attr_value_('type', node)
7116
        if value is not None and 'type' not in already_processed:
7117
            already_processed.add('type')
7118
            self.type_ = value
7119
            self.validate_GroupTypeSimpleType(self.type_)    # validate type GroupTypeSimpleType
7120
        value = find_attr_value_('continuation', node)
7121
        if value is not None and 'continuation' not in already_processed:
7122
            already_processed.add('continuation')
7123
            if value in ('true', '1'):
7124
                self.continuation = True
7125
            elif value in ('false', '0'):
7126
                self.continuation = False
7127
            else:
7128
                raise_parse_error(node, 'Bad boolean attribute')
7129
        value = find_attr_value_('custom', node)
7130
        if value is not None and 'custom' not in already_processed:
7131
            already_processed.add('custom')
7132
            self.custom = value
7133
        value = find_attr_value_('comments', node)
7134
        if value is not None and 'comments' not in already_processed:
7135
            already_processed.add('comments')
7136
            self.comments = value
7137
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
7138
        if nodeName_ == 'UserDefined':
7139
            obj_ = UserDefinedType.factory(parent_object_=self)