mirror of
https://github.com/release-engineering/repo-autoindex.git
synced 2025-02-23 13:42:52 +00:00
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:
parent
41e8587cf0
commit
3f478e76f7
1 changed files with 1 additions and 1 deletions
|
@ -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]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue