🐛 dinglehopper: Fix alto_extract_lines()'s type annotation

pull/49/head
Gerber, Mike 4 years ago
parent fe3923a8af
commit 389e253c11

@ -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")

Loading…
Cancel
Save