summaryrefslogtreecommitdiff
path: root/sphinx/ext
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-01-31 18:30:43 +0000
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-01-31 18:30:43 +0000
commit4c4745af9cc788f94568bb3457f887b8c124f73f (patch)
tree3cfe20ed3672d3b08de0b1f4cb5d9abf7c19e214 /sphinx/ext
parent7395b05b1c03cd675b1d9a232a103934c2348225 (diff)
downloadsphinx-git-4c4745af9cc788f94568bb3457f887b8c124f73f.tar.gz
Fix various Ruff errors
Diffstat (limited to 'sphinx/ext')
-rw-r--r--sphinx/ext/autodoc/__init__.py3
-rw-r--r--sphinx/ext/autosummary/generate.py6
-rw-r--r--sphinx/ext/intersphinx.py6
3 files changed, 10 insertions, 5 deletions
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
index 5d4e864de..84a1d2bb5 100644
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -10,7 +10,6 @@ from __future__ import annotations
import re
import sys
from inspect import Parameter, Signature
-from types import ModuleType
from typing import (
TYPE_CHECKING,
Any,
@@ -45,6 +44,8 @@ from sphinx.util.inspect import (
from sphinx.util.typing import OptionSpec, get_type_hints, restify, stringify_annotation
if TYPE_CHECKING:
+ from types import ModuleType
+
from sphinx.ext.autodoc.directive import DocumenterBridge
logger = logging.getLogger(__name__)
diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py
index 03a20c2f5..92d4663db 100644
--- a/sphinx/ext/autosummary/generate.py
+++ b/sphinx/ext/autosummary/generate.py
@@ -22,9 +22,8 @@ import pkgutil
import pydoc
import re
import sys
-from gettext import NullTranslations
from os import path
-from typing import Any, NamedTuple, Sequence
+from typing import TYPE_CHECKING, Any, NamedTuple, Sequence
from jinja2 import TemplateNotFound
from jinja2.sandbox import SandboxedEnvironment
@@ -50,6 +49,9 @@ from sphinx.util.inspect import getall, safe_getattr
from sphinx.util.osutil import ensuredir
from sphinx.util.template import SphinxTemplateLoader
+if TYPE_CHECKING:
+ from gettext import NullTranslations
+
logger = logging.getLogger(__name__)
diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py
index 9e69d053c..6161b6a3e 100644
--- a/sphinx/ext/intersphinx.py
+++ b/sphinx/ext/intersphinx.py
@@ -25,8 +25,7 @@ import re
import sys
import time
from os import path
-from types import ModuleType
-from typing import IO, Any, cast
+from typing import IO, TYPE_CHECKING, Any, cast
from urllib.parse import urlsplit, urlunsplit
from docutils import nodes
@@ -48,6 +47,9 @@ from sphinx.util.docutils import CustomReSTDispatcher, SphinxRole
from sphinx.util.inventory import InventoryFile
from sphinx.util.typing import Inventory, InventoryItem, RoleFunction
+if TYPE_CHECKING:
+ from types import ModuleType
+
logger = logging.getLogger(__name__)