From ecae46027a3e33cf75c2d1eaecaf6f602d149b23 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Tue, 11 Feb 2020 01:41:55 +0900 Subject: [PATCH] refactor: Update type annotations in sphinx.util.* --- sphinx/util/__init__.py | 2 +- sphinx/util/inspect.py | 2 +- sphinx/util/pycompat.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 954315b86..12ae051f1 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -649,7 +649,7 @@ class progress_message: def __call__(self, f: Callable) -> Callable: @functools.wraps(f) - def wrapper(*args, **kwargs): + def wrapper(*args: Any, **kwargs: Any) -> Any: with self: return f(*args, **kwargs) diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 80cac97d9..60daf3754 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -51,7 +51,7 @@ memory_address_re = re.compile(r' at 0x[0-9a-f]{8,16}(?=>)', re.IGNORECASE) # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, # 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Python Software # Foundation; All Rights Reserved -def getargspec(func): +def getargspec(func: Callable) -> Any: """Like inspect.getfullargspec but supports bound methods, and wrapped methods.""" warnings.warn('sphinx.ext.inspect.getargspec() is deprecated', diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py index ba4f83a71..061bbcb6d 100644 --- a/sphinx/util/pycompat.py +++ b/sphinx/util/pycompat.py @@ -52,7 +52,7 @@ class UnicodeMixin: .. deprecated:: 2.0 """ - def __str__(self): + def __str__(self) -> str: warnings.warn('UnicodeMixin is deprecated', RemovedInSphinx40Warning, stacklevel=2) return self.__unicode__() # type: ignore