1
0
Fork 0
mirror of https://github.com/qurator-spk/dinglehopper.git synced 2025-07-01 22:50:08 +02:00

🐛 dinglehopper: Fix alto_extract_lines()'s type annotation

This commit is contained in:
Gerber, Mike 2020-11-12 19:32:38 +01:00
parent fe3923a8af
commit 389e253c11

View file

@ -1,6 +1,6 @@
from __future__ import division, print_function from __future__ import division, print_function
from typing import Generator from typing import Iterator
from warnings import warn from warnings import warn
import sys import sys
@ -23,7 +23,7 @@ def alto_namespace(tree: ET.ElementTree) -> str:
raise ValueError("Not an ALTO tree") raise ValueError("Not an ALTO tree")
def alto_extract_lines(tree: ET.ElementTree) -> Generator[ExtractedText, None, None]: def alto_extract_lines(tree: ET.ElementTree) -> Iterator[ExtractedText]:
nsmap = {"alto": alto_namespace(tree)} nsmap = {"alto": alto_namespace(tree)}
for line in tree.iterfind(".//alto:TextLine", namespaces=nsmap): for line in tree.iterfind(".//alto:TextLine", namespaces=nsmap):
line_id = line.attrib.get("ID") line_id = line.attrib.get("ID")