From 5393dbe623f17e5018dcd8b6298be96ad489a9f8 Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Wed, 15 Feb 2023 16:51:04 +0500 Subject: [PATCH] Fix typing of the get_meta_refresh() result (#211) Also bump mypy and remove --show-error-codes from tox.ini as it's already in mypy.ini. --- tox.ini | 4 ++-- w3lib/html.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index 08e63efd..862ae702 100644 --- a/tox.ini +++ b/tox.ini @@ -27,9 +27,9 @@ basepython = python3 deps = # mypy would error if pytest (or its sub) not found pytest - mypy==0.991 + mypy==1.0.0 commands = - mypy --strict --show-error-codes {posargs: w3lib tests} + mypy --strict {posargs: w3lib tests} [testenv:flake8] basepython = python3 diff --git a/w3lib/html.py b/w3lib/html.py index 1418b55f..f0f0184e 100644 --- a/w3lib/html.py +++ b/w3lib/html.py @@ -328,8 +328,8 @@ def get_meta_refresh( baseurl: str = "", encoding: str = "utf-8", ignore_tags: Iterable[str] = ("script", "noscript"), -) -> Tuple[Optional[float], Optional[str]]: - """Return the http-equiv parameter of the HTML meta element from the given +) -> Union[Tuple[None, None], Tuple[float, str]]: + """Return the http-equiv parameter of the HTML meta element from the given HTML text and return a tuple ``(interval, url)`` where interval is an integer containing the delay in seconds (or zero if not present) and url is a string with the absolute url to redirect.