Hello I am trying to type hint lxml return types, using the types-lxml
library.
def parse_xml(path: str) -> etree._ElementTree:
return etree.parse(path)
def components(path: str) -> List[etree._Element]:
return parse_xml(path).xpath("/node1/node2")
But mypy complains on the second function saying:
error: Returning Any from function declared to return "List[_Element]" [no-any-return]
Any idea how to resolve this? Thanks.