mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-06-09 03:40:12 +02:00
Fix f-strings for Python 3.5
This commit is contained in:
parent
7b27b2834e
commit
c02569b41e
2 changed files with 5 additions and 4 deletions
|
@ -241,7 +241,7 @@ def get_textequiv_unicode(text_segment, nsmap) -> str:
|
|||
return ''
|
||||
|
||||
textequiv = get_first_textequiv(textequivs, segment_id)
|
||||
return textequiv.find('./page:Unicode', namespaces=nsmap).text
|
||||
return textequiv.find('./page:Unicode', namespaces=nsmap).text or ''
|
||||
|
||||
|
||||
def get_first_textequiv(textequivs, segment_id):
|
||||
|
|
|
@ -95,12 +95,13 @@ def test_textequiv(attributes, expected_index, expected_log, caplog):
|
|||
caplog.set_level(logging.INFO)
|
||||
xml = "<?xml version=\"1.0\"?>"
|
||||
ns = "http://schema.primaresearch.org/PAGE/gts/pagecontent/2018-07-15"
|
||||
text = [f"Text {i}" for i in range(len(attributes) + 1)]
|
||||
text = ["Text {0}".format(i) for i in range(len(attributes) + 1)]
|
||||
|
||||
equiv = [f"<TextEquiv {attr}><Unicode>{text[i]}</Unicode></TextEquiv>"
|
||||
equiv = ["<TextEquiv {0}><Unicode>{1}</Unicode></TextEquiv>".format(attr, text[i])
|
||||
for i, attr in enumerate(attributes)]
|
||||
|
||||
textline = f"{xml}<TextLine id=\"l3\" xmlns=\"{ns}\">{''.join(equiv)}</TextLine>"
|
||||
textline = "{0}<TextLine id=\"l3\" xmlns=\"{1}\">{2}</TextLine>"
|
||||
textline = textline.format(xml, ns, ''.join(equiv))
|
||||
|
||||
root = ET.fromstring(textline)
|
||||
result = ExtractedText.from_text_segment(root,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue