Code Duplication    Length = 35-35 lines in 2 locations

src/ocrd_models/ocrd_page_generateds.py 2 locations

@@ 8384-8418 (lines=35) @@
8381
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
8382
            self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
8383
        return self
8384
    def _buildAttributes(self, node, attrs, already_processed):
8385
        value = find_attr_value_('id', node)
8386
        if value is not None and 'id' not in already_processed:
8387
            already_processed.add('id')
8388
            self.id = value
8389
        value = find_attr_value_('regionRef', node)
8390
        if value is not None and 'regionRef' not in already_processed:
8391
            already_processed.add('regionRef')
8392
            self.regionRef = value
8393
        value = find_attr_value_('caption', node)
8394
        if value is not None and 'caption' not in already_processed:
8395
            already_processed.add('caption')
8396
            self.caption = value
8397
        value = find_attr_value_('type', node)
8398
        if value is not None and 'type' not in already_processed:
8399
            already_processed.add('type')
8400
            self.type_ = value
8401
            self.validate_GroupTypeSimpleType(self.type_)    # validate type GroupTypeSimpleType
8402
        value = find_attr_value_('continuation', node)
8403
        if value is not None and 'continuation' not in already_processed:
8404
            already_processed.add('continuation')
8405
            if value in ('true', '1'):
8406
                self.continuation = True
8407
            elif value in ('false', '0'):
8408
                self.continuation = False
8409
            else:
8410
                raise_parse_error(node, 'Bad boolean attribute')
8411
        value = find_attr_value_('custom', node)
8412
        if value is not None and 'custom' not in already_processed:
8413
            already_processed.add('custom')
8414
            self.custom = value
8415
        value = find_attr_value_('comments', node)
8416
        if value is not None and 'comments' not in already_processed:
8417
            already_processed.add('comments')
8418
            self.comments = value
8419
    def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
8420
        if nodeName_ == 'UserDefined':
8421
            obj_ = UserDefinedType.factory(parent_object_=self)
@@ 7916-7950 (lines=35) @@
7913
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
7914
            self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
7915
        return self
7916
    def _buildAttributes(self, node, attrs, already_processed):
7917
        value = find_attr_value_('id', node)
7918
        if value is not None and 'id' not in already_processed:
7919
            already_processed.add('id')
7920
            self.id = value
7921
        value = find_attr_value_('regionRef', node)
7922
        if value is not None and 'regionRef' not in already_processed:
7923
            already_processed.add('regionRef')
7924
            self.regionRef = value
7925
        value = find_attr_value_('caption', node)
7926
        if value is not None and 'caption' not in already_processed:
7927
            already_processed.add('caption')
7928
            self.caption = value
7929
        value = find_attr_value_('type', node)
7930
        if value is not None and 'type' not in already_processed:
7931
            already_processed.add('type')
7932
            self.type_ = value
7933
            self.validate_GroupTypeSimpleType(self.type_)    # validate type GroupTypeSimpleType
7934
        value = find_attr_value_('continuation', node)
7935
        if value is not None and 'continuation' not in already_processed:
7936
            already_processed.add('continuation')
7937
            if value in ('true', '1'):
7938
                self.continuation = True
7939
            elif value in ('false', '0'):
7940
                self.continuation = False
7941
            else:
7942
                raise_parse_error(node, 'Bad boolean attribute')
7943
        value = find_attr_value_('custom', node)
7944
        if value is not None and 'custom' not in already_processed:
7945
            already_processed.add('custom')
7946
            self.custom = value
7947
        value = find_attr_value_('comments', node)
7948
        if value is not None and 'comments' not in already_processed:
7949
            already_processed.add('comments')
7950
            self.comments = value
7951
    def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
7952
        if nodeName_ == 'UserDefined':
7953
            obj_ = UserDefinedType.factory(parent_object_=self)