1
0
Fork 0
mirror of https://github.com/qurator-spk/dinglehopper.git synced 2025-07-01 06:29:59 +02:00

🐛 Check that we always get a valid ALTO namespace (satifies mypy)

This commit is contained in:
Mike Gerber 2024-03-27 17:57:53 +01:00
parent 19d1a00817
commit 5d9f0c482f

View file

@ -18,6 +18,7 @@ def alto_namespace(tree: ET._ElementTree) -> Optional[str]:
"""
root_name = ET.QName(tree.getroot().tag)
if root_name.localname == "alto":
assert isinstance(root_name.namespace, str)
return root_name.namespace
else:
raise ValueError("Not an ALTO tree")