Code Duplication    Length = 25-25 lines in 2 locations

src/ocrd_models/ocrd_page_generateds.py 2 locations

@@ 7340-7364 (lines=25) @@
7337
            outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
7338
        else:
7339
            outfile.write('/>%s' % (eol_, ))
7340
    def _exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='UnorderedGroupIndexedType'):
7341
        if self.id is not None and 'id' not in already_processed:
7342
            already_processed.add('id')
7343
            outfile.write(' id=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.id), input_name='id')), ))
7344
        if self.regionRef is not None and 'regionRef' not in already_processed:
7345
            already_processed.add('regionRef')
7346
            outfile.write(' regionRef=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.regionRef), input_name='regionRef')), ))
7347
        if self.index is not None and 'index' not in already_processed:
7348
            already_processed.add('index')
7349
            outfile.write(' index="%s"' % self.gds_format_integer(self.index, input_name='index'))
7350
        if self.caption is not None and 'caption' not in already_processed:
7351
            already_processed.add('caption')
7352
            outfile.write(' caption=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.caption), input_name='caption')), ))
7353
        if self.type_ is not None and 'type_' not in already_processed:
7354
            already_processed.add('type_')
7355
            outfile.write(' type=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.type_), input_name='type')), ))
7356
        if self.continuation is not None and 'continuation' not in already_processed:
7357
            already_processed.add('continuation')
7358
            outfile.write(' continuation="%s"' % self.gds_format_boolean(self.continuation, input_name='continuation'))
7359
        if self.custom is not None and 'custom' not in already_processed:
7360
            already_processed.add('custom')
7361
            outfile.write(' custom=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.custom), input_name='custom')), ))
7362
        if self.comments is not None and 'comments' not in already_processed:
7363
            already_processed.add('comments')
7364
            outfile.write(' comments=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.comments), input_name='comments')), ))
7365
    def _exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"', name_='UnorderedGroupIndexedType', fromsubclass_=False, pretty_print=True):
7366
        if pretty_print:
7367
            eol_ = '\n'
@@ 6852-6876 (lines=25) @@
6849
            outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
6850
        else:
6851
            outfile.write('/>%s' % (eol_, ))
6852
    def _exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='OrderedGroupIndexedType'):
6853
        if self.id is not None and 'id' not in already_processed:
6854
            already_processed.add('id')
6855
            outfile.write(' id=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.id), input_name='id')), ))
6856
        if self.regionRef is not None and 'regionRef' not in already_processed:
6857
            already_processed.add('regionRef')
6858
            outfile.write(' regionRef=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.regionRef), input_name='regionRef')), ))
6859
        if self.index is not None and 'index' not in already_processed:
6860
            already_processed.add('index')
6861
            outfile.write(' index="%s"' % self.gds_format_integer(self.index, input_name='index'))
6862
        if self.caption is not None and 'caption' not in already_processed:
6863
            already_processed.add('caption')
6864
            outfile.write(' caption=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.caption), input_name='caption')), ))
6865
        if self.type_ is not None and 'type_' not in already_processed:
6866
            already_processed.add('type_')
6867
            outfile.write(' type=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.type_), input_name='type')), ))
6868
        if self.continuation is not None and 'continuation' not in already_processed:
6869
            already_processed.add('continuation')
6870
            outfile.write(' continuation="%s"' % self.gds_format_boolean(self.continuation, input_name='continuation'))
6871
        if self.custom is not None and 'custom' not in already_processed:
6872
            already_processed.add('custom')
6873
            outfile.write(' custom=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.custom), input_name='custom')), ))
6874
        if self.comments is not None and 'comments' not in already_processed:
6875
            already_processed.add('comments')
6876
            outfile.write(' comments=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.comments), input_name='comments')), ))
6877
    def _exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"', name_='OrderedGroupIndexedType', fromsubclass_=False, pretty_print=True):
6878
        if pretty_print:
6879
            eol_ = '\n'