Skip to content

Commit

Permalink
Bump lxml-stubs from 0.4.0 to 0.5.1 (#16885)
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored Feb 6, 2024
1 parent 71e8634 commit 871f51c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions synapse/media/oembed.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,11 @@ def calc_description_and_urls(open_graph_response: JsonDict, html_body: str) ->
parser = etree.HTMLParser(recover=True, encoding="utf-8")

# Attempt to parse the body. If this fails, log and return no metadata.
# TODO Develop of lxml-stubs has this correct.
tree = etree.fromstring(html_body, parser) # type: ignore[arg-type]
tree = etree.fromstring(html_body, parser)

# The data was successfully parsed, but no tree was found.
if tree is None:
return # type: ignore[unreachable]
return

# Attempt to find interesting URLs (images, videos, embeds).
if "og:image" not in open_graph_response:
Expand Down
3 changes: 1 addition & 2 deletions synapse/media/preview_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ def decode_body(

# Attempt to parse the body. Returns None if the body was successfully
# parsed, but no tree was found.
# TODO Develop of lxml-stubs has this correct.
return etree.fromstring(body, parser) # type: ignore[arg-type]
return etree.fromstring(body, parser)


def _get_meta_tags(
Expand Down

0 comments on commit 871f51c

Please sign in to comment.