mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Shrink the mypy whitelist for `sphinx.util.display
` (#12570)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
parent
313627e4f6
commit
d5df528e8c
@ -264,7 +264,6 @@ module = [
|
||||
"sphinx.registry",
|
||||
"sphinx.search",
|
||||
"sphinx.util",
|
||||
"sphinx.util.display",
|
||||
"sphinx.util.docfields",
|
||||
"sphinx.util.docutils",
|
||||
"sphinx.util.i18n",
|
||||
|
@ -1,7 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
from typing import Any, Callable, TypeVar
|
||||
|
||||
from sphinx.locale import __
|
||||
from sphinx.util import logging
|
||||
@ -10,6 +9,13 @@ from sphinx.util.console import bold, color_terminal
|
||||
if False:
|
||||
from collections.abc import Iterable, Iterator
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, TypeVar
|
||||
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
T = TypeVar('T')
|
||||
P = ParamSpec('P')
|
||||
R = TypeVar('R')
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -22,9 +28,6 @@ def display_chunk(chunk: Any) -> str:
|
||||
return str(chunk)
|
||||
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
|
||||
def status_iterator(
|
||||
iterable: Iterable[T],
|
||||
summary: str,
|
||||
@ -88,9 +91,9 @@ class progress_message:
|
||||
|
||||
return False
|
||||
|
||||
def __call__(self, f: Callable) -> Callable:
|
||||
def __call__(self, f: Callable[P, R]) -> Callable[P, R]:
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
||||
def wrapper(*args: P.args, **kwargs: P.kwargs) -> R: # type: ignore[return]
|
||||
with self:
|
||||
return f(*args, **kwargs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user