summaryrefslogtreecommitdiff
path: root/sphinx/util
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-11-13 20:36:24 +0000
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-11-13 20:36:24 +0000
commitcd3f2e435000835dd98a11497440bc16a79ec31c (patch)
tree6c89dfa43e74f4c47a3255f38ab013cc3cf997a1 /sphinx/util
parenta6032e852a650c070aed66f0790e612905159f15 (diff)
downloadsphinx-git-cd3f2e435000835dd98a11497440bc16a79ec31c.tar.gz
Update typing ignores for mypy 0.990
Diffstat (limited to 'sphinx/util')
-rw-r--r--sphinx/util/inspect.py8
-rw-r--r--sphinx/util/requests.py2
-rw-r--r--sphinx/util/rst.py2
3 files changed, 6 insertions, 6 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index aba7c6615..58ec9fae2 100644
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -52,7 +52,7 @@ def unwrap_all(obj: Any, *, stop: Optional[Callable] = None) -> Any:
elif ispartial(obj):
obj = obj.func
elif inspect.isroutine(obj) and hasattr(obj, '__wrapped__'):
- obj = obj.__wrapped__ # type: ignore
+ obj = obj.__wrapped__
elif isclassmethod(obj):
obj = obj.__func__
elif isstaticmethod(obj):
@@ -278,7 +278,7 @@ def is_singledispatch_function(obj: Any) -> bool:
if (inspect.isfunction(obj) and
hasattr(obj, 'dispatch') and
hasattr(obj, 'register') and
- obj.dispatch.__module__ == 'functools'): # type: ignore
+ obj.dispatch.__module__ == 'functools'):
return True
else:
return False
@@ -336,10 +336,10 @@ def isgenericalias(obj: Any) -> bool:
if isinstance(obj, typing._GenericAlias): # type: ignore
return True
elif (hasattr(types, 'GenericAlias') and # only for py39+
- isinstance(obj, types.GenericAlias)): # type: ignore
+ isinstance(obj, types.GenericAlias)):
return True
elif (hasattr(typing, '_SpecialGenericAlias') and # for py39+
- isinstance(obj, typing._SpecialGenericAlias)): # type: ignore
+ isinstance(obj, typing._SpecialGenericAlias)):
return True
else:
return False
diff --git a/sphinx/util/requests.py b/sphinx/util/requests.py
index b25304d37..0f52d61ef 100644
--- a/sphinx/util/requests.py
+++ b/sphinx/util/requests.py
@@ -19,7 +19,7 @@ useragent_header = [('User-Agent',
@contextmanager
def ignore_insecure_warning(**kwargs: Any) -> Generator[None, None, None]:
with warnings.catch_warnings():
- if not kwargs.get('verify') and InsecureRequestWarning:
+ if not kwargs.get('verify'):
# ignore InsecureRequestWarning if verify=False
warnings.filterwarnings("ignore", category=InsecureRequestWarning)
yield
diff --git a/sphinx/util/rst.py b/sphinx/util/rst.py
index b44cf9848..87252fa39 100644
--- a/sphinx/util/rst.py
+++ b/sphinx/util/rst.py
@@ -63,7 +63,7 @@ def default_role(docname: str, name: str) -> Generator[None, None, None]:
if name:
dummy_reporter = Reporter('', 4, 4)
role_fn, _ = roles.role(name, english, 0, dummy_reporter)
- if role_fn:
+ if role_fn: # type: ignore[truthy-function]
docutils.register_role('', role_fn)
else:
logger.warning(__('default role %s not found'), name, location=docname)