mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Adopt `profile = "black" for isort`
This allows using Ruff's import sorting fixers
This commit is contained in:
2
.flake8
2
.flake8
@@ -26,8 +26,6 @@ exclude =
|
||||
doc/_build/*,
|
||||
sphinx/search/*,
|
||||
doc/usage/extensions/example*.py,
|
||||
application-import-names = sphinx
|
||||
import-order-style = smarkets
|
||||
per-file-ignores =
|
||||
tests/*: E501
|
||||
sphinx/util/jsdump.py: SIM905
|
||||
|
||||
@@ -133,6 +133,7 @@ exclude = [
|
||||
|
||||
[tool.isort]
|
||||
line_length = 95
|
||||
profile = "black"
|
||||
remove_redundant_aliases = true
|
||||
|
||||
[tool.ruff]
|
||||
|
||||
@@ -10,8 +10,13 @@ from docutils.transforms.references import Substitutions
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.application import Sphinx
|
||||
from sphinx.builders.latex.nodes import (captioned_literal_block, footnotemark, footnotetext,
|
||||
math_reference, thebibliography)
|
||||
from sphinx.builders.latex.nodes import (
|
||||
captioned_literal_block,
|
||||
footnotemark,
|
||||
footnotetext,
|
||||
math_reference,
|
||||
thebibliography,
|
||||
)
|
||||
from sphinx.domains.citation import CitationDomain
|
||||
from sphinx.transforms import SphinxTransform
|
||||
from sphinx.transforms.post_transforms import SphinxPostTransform
|
||||
|
||||
@@ -21,13 +21,27 @@ from sphinx.roles import SphinxRole, XRefRole
|
||||
from sphinx.transforms import SphinxTransform
|
||||
from sphinx.transforms.post_transforms import ReferencesResolver
|
||||
from sphinx.util import logging
|
||||
from sphinx.util.cfamily import (ASTAttributeList, ASTBaseBase, ASTBaseParenExprList,
|
||||
BaseParser, DefinitionError, NoOldIdError, StringifyTransform,
|
||||
UnsupportedMultiCharacterCharLiteral, anon_identifier_re,
|
||||
binary_literal_re, char_literal_re, float_literal_re,
|
||||
float_literal_suffix_re, hex_literal_re, identifier_re,
|
||||
integer_literal_re, integers_literal_suffix_re,
|
||||
octal_literal_re, verify_description_mode)
|
||||
from sphinx.util.cfamily import (
|
||||
ASTAttributeList,
|
||||
ASTBaseBase,
|
||||
ASTBaseParenExprList,
|
||||
BaseParser,
|
||||
DefinitionError,
|
||||
NoOldIdError,
|
||||
StringifyTransform,
|
||||
UnsupportedMultiCharacterCharLiteral,
|
||||
anon_identifier_re,
|
||||
binary_literal_re,
|
||||
char_literal_re,
|
||||
float_literal_re,
|
||||
float_literal_suffix_re,
|
||||
hex_literal_re,
|
||||
identifier_re,
|
||||
integer_literal_re,
|
||||
integers_literal_suffix_re,
|
||||
octal_literal_re,
|
||||
verify_description_mode,
|
||||
)
|
||||
from sphinx.util.docfields import Field, GroupedField, TypedField
|
||||
from sphinx.util.docutils import SphinxDirective
|
||||
from sphinx.util.nodes import make_refnode
|
||||
|
||||
@@ -22,13 +22,27 @@ from sphinx.roles import SphinxRole, XRefRole
|
||||
from sphinx.transforms import SphinxTransform
|
||||
from sphinx.transforms.post_transforms import ReferencesResolver
|
||||
from sphinx.util import logging
|
||||
from sphinx.util.cfamily import (ASTAttributeList, ASTBaseBase, ASTBaseParenExprList,
|
||||
BaseParser, DefinitionError, NoOldIdError, StringifyTransform,
|
||||
UnsupportedMultiCharacterCharLiteral, anon_identifier_re,
|
||||
binary_literal_re, char_literal_re, float_literal_re,
|
||||
float_literal_suffix_re, hex_literal_re, identifier_re,
|
||||
integer_literal_re, integers_literal_suffix_re,
|
||||
octal_literal_re, verify_description_mode)
|
||||
from sphinx.util.cfamily import (
|
||||
ASTAttributeList,
|
||||
ASTBaseBase,
|
||||
ASTBaseParenExprList,
|
||||
BaseParser,
|
||||
DefinitionError,
|
||||
NoOldIdError,
|
||||
StringifyTransform,
|
||||
UnsupportedMultiCharacterCharLiteral,
|
||||
anon_identifier_re,
|
||||
binary_literal_re,
|
||||
char_literal_re,
|
||||
float_literal_re,
|
||||
float_literal_suffix_re,
|
||||
hex_literal_re,
|
||||
identifier_re,
|
||||
integer_literal_re,
|
||||
integers_literal_suffix_re,
|
||||
octal_literal_re,
|
||||
verify_description_mode,
|
||||
)
|
||||
from sphinx.util.docfields import Field, GroupedField
|
||||
from sphinx.util.docutils import SphinxDirective
|
||||
from sphinx.util.nodes import make_refnode
|
||||
|
||||
@@ -28,8 +28,12 @@ from sphinx.util import logging
|
||||
from sphinx.util.docfields import Field, GroupedField, TypedField
|
||||
from sphinx.util.docutils import SphinxDirective, switch_source_input
|
||||
from sphinx.util.inspect import signature_from_str
|
||||
from sphinx.util.nodes import (find_pending_xref_condition, make_id, make_refnode,
|
||||
nested_parse_with_titles)
|
||||
from sphinx.util.nodes import (
|
||||
find_pending_xref_condition,
|
||||
make_id,
|
||||
make_refnode,
|
||||
nested_parse_with_titles,
|
||||
)
|
||||
from sphinx.util.typing import OptionSpec, TextlikeNode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -11,8 +11,17 @@ import re
|
||||
import sys
|
||||
from inspect import Parameter, Signature
|
||||
from types import ModuleType
|
||||
from typing import (TYPE_CHECKING, Any, Callable, Iterator, List, Sequence, Tuple, TypeVar,
|
||||
Union)
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Callable,
|
||||
Iterator,
|
||||
List,
|
||||
Sequence,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
)
|
||||
|
||||
from docutils.statemachine import StringList
|
||||
|
||||
@@ -26,8 +35,13 @@ from sphinx.locale import _, __
|
||||
from sphinx.pycode import ModuleAnalyzer, PycodeError
|
||||
from sphinx.util import inspect, logging
|
||||
from sphinx.util.docstrings import prepare_docstring, separate_metadata
|
||||
from sphinx.util.inspect import (evaluate_signature, getdoc, object_description, safe_getattr,
|
||||
stringify_signature)
|
||||
from sphinx.util.inspect import (
|
||||
evaluate_signature,
|
||||
getdoc,
|
||||
object_description,
|
||||
safe_getattr,
|
||||
stringify_signature,
|
||||
)
|
||||
from sphinx.util.typing import OptionSpec, get_type_hints, restify, stringify_annotation
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
||||
@@ -10,8 +10,14 @@ from typing import TYPE_CHECKING, Any, Callable, NamedTuple
|
||||
from sphinx.ext.autodoc.mock import ismock, undecorate
|
||||
from sphinx.pycode import ModuleAnalyzer, PycodeError
|
||||
from sphinx.util import logging
|
||||
from sphinx.util.inspect import (getannotations, getmro, getslots, isclass, isenumclass,
|
||||
safe_getattr)
|
||||
from sphinx.util.inspect import (
|
||||
getannotations,
|
||||
getmro,
|
||||
getslots,
|
||||
isclass,
|
||||
isenumclass,
|
||||
safe_getattr,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sphinx.ext.autodoc import ObjectMember
|
||||
|
||||
@@ -81,8 +81,13 @@ from sphinx.project import Project
|
||||
from sphinx.pycode import ModuleAnalyzer, PycodeError
|
||||
from sphinx.registry import SphinxComponentRegistry
|
||||
from sphinx.util import logging, rst
|
||||
from sphinx.util.docutils import (NullReporter, SphinxDirective, SphinxRole, new_document,
|
||||
switch_source_input)
|
||||
from sphinx.util.docutils import (
|
||||
NullReporter,
|
||||
SphinxDirective,
|
||||
SphinxRole,
|
||||
new_document,
|
||||
switch_source_input,
|
||||
)
|
||||
from sphinx.util.inspect import signature_from_str
|
||||
from sphinx.util.matching import Matcher
|
||||
from sphinx.util.typing import OptionSpec
|
||||
|
||||
@@ -36,8 +36,12 @@ from sphinx.builders import Builder
|
||||
from sphinx.config import Config
|
||||
from sphinx.ext.autodoc import Documenter
|
||||
from sphinx.ext.autodoc.importer import import_module
|
||||
from sphinx.ext.autosummary import (ImportExceptionGroup, get_documenter, import_by_name,
|
||||
import_ivar_by_name)
|
||||
from sphinx.ext.autosummary import (
|
||||
ImportExceptionGroup,
|
||||
get_documenter,
|
||||
import_by_name,
|
||||
import_ivar_by_name,
|
||||
)
|
||||
from sphinx.locale import __
|
||||
from sphinx.pycode import ModuleAnalyzer, PycodeError
|
||||
from sphinx.registry import SphinxComponentRegistry
|
||||
@@ -79,10 +83,17 @@ class AutosummaryEntry(NamedTuple):
|
||||
|
||||
|
||||
def setup_documenters(app: Any) -> None:
|
||||
from sphinx.ext.autodoc import (AttributeDocumenter, ClassDocumenter, DataDocumenter,
|
||||
DecoratorDocumenter, ExceptionDocumenter,
|
||||
FunctionDocumenter, MethodDocumenter, ModuleDocumenter,
|
||||
PropertyDocumenter)
|
||||
from sphinx.ext.autodoc import (
|
||||
AttributeDocumenter,
|
||||
ClassDocumenter,
|
||||
DataDocumenter,
|
||||
DecoratorDocumenter,
|
||||
ExceptionDocumenter,
|
||||
FunctionDocumenter,
|
||||
MethodDocumenter,
|
||||
ModuleDocumenter,
|
||||
PropertyDocumenter,
|
||||
)
|
||||
documenters: list[type[Documenter]] = [
|
||||
ModuleDocumenter, ClassDocumenter, ExceptionDocumenter, DataDocumenter,
|
||||
FunctionDocumenter, MethodDocumenter,
|
||||
|
||||
@@ -44,8 +44,13 @@ import sphinx
|
||||
from sphinx import addnodes
|
||||
from sphinx.application import Sphinx
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from sphinx.ext.graphviz import (figure_wrapper, graphviz, render_dot_html, render_dot_latex,
|
||||
render_dot_texinfo)
|
||||
from sphinx.ext.graphviz import (
|
||||
figure_wrapper,
|
||||
graphviz,
|
||||
render_dot_html,
|
||||
render_dot_latex,
|
||||
render_dot_texinfo,
|
||||
)
|
||||
from sphinx.util import md5
|
||||
from sphinx.util.docutils import SphinxDirective
|
||||
from sphinx.util.typing import OptionSpec
|
||||
|
||||
@@ -11,8 +11,15 @@ from pygments.filters import ErrorToken
|
||||
from pygments.formatter import Formatter
|
||||
from pygments.formatters import HtmlFormatter, LatexFormatter
|
||||
from pygments.lexer import Lexer
|
||||
from pygments.lexers import (CLexer, PythonConsoleLexer, PythonLexer, RstLexer, TextLexer,
|
||||
get_lexer_by_name, guess_lexer)
|
||||
from pygments.lexers import (
|
||||
CLexer,
|
||||
PythonConsoleLexer,
|
||||
PythonLexer,
|
||||
RstLexer,
|
||||
TextLexer,
|
||||
get_lexer_by_name,
|
||||
guess_lexer,
|
||||
)
|
||||
from pygments.style import Style
|
||||
from pygments.styles import get_style_by_name
|
||||
from pygments.util import ClassNotFound
|
||||
|
||||
@@ -21,8 +21,11 @@ from sphinx import addnodes
|
||||
from sphinx.deprecation import RemovedInSphinx70Warning
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from sphinx.transforms import AutoIndexUpgrader, DoctreeReadEvent, SphinxTransformer
|
||||
from sphinx.transforms.i18n import (Locale, PreserveTranslatableMessages,
|
||||
RemoveTranslatableInline)
|
||||
from sphinx.transforms.i18n import (
|
||||
Locale,
|
||||
PreserveTranslatableMessages,
|
||||
RemoveTranslatableInline,
|
||||
)
|
||||
from sphinx.transforms.references import SphinxDomains
|
||||
from sphinx.util import UnicodeDecodeErrorHandler, get_filetype, logging
|
||||
from sphinx.util.docutils import LoggingReporter
|
||||
|
||||
@@ -2,8 +2,17 @@
|
||||
|
||||
from pygments.style import Style
|
||||
from pygments.styles.friendly import FriendlyStyle
|
||||
from pygments.token import (Comment, Error, Generic, Keyword, Name, Number, Operator, String,
|
||||
Whitespace)
|
||||
from pygments.token import (
|
||||
Comment,
|
||||
Error,
|
||||
Generic,
|
||||
Keyword,
|
||||
Name,
|
||||
Number,
|
||||
Operator,
|
||||
String,
|
||||
Whitespace,
|
||||
)
|
||||
|
||||
|
||||
class NoneStyle(Style):
|
||||
|
||||
@@ -10,8 +10,22 @@ import re
|
||||
import warnings
|
||||
from importlib import import_module
|
||||
from os import path
|
||||
from typing import (IO, Any, Callable, Dict, Generator, Iterable, Iterator, List, Optional,
|
||||
Sequence, Set, Tuple, Type, Union)
|
||||
from typing import (
|
||||
IO,
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Generator,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Sequence,
|
||||
Set,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
from docutils import nodes
|
||||
from docutils.nodes import Element, Node
|
||||
|
||||
@@ -20,8 +20,13 @@ from sphinx.locale import init as init_locale
|
||||
from sphinx.transforms import SphinxTransform
|
||||
from sphinx.util import get_filetype, logging, split_index_msg
|
||||
from sphinx.util.i18n import docname_to_domain
|
||||
from sphinx.util.nodes import (IMAGE_TYPE_NODES, LITERAL_TYPE_NODES, NodeMatcher,
|
||||
extract_messages, traverse_translatable_index)
|
||||
from sphinx.util.nodes import (
|
||||
IMAGE_TYPE_NODES,
|
||||
LITERAL_TYPE_NODES,
|
||||
NodeMatcher,
|
||||
extract_messages,
|
||||
traverse_translatable_index,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sphinx.application import Sphinx
|
||||
|
||||
@@ -13,8 +13,11 @@ from os import path
|
||||
from typing import IO, Any, Iterable
|
||||
from urllib.parse import parse_qsl, quote_plus, urlencode, urlsplit, urlunsplit
|
||||
|
||||
from sphinx.deprecation import (RemovedInSphinx70Warning, RemovedInSphinx80Warning,
|
||||
deprecated_alias)
|
||||
from sphinx.deprecation import (
|
||||
RemovedInSphinx70Warning,
|
||||
RemovedInSphinx80Warning,
|
||||
deprecated_alias,
|
||||
)
|
||||
from sphinx.errors import ExtensionError, FiletypeNotFoundError
|
||||
from sphinx.locale import __
|
||||
from sphinx.util import display as _display
|
||||
@@ -24,12 +27,25 @@ from sphinx.util import logging
|
||||
from sphinx.util import osutil as _osutil
|
||||
from sphinx.util.console import strip_colors # NoQA: F401
|
||||
from sphinx.util.matching import patfilter # noqa: F401
|
||||
from sphinx.util.nodes import (caption_ref_re, explicit_title_re, # noqa: F401
|
||||
nested_parse_with_titles, split_explicit_title)
|
||||
from sphinx.util.nodes import ( # noqa: F401
|
||||
caption_ref_re,
|
||||
explicit_title_re,
|
||||
nested_parse_with_titles,
|
||||
split_explicit_title,
|
||||
)
|
||||
|
||||
# import other utilities; partly for backwards compatibility, so don't
|
||||
# prune unused ones indiscriminately
|
||||
from sphinx.util.osutil import (SEP, copyfile, copytimes, ensuredir, # noqa: F401
|
||||
make_filename, mtimes_of_files, os_path, relative_uri)
|
||||
from sphinx.util.osutil import ( # noqa: F401
|
||||
SEP,
|
||||
copyfile,
|
||||
copytimes,
|
||||
ensuredir,
|
||||
make_filename,
|
||||
mtimes_of_files,
|
||||
os_path,
|
||||
relative_uri,
|
||||
)
|
||||
from sphinx.util.typing import PathMatcher
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -13,11 +13,22 @@ import types
|
||||
import typing
|
||||
from functools import cached_property, partial, partialmethod, singledispatchmethod
|
||||
from importlib import import_module
|
||||
from inspect import (Parameter, isasyncgenfunction, isclass, ismethod, # noqa: F401
|
||||
ismethoddescriptor, ismodule)
|
||||
from inspect import ( # noqa: F401
|
||||
Parameter,
|
||||
isasyncgenfunction,
|
||||
isclass,
|
||||
ismethod,
|
||||
ismethoddescriptor,
|
||||
ismodule,
|
||||
)
|
||||
from io import StringIO
|
||||
from types import (ClassMethodDescriptorType, MethodDescriptorType, MethodType, ModuleType,
|
||||
WrapperDescriptorType)
|
||||
from types import (
|
||||
ClassMethodDescriptorType,
|
||||
MethodDescriptorType,
|
||||
MethodType,
|
||||
ModuleType,
|
||||
WrapperDescriptorType,
|
||||
)
|
||||
from typing import Any, Callable, Dict, Mapping, Sequence, cast
|
||||
|
||||
from sphinx.pycode.ast import unparse as ast_unparse
|
||||
|
||||
@@ -8,8 +8,14 @@ import pytest
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.addnodes import desc
|
||||
from sphinx.domains.c import (DefinitionError, DefinitionParser, Symbol, _id_prefix,
|
||||
_macroKeywords, _max_id)
|
||||
from sphinx.domains.c import (
|
||||
DefinitionError,
|
||||
DefinitionParser,
|
||||
Symbol,
|
||||
_id_prefix,
|
||||
_macroKeywords,
|
||||
_max_id,
|
||||
)
|
||||
from sphinx.ext.intersphinx import load_mappings, normalize_intersphinx_mapping
|
||||
from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
@@ -9,8 +9,14 @@ import pytest
|
||||
import sphinx.domains.cpp as cppDomain
|
||||
from sphinx import addnodes
|
||||
from sphinx.addnodes import desc
|
||||
from sphinx.domains.cpp import (DefinitionError, DefinitionParser, NoOldIdError, Symbol,
|
||||
_id_prefix, _max_id)
|
||||
from sphinx.domains.cpp import (
|
||||
DefinitionError,
|
||||
DefinitionParser,
|
||||
NoOldIdError,
|
||||
Symbol,
|
||||
_id_prefix,
|
||||
_max_id,
|
||||
)
|
||||
from sphinx.ext.intersphinx import load_mappings, normalize_intersphinx_mapping
|
||||
from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
@@ -6,9 +6,18 @@ import pytest
|
||||
from docutils import nodes
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.addnodes import (desc, desc_annotation, desc_content, desc_name, desc_parameter,
|
||||
desc_parameterlist, desc_sig_keyword, desc_sig_name,
|
||||
desc_sig_space, desc_signature)
|
||||
from sphinx.addnodes import (
|
||||
desc,
|
||||
desc_annotation,
|
||||
desc_content,
|
||||
desc_name,
|
||||
desc_parameter,
|
||||
desc_parameterlist,
|
||||
desc_sig_keyword,
|
||||
desc_sig_name,
|
||||
desc_sig_space,
|
||||
desc_signature,
|
||||
)
|
||||
from sphinx.domains.javascript import JavaScriptDomain
|
||||
from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
@@ -8,15 +8,34 @@ import pytest
|
||||
from docutils import nodes
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.addnodes import (desc, desc_addname, desc_annotation, desc_content, desc_name,
|
||||
desc_optional, desc_parameter, desc_parameterlist, desc_returns,
|
||||
desc_sig_keyword, desc_sig_literal_number,
|
||||
desc_sig_literal_string, desc_sig_name, desc_sig_operator,
|
||||
desc_sig_punctuation, desc_sig_space, desc_signature,
|
||||
pending_xref)
|
||||
from sphinx.addnodes import (
|
||||
desc,
|
||||
desc_addname,
|
||||
desc_annotation,
|
||||
desc_content,
|
||||
desc_name,
|
||||
desc_optional,
|
||||
desc_parameter,
|
||||
desc_parameterlist,
|
||||
desc_returns,
|
||||
desc_sig_keyword,
|
||||
desc_sig_literal_number,
|
||||
desc_sig_literal_string,
|
||||
desc_sig_name,
|
||||
desc_sig_operator,
|
||||
desc_sig_punctuation,
|
||||
desc_sig_space,
|
||||
desc_signature,
|
||||
pending_xref,
|
||||
)
|
||||
from sphinx.domains import IndexEntry
|
||||
from sphinx.domains.python import (PythonDomain, PythonModuleIndex, _parse_annotation,
|
||||
_pseudo_parse_arglist, py_sig_re)
|
||||
from sphinx.domains.python import (
|
||||
PythonDomain,
|
||||
PythonModuleIndex,
|
||||
_parse_annotation,
|
||||
_pseudo_parse_arglist,
|
||||
py_sig_re,
|
||||
)
|
||||
from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
"""Tests the reStructuredText domain."""
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.addnodes import (desc, desc_addname, desc_annotation, desc_content, desc_name,
|
||||
desc_signature)
|
||||
from sphinx.addnodes import (
|
||||
desc,
|
||||
desc_addname,
|
||||
desc_annotation,
|
||||
desc_content,
|
||||
desc_name,
|
||||
desc_signature,
|
||||
)
|
||||
from sphinx.domains.rst import parse_directive
|
||||
from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
@@ -8,8 +8,16 @@ from docutils.nodes import definition, definition_list, definition_list_item, te
|
||||
from html5lib import HTMLParser
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.addnodes import (desc, desc_addname, desc_content, desc_name, desc_signature,
|
||||
glossary, index, pending_xref)
|
||||
from sphinx.addnodes import (
|
||||
desc,
|
||||
desc_addname,
|
||||
desc_content,
|
||||
desc_name,
|
||||
desc_signature,
|
||||
glossary,
|
||||
index,
|
||||
pending_xref,
|
||||
)
|
||||
from sphinx.domains.std import StandardDomain
|
||||
from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
@@ -8,10 +8,18 @@ import pytest
|
||||
from docutils import nodes
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.ext.autosummary import (autosummary_table, autosummary_toc, extract_summary,
|
||||
import_by_name, mangle_signature)
|
||||
from sphinx.ext.autosummary.generate import (AutosummaryEntry, generate_autosummary_content,
|
||||
generate_autosummary_docs)
|
||||
from sphinx.ext.autosummary import (
|
||||
autosummary_table,
|
||||
autosummary_toc,
|
||||
extract_summary,
|
||||
import_by_name,
|
||||
mangle_signature,
|
||||
)
|
||||
from sphinx.ext.autosummary.generate import (
|
||||
AutosummaryEntry,
|
||||
generate_autosummary_content,
|
||||
generate_autosummary_docs,
|
||||
)
|
||||
from sphinx.ext.autosummary.generate import main as autogen_main
|
||||
from sphinx.testing.util import assert_node, etree_parse
|
||||
from sphinx.util.docutils import new_document
|
||||
|
||||
@@ -6,8 +6,11 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.ext.inheritance_diagram import (InheritanceDiagram, InheritanceException,
|
||||
import_classes)
|
||||
from sphinx.ext.inheritance_diagram import (
|
||||
InheritanceDiagram,
|
||||
InheritanceException,
|
||||
import_classes,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername="html", testroot="inheritance")
|
||||
|
||||
@@ -9,9 +9,16 @@ import pytest
|
||||
from docutils import nodes
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.ext.intersphinx import (INVENTORY_FILENAME, _get_safe_url, _strip_basic_auth,
|
||||
fetch_inventory, inspect_main, load_mappings,
|
||||
missing_reference, normalize_intersphinx_mapping)
|
||||
from sphinx.ext.intersphinx import (
|
||||
INVENTORY_FILENAME,
|
||||
_get_safe_url,
|
||||
_strip_basic_auth,
|
||||
fetch_inventory,
|
||||
inspect_main,
|
||||
load_mappings,
|
||||
missing_reference,
|
||||
normalize_intersphinx_mapping,
|
||||
)
|
||||
from sphinx.ext.intersphinx import setup as intersphinx_setup
|
||||
|
||||
from .test_util_inventory import inventory_v2, inventory_v2_not_having_version
|
||||
|
||||
@@ -10,9 +10,14 @@ from unittest import TestCase, mock
|
||||
import pytest
|
||||
|
||||
from sphinx.ext.napoleon import Config
|
||||
from sphinx.ext.napoleon.docstring import (GoogleDocstring, NumpyDocstring,
|
||||
_convert_numpy_type_spec, _recombine_set_tokens,
|
||||
_token_type, _tokenize_type_spec)
|
||||
from sphinx.ext.napoleon.docstring import (
|
||||
GoogleDocstring,
|
||||
NumpyDocstring,
|
||||
_convert_numpy_type_spec,
|
||||
_recombine_set_tokens,
|
||||
_token_type,
|
||||
_tokenize_type_spec,
|
||||
)
|
||||
|
||||
from .ext_napoleon_pep526_data_google import PEP526GoogleClass
|
||||
from .ext_napoleon_pep526_data_numpy import PEP526NumpyClass
|
||||
|
||||
@@ -13,8 +13,15 @@ from babel.messages.catalog import Catalog
|
||||
from docutils import nodes
|
||||
|
||||
from sphinx import locale
|
||||
from sphinx.testing.util import (assert_node, assert_not_re_search, assert_re_search,
|
||||
assert_startswith, etree_parse, path, strip_escseq)
|
||||
from sphinx.testing.util import (
|
||||
assert_node,
|
||||
assert_not_re_search,
|
||||
assert_re_search,
|
||||
assert_startswith,
|
||||
etree_parse,
|
||||
path,
|
||||
strip_escseq,
|
||||
)
|
||||
|
||||
sphinx_intl = pytest.mark.sphinx(
|
||||
testroot='intl',
|
||||
|
||||
@@ -6,8 +6,12 @@ import pytest
|
||||
|
||||
from sphinx.testing.util import strip_escseq
|
||||
from sphinx.util import logging
|
||||
from sphinx.util.display import (SkipProgressMessage, display_chunk, progress_message,
|
||||
status_iterator)
|
||||
from sphinx.util.display import (
|
||||
SkipProgressMessage,
|
||||
display_chunk,
|
||||
progress_message,
|
||||
status_iterator,
|
||||
)
|
||||
|
||||
|
||||
def test_display_chunk():
|
||||
|
||||
@@ -4,8 +4,13 @@ import os
|
||||
|
||||
from docutils import nodes
|
||||
|
||||
from sphinx.util.docutils import (SphinxFileOutput, SphinxTranslator, docutils_namespace,
|
||||
new_document, register_node)
|
||||
from sphinx.util.docutils import (
|
||||
SphinxFileOutput,
|
||||
SphinxTranslator,
|
||||
docutils_namespace,
|
||||
new_document,
|
||||
register_node,
|
||||
)
|
||||
|
||||
|
||||
def test_register_node():
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.util.images import (get_image_extension, get_image_size, guess_mimetype,
|
||||
parse_data_uri)
|
||||
from sphinx.util.images import (
|
||||
get_image_extension,
|
||||
get_image_size,
|
||||
guess_mimetype,
|
||||
parse_data_uri,
|
||||
)
|
||||
|
||||
GIF_FILENAME = 'img.gif'
|
||||
PNG_FILENAME = 'img.png'
|
||||
|
||||
@@ -152,9 +152,35 @@ def test_signature_partialmethod():
|
||||
|
||||
|
||||
def test_signature_annotations():
|
||||
from .typing_test_data import (Node, f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12,
|
||||
f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24,
|
||||
f25)
|
||||
from .typing_test_data import (
|
||||
Node,
|
||||
f0,
|
||||
f1,
|
||||
f2,
|
||||
f3,
|
||||
f4,
|
||||
f5,
|
||||
f6,
|
||||
f7,
|
||||
f8,
|
||||
f9,
|
||||
f10,
|
||||
f11,
|
||||
f12,
|
||||
f13,
|
||||
f14,
|
||||
f15,
|
||||
f16,
|
||||
f17,
|
||||
f18,
|
||||
f19,
|
||||
f20,
|
||||
f21,
|
||||
f22,
|
||||
f23,
|
||||
f24,
|
||||
f25,
|
||||
)
|
||||
|
||||
# Class annotations
|
||||
sig = inspect.signature(f0)
|
||||
|
||||
@@ -11,8 +11,14 @@ from docutils.parsers import rst
|
||||
from docutils.utils import new_document
|
||||
|
||||
from sphinx.transforms import ApplySourceWorkaround
|
||||
from sphinx.util.nodes import (NodeMatcher, apply_source_workaround, clean_astext,
|
||||
extract_messages, make_id, split_explicit_title)
|
||||
from sphinx.util.nodes import (
|
||||
NodeMatcher,
|
||||
apply_source_workaround,
|
||||
clean_astext,
|
||||
extract_messages,
|
||||
make_id,
|
||||
split_explicit_title,
|
||||
)
|
||||
|
||||
|
||||
def _transform(doctree):
|
||||
|
||||
@@ -4,8 +4,18 @@ import sys
|
||||
from numbers import Integral
|
||||
from struct import Struct
|
||||
from types import TracebackType
|
||||
from typing import (Any, Callable, Dict, Generator, List, NewType, Optional, Tuple, TypeVar,
|
||||
Union)
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Generator,
|
||||
List,
|
||||
NewType,
|
||||
Optional,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
)
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
Reference in New Issue
Block a user