From 871f51c270726fb76502570dcbf919ce747721d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:29:17 +0000 Subject: Bump lxml-stubs from 0.4.0 to 0.5.1 (#16885) --- poetry.lock | 8 ++++---- synapse/media/oembed.py | 5 ++--- synapse/media/preview_html.py | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/poetry.lock b/poetry.lock index df1b42db81..c9e5ad9e15 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1212,17 +1212,17 @@ source = ["Cython (>=3.0.7)"] [[package]] name = "lxml-stubs" -version = "0.4.0" +version = "0.5.1" description = "Type annotations for the lxml package" optional = false python-versions = "*" files = [ - {file = "lxml-stubs-0.4.0.tar.gz", hash = "sha256:184877b42127256abc2b932ba8bd0ab5ea80bd0b0fee618d16daa40e0b71abee"}, - {file = "lxml_stubs-0.4.0-py3-none-any.whl", hash = "sha256:3b381e9e82397c64ea3cc4d6f79d1255d015f7b114806d4826218805c10ec003"}, + {file = "lxml-stubs-0.5.1.tar.gz", hash = "sha256:e0ec2aa1ce92d91278b719091ce4515c12adc1d564359dfaf81efa7d4feab79d"}, + {file = "lxml_stubs-0.5.1-py3-none-any.whl", hash = "sha256:1f689e5dbc4b9247cb09ae820c7d34daeb1fdbd1db06123814b856dae7787272"}, ] [package.extras] -test = ["coverage[toml] (==5.2)", "pytest (>=6.0.0)", "pytest-mypy-plugins (==1.9.3)"] +test = ["coverage[toml] (>=7.2.5)", "mypy (>=1.2.0)", "pytest (>=7.3.0)", "pytest-mypy-plugins (>=1.10.1)"] [[package]] name = "markdown-it-py" diff --git a/synapse/media/oembed.py b/synapse/media/oembed.py index 94ece30459..16d613d271 100644 --- a/synapse/media/oembed.py +++ b/synapse/media/oembed.py @@ -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: diff --git a/synapse/media/preview_html.py b/synapse/media/preview_html.py index 8a2c098d53..62ce7789be 100644 --- a/synapse/media/preview_html.py +++ b/synapse/media/preview_html.py @@ -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( -- cgit 1.4.1