Code Duplication    Length = 13-13 lines in 3 locations

src/ocrd_models/ocrd_page_generateds.py 3 locations

@@ 10875-10887 (lines=13) @@
10872
            outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
10873
        else:
10874
            outfile.write('/>%s' % (eol_, ))
10875
    def exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='UserAttributeType'):
10876
        if self.name is not None and 'name' not in already_processed:
10877
            already_processed.add('name')
10878
            outfile.write(' name=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.name), input_name='name')), ))
10879
        if self.description is not None and 'description' not in already_processed:
10880
            already_processed.add('description')
10881
            outfile.write(' description=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.description), input_name='description')), ))
10882
        if self.type_ is not None and 'type_' not in already_processed:
10883
            already_processed.add('type_')
10884
            outfile.write(' type=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.type_), input_name='type')), ))
10885
        if self.value is not None and 'value' not in already_processed:
10886
            already_processed.add('value')
10887
            outfile.write(' value=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.value), input_name='value')), ))
10888
    def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"', name_='UserAttributeType', fromsubclass_=False, pretty_print=True):
10889
        pass
10890
    def to_etree(self, parent_element=None, name_='UserAttributeType', mapping_=None, nsmap_=None):
@@ 8435-8447 (lines=13) @@
8432
            outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
8433
        else:
8434
            outfile.write('/>%s' % (eol_, ))
8435
    def exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='RelationType'):
8436
        if self.id is not None and 'id' not in already_processed:
8437
            already_processed.add('id')
8438
            outfile.write(' id=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.id), input_name='id')), ))
8439
        if self.type_ is not None and 'type_' not in already_processed:
8440
            already_processed.add('type_')
8441
            outfile.write(' type=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.type_), input_name='type')), ))
8442
        if self.custom is not None and 'custom' not in already_processed:
8443
            already_processed.add('custom')
8444
            outfile.write(' custom=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.custom), input_name='custom')), ))
8445
        if self.comments is not None and 'comments' not in already_processed:
8446
            already_processed.add('comments')
8447
            outfile.write(' comments=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.comments), input_name='comments')), ))
8448
    def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"', name_='RelationType', fromsubclass_=False, pretty_print=True):
8449
        if pretty_print:
8450
            eol_ = '\n'
@@ 1652-1664 (lines=13) @@
1649
            outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
1650
        else:
1651
            outfile.write('/>%s' % (eol_, ))
1652
    def exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='MetadataItemType'):
1653
        if self.type_ is not None and 'type_' not in already_processed:
1654
            already_processed.add('type_')
1655
            outfile.write(' type=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.type_), input_name='type')), ))
1656
        if self.name is not None and 'name' not in already_processed:
1657
            already_processed.add('name')
1658
            outfile.write(' name=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.name), input_name='name')), ))
1659
        if self.value is not None and 'value' not in already_processed:
1660
            already_processed.add('value')
1661
            outfile.write(' value=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.value), input_name='value')), ))
1662
        if self.date is not None and 'date' not in already_processed:
1663
            already_processed.add('date')
1664
            outfile.write(' date="%s"' % self.gds_format_datetime(self.date, input_name='date'))
1665
    def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"', name_='MetadataItemType', fromsubclass_=False, pretty_print=True):
1666
        if pretty_print:
1667
            eol_ = '\n'