Fix type check with latest mypy/typeshed

The following commit defined a return type hint for
getElementsByTagName:

3fc2f27990 (diff-f451f731d037ef9d79347194490b32ba613798ea7eaa2c160351a69625f05e08R150)

It defined the return type as a list of Node, while this code expects a
list of Element (Element is a subtype of Node).

Given that one would expect a getElements method to return
specifically *elements* and not other types of node, I think the
typeshed change may be incorrect, but it's hard to be sure since the
stdlib docs themselves are ambiguous.

Suppress it for now to unblock dependency updates.
This commit is contained in:
Rohan McGovern 2023-04-19 13:20:42 +10:00
parent 41e8587cf0
commit 3f478e76f7

View file

@ -23,7 +23,7 @@ def assert_repodata_ok(condition: Any, msg: str):
def get_tag(elem: Element, name: str) -> Element:
elems: list[Element] = elem.getElementsByTagName(name)
elems: list[Element] = elem.getElementsByTagName(name) # type: ignore
assert_repodata_ok(len(elems) == 1, f"expected exactly one {name} tag")
return elems[0]