mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #6121 from tk0miya/refactor_NoUri
refactor: move NoUri to sphinx.errors
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -13,6 +13,7 @@ Incompatible changes
|
|||||||
Deprecated
|
Deprecated
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* ``sphinx.environment.NoUri``
|
||||||
* ``sphinx.ext.autodoc.importer.MockFinder``
|
* ``sphinx.ext.autodoc.importer.MockFinder``
|
||||||
* ``sphinx.ext.autodoc.importer.MockLoader``
|
* ``sphinx.ext.autodoc.importer.MockLoader``
|
||||||
* ``sphinx.ext.autodoc.importer.mock()``
|
* ``sphinx.ext.autodoc.importer.mock()``
|
||||||
@@ -21,6 +22,8 @@ Deprecated
|
|||||||
* ``sphinx.util.i18n.find_catalog_files()``
|
* ``sphinx.util.i18n.find_catalog_files()``
|
||||||
* ``sphinx.util.i18n.find_catalog_source_files()``
|
* ``sphinx.util.i18n.find_catalog_source_files()``
|
||||||
|
|
||||||
|
For more details, see :ref:`deprecation APIs list <dev-deprecated-apis>`.
|
||||||
|
|
||||||
Features added
|
Features added
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|||||||
@@ -234,6 +234,11 @@ The following is a list of deprecated interfaces.
|
|||||||
- (will be) Removed
|
- (will be) Removed
|
||||||
- Alternatives
|
- Alternatives
|
||||||
|
|
||||||
|
* - ``sphinx.environment.NoUri``
|
||||||
|
- 2.1
|
||||||
|
- 4.0
|
||||||
|
- ``sphinx.errors.NoUri``
|
||||||
|
|
||||||
* - ``sphinx.ext.autodoc.importer.MockFinder``
|
* - ``sphinx.ext.autodoc.importer.MockFinder``
|
||||||
- 2.1
|
- 2.1
|
||||||
- 4.0
|
- 4.0
|
||||||
|
|||||||
@@ -23,9 +23,8 @@ from sphinx.builders.latex.transforms import (
|
|||||||
)
|
)
|
||||||
from sphinx.builders.latex.util import ExtBabel
|
from sphinx.builders.latex.util import ExtBabel
|
||||||
from sphinx.config import ENUM
|
from sphinx.config import ENUM
|
||||||
from sphinx.environment import NoUri
|
|
||||||
from sphinx.environment.adapters.asset import ImageAdapter
|
from sphinx.environment.adapters.asset import ImageAdapter
|
||||||
from sphinx.errors import SphinxError
|
from sphinx.errors import NoUri, SphinxError
|
||||||
from sphinx.locale import _, __
|
from sphinx.locale import _, __
|
||||||
from sphinx.transforms import SphinxTransformer
|
from sphinx.transforms import SphinxTransformer
|
||||||
from sphinx.util import texescape, logging, progress_message, status_iterator
|
from sphinx.util import texescape, logging, progress_message, status_iterator
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from docutils.io import FileOutput
|
|||||||
|
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx.builders import Builder
|
from sphinx.builders import Builder
|
||||||
from sphinx.environment import NoUri
|
from sphinx.errors import NoUri
|
||||||
from sphinx.locale import __
|
from sphinx.locale import __
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util import progress_message
|
from sphinx.util import progress_message
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ from docutils.io import FileOutput
|
|||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx import package_dir
|
from sphinx import package_dir
|
||||||
from sphinx.builders import Builder
|
from sphinx.builders import Builder
|
||||||
from sphinx.environment import NoUri
|
|
||||||
from sphinx.environment.adapters.asset import ImageAdapter
|
from sphinx.environment.adapters.asset import ImageAdapter
|
||||||
|
from sphinx.errors import NoUri
|
||||||
from sphinx.locale import _, __
|
from sphinx.locale import _, __
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util import progress_message, status_iterator
|
from sphinx.util import progress_message, status_iterator
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from sphinx import addnodes
|
|||||||
from sphinx.deprecation import RemovedInSphinx40Warning
|
from sphinx.deprecation import RemovedInSphinx40Warning
|
||||||
from sphinx.directives import ObjectDescription
|
from sphinx.directives import ObjectDescription
|
||||||
from sphinx.domains import Domain, ObjType
|
from sphinx.domains import Domain, ObjType
|
||||||
from sphinx.environment import NoUri
|
from sphinx.errors import NoUri
|
||||||
from sphinx.locale import _, __
|
from sphinx.locale import _, __
|
||||||
from sphinx.roles import XRefRole
|
from sphinx.roles import XRefRole
|
||||||
from sphinx.transforms import SphinxTransform
|
from sphinx.transforms import SphinxTransform
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ from sphinx import addnodes
|
|||||||
from sphinx.deprecation import RemovedInSphinx30Warning
|
from sphinx.deprecation import RemovedInSphinx30Warning
|
||||||
from sphinx.directives import ObjectDescription
|
from sphinx.directives import ObjectDescription
|
||||||
from sphinx.domains import Domain, ObjType
|
from sphinx.domains import Domain, ObjType
|
||||||
|
from sphinx.errors import NoUri
|
||||||
from sphinx.locale import _, __
|
from sphinx.locale import _, __
|
||||||
from sphinx.roles import XRefRole
|
from sphinx.roles import XRefRole
|
||||||
from sphinx.util import ws_re, logging, docname_join
|
from sphinx.util import ws_re, logging, docname_join
|
||||||
@@ -838,8 +839,6 @@ class StandardDomain(Domain):
|
|||||||
|
|
||||||
def _resolve_citation_xref(self, env, fromdocname, builder, typ, target, node, contnode):
|
def _resolve_citation_xref(self, env, fromdocname, builder, typ, target, node, contnode):
|
||||||
# type: (BuildEnvironment, str, Builder, str, str, addnodes.pending_xref, nodes.Element) -> nodes.Element # NOQA
|
# type: (BuildEnvironment, str, Builder, str, str, addnodes.pending_xref, nodes.Element) -> nodes.Element # NOQA
|
||||||
from sphinx.environment import NoUri
|
|
||||||
|
|
||||||
docname, labelid, lineno = self.data['citations'].get(target, ('', '', 0))
|
docname, labelid, lineno = self.data['citations'].get(target, ('', '', 0))
|
||||||
if not docname:
|
if not docname:
|
||||||
if 'ids' in node:
|
if 'ids' in node:
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ from io import BytesIO
|
|||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
from sphinx.deprecation import (
|
||||||
|
RemovedInSphinx30Warning, RemovedInSphinx40Warning, deprecated_alias
|
||||||
|
)
|
||||||
from sphinx.environment.adapters.toctree import TocTree
|
from sphinx.environment.adapters.toctree import TocTree
|
||||||
from sphinx.errors import SphinxError, BuildEnvironmentError, DocumentError, ExtensionError
|
from sphinx.errors import SphinxError, BuildEnvironmentError, DocumentError, ExtensionError
|
||||||
from sphinx.locale import __
|
from sphinx.locale import __
|
||||||
@@ -78,11 +80,6 @@ versioning_conditions = {
|
|||||||
} # type: Dict[str, Union[bool, Callable]]
|
} # type: Dict[str, Union[bool, Callable]]
|
||||||
|
|
||||||
|
|
||||||
class NoUri(Exception):
|
|
||||||
"""Raised by get_relative_uri if there is no URI available."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class BuildEnvironment:
|
class BuildEnvironment:
|
||||||
"""
|
"""
|
||||||
The environment in which the ReST files are translated.
|
The environment in which the ReST files are translated.
|
||||||
@@ -784,3 +781,13 @@ class BuildEnvironment:
|
|||||||
node['version'] = version
|
node['version'] = version
|
||||||
node.line = lineno
|
node.line = lineno
|
||||||
self.get_domain('changeset').note_changeset(node) # type: ignore
|
self.get_domain('changeset').note_changeset(node) # type: ignore
|
||||||
|
|
||||||
|
|
||||||
|
from sphinx.errors import NoUri # NOQA
|
||||||
|
|
||||||
|
|
||||||
|
deprecated_alias('sphinx.environment',
|
||||||
|
{
|
||||||
|
'NoUri': NoUri,
|
||||||
|
},
|
||||||
|
RemovedInSphinx30Warning)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import re
|
|||||||
import unicodedata
|
import unicodedata
|
||||||
from itertools import groupby
|
from itertools import groupby
|
||||||
|
|
||||||
|
from sphinx.errors import NoUri
|
||||||
from sphinx.locale import _, __
|
from sphinx.locale import _, __
|
||||||
from sphinx.util import split_into, logging
|
from sphinx.util import split_into, logging
|
||||||
|
|
||||||
@@ -33,8 +34,6 @@ class IndexEntries:
|
|||||||
_fixre=re.compile(r'(.*) ([(][^()]*[)])')):
|
_fixre=re.compile(r'(.*) ([(][^()]*[)])')):
|
||||||
# type: (Builder, bool, Pattern) -> List[Tuple[str, List[Tuple[str, Any]]]]
|
# type: (Builder, bool, Pattern) -> List[Tuple[str, List[Tuple[str, Any]]]]
|
||||||
"""Create the real index from the collected index entries."""
|
"""Create the real index from the collected index entries."""
|
||||||
from sphinx.environment import NoUri
|
|
||||||
|
|
||||||
new = {} # type: Dict[str, List]
|
new = {} # type: Dict[str, List]
|
||||||
|
|
||||||
def add_entry(word, subword, main, link=True, dic=new, key=None):
|
def add_entry(word, subword, main, link=True, dic=new, key=None):
|
||||||
|
|||||||
@@ -121,3 +121,8 @@ class PycodeError(Exception):
|
|||||||
if len(self.args) > 1:
|
if len(self.args) > 1:
|
||||||
res += ' (exception was: %r)' % self.args[1]
|
res += ' (exception was: %r)' % self.args[1]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
class NoUri(Exception):
|
||||||
|
"""Raised by builder.get_relative_uri() if there is no URI available."""
|
||||||
|
pass
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from docutils.parsers.rst import directives
|
|||||||
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
|
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
|
||||||
|
|
||||||
import sphinx
|
import sphinx
|
||||||
from sphinx.environment import NoUri
|
from sphinx.errors import NoUri
|
||||||
from sphinx.locale import _, __
|
from sphinx.locale import _, __
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util.docutils import SphinxDirective
|
from sphinx.util.docutils import SphinxDirective
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from typing import cast
|
|||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx.environment import NoUri
|
from sphinx.errors import NoUri
|
||||||
from sphinx.locale import __
|
from sphinx.locale import __
|
||||||
from sphinx.transforms import SphinxTransform
|
from sphinx.transforms import SphinxTransform
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
|
|||||||
Reference in New Issue
Block a user