Code Duplication    Length = 39-39 lines in 2 locations

src/ocrd_models/ocrd_page_generateds.py 2 locations

@@ 7433-7471 (lines=39) @@
7430
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
7431
            self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
7432
        return self
7433
    def _buildAttributes(self, node, attrs, already_processed):
7434
        value = find_attr_value_('id', node)
7435
        if value is not None and 'id' not in already_processed:
7436
            already_processed.add('id')
7437
            self.id = value
7438
        value = find_attr_value_('regionRef', node)
7439
        if value is not None and 'regionRef' not in already_processed:
7440
            already_processed.add('regionRef')
7441
            self.regionRef = value
7442
        value = find_attr_value_('index', node)
7443
        if value is not None and 'index' not in already_processed:
7444
            already_processed.add('index')
7445
            self.index = self.gds_parse_integer(value, node, 'index')
7446
        value = find_attr_value_('caption', node)
7447
        if value is not None and 'caption' not in already_processed:
7448
            already_processed.add('caption')
7449
            self.caption = value
7450
        value = find_attr_value_('type', node)
7451
        if value is not None and 'type' not in already_processed:
7452
            already_processed.add('type')
7453
            self.type_ = value
7454
            self.validate_GroupTypeSimpleType(self.type_)    # validate type GroupTypeSimpleType
7455
        value = find_attr_value_('continuation', node)
7456
        if value is not None and 'continuation' not in already_processed:
7457
            already_processed.add('continuation')
7458
            if value in ('true', '1'):
7459
                self.continuation = True
7460
            elif value in ('false', '0'):
7461
                self.continuation = False
7462
            else:
7463
                raise_parse_error(node, 'Bad boolean attribute')
7464
        value = find_attr_value_('custom', node)
7465
        if value is not None and 'custom' not in already_processed:
7466
            already_processed.add('custom')
7467
            self.custom = value
7468
        value = find_attr_value_('comments', node)
7469
        if value is not None and 'comments' not in already_processed:
7470
            already_processed.add('comments')
7471
            self.comments = value
7472
    def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
7473
        if nodeName_ == 'UserDefined':
7474
            obj_ = UserDefinedType.factory(parent_object_=self)
@@ 6945-6983 (lines=39) @@
6942
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
6943
            self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
6944
        return self
6945
    def _buildAttributes(self, node, attrs, already_processed):
6946
        value = find_attr_value_('id', node)
6947
        if value is not None and 'id' not in already_processed:
6948
            already_processed.add('id')
6949
            self.id = value
6950
        value = find_attr_value_('regionRef', node)
6951
        if value is not None and 'regionRef' not in already_processed:
6952
            already_processed.add('regionRef')
6953
            self.regionRef = value
6954
        value = find_attr_value_('index', node)
6955
        if value is not None and 'index' not in already_processed:
6956
            already_processed.add('index')
6957
            self.index = self.gds_parse_integer(value, node, 'index')
6958
        value = find_attr_value_('caption', node)
6959
        if value is not None and 'caption' not in already_processed:
6960
            already_processed.add('caption')
6961
            self.caption = value
6962
        value = find_attr_value_('type', node)
6963
        if value is not None and 'type' not in already_processed:
6964
            already_processed.add('type')
6965
            self.type_ = value
6966
            self.validate_GroupTypeSimpleType(self.type_)    # validate type GroupTypeSimpleType
6967
        value = find_attr_value_('continuation', node)
6968
        if value is not None and 'continuation' not in already_processed:
6969
            already_processed.add('continuation')
6970
            if value in ('true', '1'):
6971
                self.continuation = True
6972
            elif value in ('false', '0'):
6973
                self.continuation = False
6974
            else:
6975
                raise_parse_error(node, 'Bad boolean attribute')
6976
        value = find_attr_value_('custom', node)
6977
        if value is not None and 'custom' not in already_processed:
6978
            already_processed.add('custom')
6979
            self.custom = value
6980
        value = find_attr_value_('comments', node)
6981
        if value is not None and 'comments' not in already_processed:
6982
            already_processed.add('comments')
6983
            self.comments = value
6984
    def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
6985
        if nodeName_ == 'UserDefined':
6986
            obj_ = UserDefinedType.factory(parent_object_=self)