Code Duplication    Length = 35-35 lines in 2 locations

src/ocrd_models/ocrd_page_generateds.py 2 locations

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