Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Correct annotation of _iterate_over_text #12860

Merged
merged 2 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12860.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Correct a type annotation in the URL preview source code.
2 changes: 1 addition & 1 deletion synapse/rest/media/v1/preview_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def parse_html_description(tree: "etree.Element") -> Optional[str]:


def _iterate_over_text(
tree: "etree.Element", *tags_to_ignore: Iterable[Union[str, "etree.Comment"]]
tree: "etree.Element", *tags_to_ignore: Union[str, "etree.Comment"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I think it doesn't even make sense to pass this, we should probably just make TAGS_TO_REMOVE a constant.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Or at the very list, not splat it?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this might just be Old Code (TM)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, pretty much! 👍

) -> Generator[str, None, None]:
"""Iterate over the tree returning text nodes in a depth first fashion,
skipping text nodes inside certain tags.
Expand Down