From 3c73efadab5cf0e4be94eeadd91f3e9c0eb2996e Mon Sep 17 00:00:00 2001 From: danieleades <33452915+danieleades@users.noreply.github.com> Date: Thu, 29 Sep 2022 17:26:53 +0100 Subject: [PATCH] shrink 'Any generics' mypy whitelist for builders module (#10846) --- pyproject.toml | 4 +++- sphinx/builders/linkcheck.py | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c8328653b..8074d970c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -187,7 +187,9 @@ strict_optional = false [[tool.mypy.overrides]] module = [ "sphinx.application", - "sphinx.builders.*", + "sphinx.builders._epub_base", + "sphinx.builders.html", + "sphinx.builders.linkcheck", "sphinx.cmd.quickstart", "sphinx.config", "sphinx.deprecation", diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 71e391378..a036aeefb 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -201,7 +201,7 @@ class HyperlinkAvailabilityChecker: self.config = config self.env = env self.rate_limits: Dict[str, RateLimit] = {} - self.rqueue: Queue = Queue() + self.rqueue: Queue[CheckResult] = Queue() self.workers: List[Thread] = [] self.wqueue: PriorityQueue[CheckRequest] = PriorityQueue() @@ -246,8 +246,8 @@ class HyperlinkAvailabilityChecker: class HyperlinkAvailabilityCheckWorker(Thread): """A worker class for checking the availability of hyperlinks.""" - def __init__(self, env: BuildEnvironment, config: Config, rqueue: Queue, - wqueue: Queue, rate_limits: Dict[str, RateLimit]) -> None: + def __init__(self, env: BuildEnvironment, config: Config, rqueue: 'Queue[CheckResult]', + wqueue: 'Queue[CheckRequest]', rate_limits: Dict[str, RateLimit]) -> None: self.config = config self.env = env self.rate_limits = rate_limits @@ -428,7 +428,7 @@ class HyperlinkAvailabilityCheckWorker(Thread): uri, docname, lineno = hyperlink except ValueError: # old styled check_request (will be deprecated in Sphinx-5.0) - next_check, uri, docname, lineno = check_request + next_check, uri, docname, lineno = check_request # type: ignore[misc] if uri is None: break