import warnings from typing import Any, Dict from sphinxcontrib.applehelp import ( AppleHelpCodeSigningFailed, AppleHelpIndexerFailed, AppleHelpBuilder, ) from sphinx.application import Sphinx from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias deprecated_alias( 'sphinx.builders.applehelp', { 'AppleHelpCodeSigningFailed': AppleHelpCodeSigningFailed, 'AppleHelpIndexerFailed': AppleHelpIndexerFailed, 'AppleHelpBuilder': AppleHelpBuilder, }, RemovedInSphinx40Warning) def setup(app: Sphinx) -> Dict[str, Any]: warnings.warn( 'sphinx.builders.applehelp has been moved to sphinxcontrib-applehelp.', RemovedInSphinx40Warning) app.setup_extension('sphinxcontrib.applehelp') return { 'version': 'builtin', 'parallel_read_safe': True, 'parallel_write_safe': True, }
def run(self) -> List[Node]: domain_name = self.arguments[0].lower() # if domain_name not in env.domains: # # try searching by label # for domain in env.domains.values(): # if domain.label.lower() == domain_name: # domain_name = domain.name # break self.env.temp_data['default_domain'] = self.env.domains.get( domain_name) return [] deprecated_alias('sphinx.directives', { 'DescDirective': ObjectDescription, }, RemovedInSphinx50Warning, { 'DescDirective': 'sphinx.directives.ObjectDescription', }) def setup(app: "Sphinx") -> Dict[str, Any]: app.add_config_value("strip_signature_backslash", False, 'env') directives.register_directive('default-role', DefaultRole) directives.register_directive('default-domain', DefaultDomain) directives.register_directive('describe', ObjectDescription) # new, more consistent, name directives.register_directive('object', ObjectDescription) app.add_event('object-description-transform') return {
params = annotation.__args__ # type: ignore else: # typing.Callable args = ', '.join( stringify(arg) for arg in annotation.__args__[:-1]) # type: ignore result = stringify(annotation.__args__[-1]) # type: ignore return '%s[[%s], %s]' % (qualname, args, result) if params is not None: param_str = ', '.join(stringify(p) for p in params) return '%s[%s]' % (qualname, param_str) elif (hasattr(annotation, '__origin__') and annotation.__origin__ is typing.Union): params = annotation.__args__ if params is not None: if len(params) > 1 and params[-1] is NoneType: if len(params) > 2: param_str = ", ".join(stringify(p) for p in params[:-1]) return 'Optional[Union[%s]]' % param_str else: return 'Optional[%s]' % stringify(params[0]) else: param_str = ', '.join(stringify(p) for p in params) return 'Union[%s]' % param_str return qualname deprecated_alias('sphinx.util.typing', { 'DirectiveOption': Callable[[str], Any], }, RemovedInSphinx60Warning)
from sphinx.directives.other import ( # noqa TocTree, Author, Index, VersionChange, SeeAlso, TabularColumns, Centered, Acks, HList, Only, Include, Class) from sphinx.directives.patches import ( # noqa Figure, Meta) deprecated_alias( 'sphinx.directives', { 'Highlight': Highlight, 'CodeBlock': CodeBlock, 'LiteralInclude': LiteralInclude, 'TocTree': TocTree, 'Author': Author, 'Index': Index, 'VersionChange': VersionChange, 'SeeAlso': SeeAlso, 'TabularColumns': TabularColumns, 'Centered': Centered, 'Acks': Acks, 'HList': HList, 'Only': Only, 'Include': Include, 'Class': Class, 'Figure': Figure, 'Meta': Meta, }, RemovedInSphinx40Warning) # backwards compatible old name (will be marked deprecated in 3.0) DescDirective = ObjectDescription def setup(app: "Sphinx") -> Dict[str, Any]:
.. _Devhelp: https://wiki.gnome.org/Apps/Devhelp :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import warnings from typing import Any, Dict from sphinxcontrib.devhelp import DevhelpBuilder from sphinx.application import Sphinx from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias deprecated_alias('sphinx.builders.devhelp', { 'DevhelpBuilder': DevhelpBuilder, }, RemovedInSphinx40Warning) def setup(app: Sphinx) -> Dict[str, Any]: warnings.warn( 'sphinx.builders.devhelp has been moved to sphinxcontrib-devhelp.', RemovedInSphinx40Warning) app.setup_extension('sphinxcontrib.devhelp') return { 'version': 'builtin', 'parallel_read_safe': True, 'parallel_write_safe': True, }
# TODO: this should be called tex_idescape_map because its only use is in # sphinx.writers.latex.LaTeXTranslator.idescape() # %, {, }, \, #, and ~ are the only ones which must be replaced by _ character # It would be simpler to define it entirely here rather than in init(). # Unicode replacements are superfluous, as idescape() uses backslashreplace tex_replace_map = {} # type: Dict[int, str] _tex_escape_map = {} # type: Dict[int, str] _tex_escape_map_without_unicode = {} # type: Dict[int, str] _tex_hlescape_map = {} # type: Dict[int, str] _tex_hlescape_map_without_unicode = {} # type: Dict[int, str] deprecated_alias( 'sphinx.util.texescape', { 'tex_escape_map': _tex_escape_map, 'tex_hl_escape_map_new': _tex_hlescape_map, }, RemovedInSphinx40Warning) def escape(s: str, latex_engine: str = None) -> str: """Escape text for LaTeX output.""" if latex_engine in ('lualatex', 'xelatex'): # unicode based LaTeX engine return s.translate(_tex_escape_map_without_unicode) else: return s.translate(_tex_escape_map) def hlescape(s: str, latex_engine: str = None) -> str: """Escape text for LaTeX highlighter."""
self.body.append('<span class="eqno">(%s)' % number) self.add_permalink_ref(node, _('Permalink to this equation')) self.body.append('</span>') if fname is None: # something failed -- use text-only as a bad substitute self.body.append('<span class="math">%s</span></p>\n</div>' % self.encode(node.astext()).strip()) else: self.body.append(('<img src="%s"' % fname) + get_tooltip(self, node) + '/></p>\n</div>') raise nodes.SkipNode deprecated_alias( 'sphinx.ext.imgmath', { 'DOC_BODY': DOC_BODY, 'DOC_BODY_PREVIEW': DOC_BODY_PREVIEW, 'DOC_HEAD': DOC_HEAD, }, RemovedInSphinx40Warning) def setup(app: Sphinx) -> Dict[str, Any]: app.add_html_math_renderer('imgmath', (html_visit_math, None), (html_visit_displaymath, None)) app.add_config_value('imgmath_image_format', 'png', 'html') app.add_config_value('imgmath_dvipng', 'dvipng', 'html') app.add_config_value('imgmath_dvisvgm', 'dvisvgm', 'html') app.add_config_value('imgmath_latex', 'latex', 'html') app.add_config_value('imgmath_use_preview', False, 'html') app.add_config_value('imgmath_dvipng_args', ['-gamma', '1.5', '-D', '110', '-bg', 'Transparent'],
from typing import Any, Dict from sphinxcontrib.htmlhelp import (HTMLHelpBuilder, chm_htmlescape, chm_locales, default_htmlhelp_basename) from sphinx.application import Sphinx from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias deprecated_alias( 'sphinx.builders.htmlhelp', { 'chm_locales': chm_locales, 'chm_htmlescape': chm_htmlescape, 'HTMLHelpBuilder': HTMLHelpBuilder, 'default_htmlhelp_basename': default_htmlhelp_basename, }, RemovedInSphinx40Warning, { 'chm_locales': 'sphinxcontrib.htmlhelp.chm_locales', 'chm_htmlescape': 'sphinxcontrib.htmlhelp.chm_htmlescape', 'HTMLHelpBuilder': 'sphinxcontrib.htmlhelp.HTMLHelpBuilder', 'default_htmlhelp_basename': 'sphinxcontrib.htmlhelp.default_htmlhelp_basename', }) def setup(app: Sphinx) -> Dict[str, Any]: warnings.warn( 'sphinx.builders.htmlhelp has been moved to sphinxcontrib-htmlhelp.', RemovedInSphinx40Warning, stacklevel=2) app.setup_extension('sphinxcontrib.htmlhelp')
# compile to a code object, handle syntax errors filepath_enc = filepath.encode(fs_encoding) try: code = compile(source, filepath_enc, 'exec') except SyntaxError: # maybe the file uses 2.x syntax; try to refactor to # 3.x syntax using 2to3 source = convert_with_2to3(filepath) code = compile(source, filepath_enc, 'exec') # TODO: When support for evaluating Python 2 syntax is removed, # deprecate convert_with_2to3(). logger.warning(__('Support for evaluating Python 2 syntax is deprecated ' 'and will be removed in Sphinx 4.0. ' 'Convert %s to Python 3 syntax.'), filepath) exec(code, _globals) deprecated_alias('sphinx.util.pycompat', { 'NoneType': NoneType, # type: ignore 'TextIOWrapper': io.TextIOWrapper, 'htmlescape': html.escape, 'indent': textwrap.indent, 'terminal_safe': terminal_safe, 'sys_encoding': sys.getdefaultencoding(), 'u': '', }, RemovedInSphinx40Warning)
:license: BSD, see LICENSE for details. """ import warnings from typing import Any, Dict from sphinxcontrib.qthelp import QtHelpBuilder, render_file import sphinx from sphinx.application import Sphinx from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias deprecated_alias('sphinx.builders.qthelp', { 'render_file': render_file, 'QtHelpBuilder': QtHelpBuilder, }, RemovedInSphinx40Warning, { 'render_file': 'sphinxcontrib.qthelp.render_file', 'QtHelpBuilder': 'sphinxcontrib.qthelp.QtHelpBuilder', }) def setup(app: Sphinx) -> Dict[str, Any]: warnings.warn( 'sphinx.builders.qthelp has been moved to sphinxcontrib-qthelp.', RemovedInSphinx40Warning) app.setup_extension('sphinxcontrib.qthelp') return { 'version': sphinx.__display_version__, 'parallel_read_safe': True,
def get_outfilename(self, pagename: str) -> str: if pagename == 'index' or pagename.endswith(SEP + 'index'): outfilename = path.join(self.outdir, os_path(pagename) + self.out_suffix) else: outfilename = path.join(self.outdir, os_path(pagename), 'index' + self.out_suffix) return outfilename # for compatibility deprecated_alias( 'sphinx.builders.html', { 'DirectoryHTMLBuilder': DirectoryHTMLBuilder, }, RemovedInSphinx40Warning, { 'DirectoryHTMLBuilder': 'sphinx.builders.dirhtml.DirectoryHTMLBuilder', }) def setup(app: Sphinx) -> Dict[str, Any]: app.setup_extension('sphinx.builders.html') app.add_builder(DirectoryHTMLBuilder) return { 'version': 'builtin', 'parallel_read_safe': True, 'parallel_write_safe': True, }
# type: (str, Any, Callable) -> None from sphinx.util.osutil import fs_encoding with open(filepath, 'rb') as f: source = f.read() # compile to a code object, handle syntax errors filepath_enc = filepath.encode(fs_encoding) try: code = compile(source, filepath_enc, 'exec') except SyntaxError: # maybe the file uses 2.x syntax; try to refactor to # 3.x syntax using 2to3 source = convert_with_2to3(filepath) code = compile(source, filepath_enc, 'exec') # TODO: When support for evaluating Python 2 syntax is removed, # deprecate convert_with_2to3(). logger.warning( __('Support for evaluating Python 2 syntax is deprecated ' 'and will be removed in Sphinx 4.0. ' 'Convert %s to Python 3 syntax.'), filepath) exec(code, _globals) deprecated_alias( 'sphinx.util.pycompat', { 'TextIOWrapper': io.TextIOWrapper, 'htmlescape': html.escape, 'indent': textwrap.indent, 'u': '', }, RemovedInSphinx40Warning)
if self.arguments[0].startswith('<') and \ self.arguments[0].endswith('>'): # docutils "standard" includes, do not do path processing return super().run() rel_filename, filename = self.env.relfn2path(self.arguments[0]) self.arguments[0] = filename self.env.note_included(filename) return super().run() # Import old modules here for compatibility from sphinx.domains.index import IndexDirective # NOQA deprecated_alias('sphinx.directives.other', { 'Index': IndexDirective, }, RemovedInSphinx40Warning, { 'Index': 'sphinx.domains.index.IndexDirective', }) def setup(app: "Sphinx") -> Dict[str, Any]: directives.register_directive('toctree', TocTree) directives.register_directive('sectionauthor', Author) directives.register_directive('moduleauthor', Author) directives.register_directive('codeauthor', Author) directives.register_directive('seealso', SeeAlso) directives.register_directive('tabularcolumns', TabularColumns) directives.register_directive('centered', Centered) directives.register_directive('acks', Acks) directives.register_directive('hlist', HList) directives.register_directive('only', Only)
import warnings from sphinxcontrib.devhelp import DevhelpBuilder from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias if False: # For type annotation from typing import Any, Dict # NOQA from sphinx.application import Sphinx # NOQA deprecated_alias('sphinx.builders.devhelp', { 'DevhelpBuilder': DevhelpBuilder, }, RemovedInSphinx40Warning) def setup(app): # type: (Sphinx) -> Dict[str, Any] warnings.warn('sphinx.builders.devhelp has been moved to sphinxcontrib-devhelp.', RemovedInSphinx40Warning) app.setup_extension('sphinxcontrib.devhelp') return { 'version': 'builtin', 'parallel_read_safe': True, 'parallel_write_safe': True, }
AppleHelpIndexerFailed, AppleHelpBuilder, ) from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias if False: # For type annotation from typing import Any, Dict # NOQA from sphinx.application import Sphinx # NOQA deprecated_alias('sphinx.builders.applehelp', { 'AppleHelpCodeSigningFailed': AppleHelpCodeSigningFailed, 'AppleHelpIndexerFailed': AppleHelpIndexerFailed, 'AppleHelpBuilder': AppleHelpBuilder, }, RemovedInSphinx40Warning) def setup(app): # type: (Sphinx) -> Dict[str, Any] warnings.warn('sphinx.builders.applehelp has been moved to sphinxcontrib-applehelp.', RemovedInSphinx40Warning) app.setup_extension('sphinxcontrib.applehelp') return { 'version': 'builtin', 'parallel_read_safe': True, 'parallel_write_safe': True,
# compile to a code object, handle syntax errors filepath_enc = filepath.encode(fs_encoding) try: code = compile(source, filepath_enc, 'exec') except SyntaxError: # maybe the file uses 2.x syntax; try to refactor to # 3.x syntax using 2to3 source = convert_with_2to3(filepath) code = compile(source, filepath_enc, 'exec') # TODO: When support for evaluating Python 2 syntax is removed, # deprecate convert_with_2to3(). logger.warning( __('Support for evaluating Python 2 syntax is deprecated ' 'and will be removed in Sphinx 4.0. ' 'Convert %s to Python 3 syntax.'), filepath) exec(code, _globals) deprecated_alias( 'sphinx.util.pycompat', { 'NoneType': NoneType, # type: ignore 'TextIOWrapper': io.TextIOWrapper, 'htmlescape': html.escape, 'indent': textwrap.indent, 'terminal_safe': terminal_safe, 'sys_encoding': sys.getdefaultencoding(), 'u': '', }, RemovedInSphinx40Warning)
tbody = cast(nodes.tbody, tgroup[-1]) rows = cast(List[nodes.row], tbody) for row in rows: col1_entry = cast(nodes.entry, row[0]) par = cast(nodes.paragraph, col1_entry[0]) for j, subnode in enumerate(list(par)): if isinstance(subnode, nodes.Text): new_text = subnode.astext().replace(" ", "\u00a0") par[j] = nodes.Text(new_text) except IndexError: pass # -- autodoc integration ------------------------------------------------------- deprecated_alias('sphinx.ext.autosummary', { '_app': None, }, RemovedInSphinx60Warning, {}) class FakeApplication: def __init__(self): self.doctreedir = None self.events = None self.extensions = {} self.srcdir = None self.config = Config() self.project = Project(None, None) self.registry = SphinxComponentRegistry() class FakeDirective(DocumenterBridge):
args.append_syspath, } if args.extensions: d['extensions'].extend(args.extensions) if args.quiet: d['quiet'] = True for ext in d['extensions'][:]: if ',' in ext: d['extensions'].remove(ext) d['extensions'].extend(ext.split(',')) if not args.dryrun: qs.generate(d, silent=True, overwrite=args.force, templatedir=args.templatedir) elif args.tocfile: create_modules_toc_file(modules, args, args.tocfile, args.templatedir) return 0 deprecated_alias('sphinx.ext.apidoc', { 'INITPY': '__init__.py', }, RemovedInSphinx40Warning) # So program can be started with "python -m sphinx.apidoc ..." if __name__ == "__main__": main()
sphinx.builders.latex.compat ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Compatibility module for LaTeX writer. This module will be removed after deprecation period. Don't use components in this modules directly. :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from sphinx.builders.latex.transforms import URI_SCHEMES, ShowUrlsTransform from sphinx.builders.latex.util import ExtBabel from sphinx.deprecation import ( RemovedInSphinx30Warning, RemovedInSphinx40Warning, deprecated_alias ) deprecated_alias('sphinx.writers.latex', { 'ShowUrlsTransform': ShowUrlsTransform, 'URI_SCHEMES': URI_SCHEMES, }, RemovedInSphinx30Warning) deprecated_alias('sphinx.writers.latex', { 'ExtBabel': ExtBabel, }, RemovedInSphinx40Warning)
deprecated_alias( 'sphinx.directives', { 'Highlight': Highlight, 'CodeBlock': CodeBlock, 'LiteralInclude': LiteralInclude, 'TocTree': TocTree, 'Author': Author, 'Index': IndexDirective, 'VersionChange': VersionChange, 'SeeAlso': SeeAlso, 'TabularColumns': TabularColumns, 'Centered': Centered, 'Acks': Acks, 'HList': HList, 'Only': Only, 'Include': Include, 'Class': Class, 'Figure': Figure, 'Meta': Meta, }, RemovedInSphinx40Warning, { 'Highlight': 'sphinx.directives.code.Highlight', 'CodeBlock': 'sphinx.directives.code.CodeBlock', 'LiteralInclude': 'sphinx.directives.code.LiteralInclude', 'TocTree': 'sphinx.directives.other.TocTree', 'Author': 'sphinx.directives.other.Author', 'Index': 'sphinx.directives.other.IndexDirective', 'VersionChange': 'sphinx.directives.other.VersionChange', 'SeeAlso': 'sphinx.directives.other.SeeAlso', 'TabularColumns': 'sphinx.directives.other.TabularColumns', 'Centered': 'sphinx.directives.other.Centered', 'Acks': 'sphinx.directives.other.Acks', 'HList': 'sphinx.directives.other.HList', 'Only': 'sphinx.directives.other.Only', 'Include': 'sphinx.directives.other.Include', 'Class': 'sphinx.directives.other.Class', 'Figure': 'sphinx.directives.patches.Figure', 'Meta': 'sphinx.directives.patches.Meta', })
encoding=env.config.source_encoding) pub = Publisher( reader=reader, parser=parser, writer=SphinxDummyWriter(), source_class=SphinxDummySourceClass, # type: ignore destination=NullOutput()) pub.process_programmatic_settings(None, env.settings, None) pub.set_source(source, filename) else: # Sphinx-2.0 style pub = Publisher(reader=reader, parser=parser, writer=SphinxDummyWriter(), source_class=SphinxFileInput, destination=NullOutput()) pub.process_programmatic_settings(None, env.settings, None) pub.set_source(source_path=filename) pub.publish() return pub.document deprecated_alias('sphinx.io', { 'FiletypeNotFoundError': FiletypeNotFoundError, 'get_filetype': get_filetype, }, RemovedInSphinx40Warning, { 'FiletypeNotFoundError': 'sphinx.errors.FiletypeNotFoundError', 'get_filetype': 'sphinx.util.get_filetype', })
from sphinx.locale import _, __ from sphinx.util import logging from sphinx.util.typing import RoleFunction logger = logging.getLogger(__name__) report_re = re.compile( '^(.+?:(?:\\d+)?): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) ') if TYPE_CHECKING: from sphinx.builders import Builder from sphinx.config import Config from sphinx.environment import BuildEnvironment deprecated_alias('sphinx.util.docutils', { '__version_info__': docutils.__version_info__, }, RemovedInSphinx70Warning, { '__version_info__': 'docutils.__version_info__', }) additional_nodes: Set[Type[Element]] = set() @contextmanager def docutils_namespace() -> Generator[None, None, None]: """Create namespace for reST parsers.""" try: _directives = copy(directives._directives) # type: ignore _roles = copy(roles._roles) # type: ignore yield finally: directives._directives = _directives # type: ignore
self.dump(self, f) @property def versionchanges(self): # type: () -> Dict[str, List[Tuple[str, str, int, str, str, str]]] warnings.warn( 'env.versionchanges() is deprecated. ' 'Please use ChangeSetDomain instead.', RemovedInSphinx30Warning, stacklevel=2) return self.domaindata['changeset']['changes'] def note_versionchange(self, type, version, node, lineno): # type: (str, str, addnodes.versionmodified, int) -> None warnings.warn( 'env.note_versionchange() is deprecated. ' 'Please use ChangeSetDomain.note_changeset() instead.', RemovedInSphinx30Warning, stacklevel=2) node['type'] = type node['version'] = version node.line = lineno self.get_domain('changeset').note_changeset(node) # type: ignore from sphinx.errors import NoUri # NOQA deprecated_alias('sphinx.environment', { 'NoUri': NoUri, }, RemovedInSphinx30Warning)
def run(self) -> List[Node]: if self.arguments[0].startswith('<') and \ self.arguments[0].endswith('>'): # docutils "standard" includes, do not do path processing return super().run() rel_filename, filename = self.env.relfn2path(self.arguments[0]) self.arguments[0] = filename self.env.note_included(filename) return super().run() # Import old modules here for compatibility from sphinx.domains.index import IndexDirective # NOQA deprecated_alias('sphinx.directives.other', { 'Index': IndexDirective, }, RemovedInSphinx40Warning) def setup(app: "Sphinx") -> Dict[str, Any]: directives.register_directive('toctree', TocTree) directives.register_directive('sectionauthor', Author) directives.register_directive('moduleauthor', Author) directives.register_directive('codeauthor', Author) directives.register_directive('seealso', SeeAlso) directives.register_directive('tabularcolumns', TabularColumns) directives.register_directive('centered', Centered) directives.register_directive('acks', Acks) directives.register_directive('hlist', HList) directives.register_directive('only', Only) directives.register_directive('include', Include)
manpage = ' '.join( [str(x) for x in node.children if isinstance(x, nodes.Text)]) pattern = r'^(?P<path>(?P<page>.+)[\(\.](?P<section>[1-9]\w*)?\)?)$' # noqa info = {'path': manpage, 'page': manpage, 'section': ''} r = re.match(pattern, manpage) if r: info = r.groupdict() node.attributes.update(info) from sphinx.domains.citation import ( # NOQA CitationDefinitionTransform, CitationReferenceTransform) deprecated_alias( 'sphinx.transforms', { 'CitationReferences': CitationReferenceTransform, 'SmartQuotesSkipper': CitationDefinitionTransform, }, RemovedInSphinx40Warning) def setup(app: "Sphinx") -> Dict[str, Any]: app.add_transform(ApplySourceWorkaround) app.add_transform(ExtraTranslatableNodes) app.add_transform(DefaultSubstitutions) app.add_transform(MoveModuleTargets) app.add_transform(HandleCodeBlocks) app.add_transform(SortIds) app.add_transform(DoctestTransform) app.add_transform(FigureAligner) app.add_transform(AutoNumbering) app.add_transform(AutoIndexUpgrader)
env, source=None, source_path=filename, # type: ignore encoding=env.config.source_encoding) pub = Publisher( reader=reader, parser=parser, writer=SphinxDummyWriter(), source_class=SphinxDummySourceClass, # type: ignore destination=NullOutput()) pub.process_programmatic_settings(None, env.settings, None) pub.set_source(source, filename) else: # Sphinx-2.0 style pub = Publisher(reader=reader, parser=parser, writer=SphinxDummyWriter(), source_class=SphinxFileInput, destination=NullOutput()) pub.process_programmatic_settings(None, env.settings, None) pub.set_source(source_path=filename) pub.publish() return pub.document deprecated_alias('sphinx.io', { 'FiletypeNotFoundError': FiletypeNotFoundError, 'get_filetype': get_filetype, }, RemovedInSphinx40Warning)
# additional pages from conf.py for pagename, template in self.config.html_additional_pages.items(): logger.info(' ' + pagename, nonl=True) self.handle_page(pagename, {}, template) if self.config.html_use_opensearch: logger.info(' opensearch', nonl=True) fn = path.join(self.outdir, '_static', 'opensearch.xml') self.handle_page('opensearch', {}, 'opensearch.xml', outfilename=fn) # for compatibility deprecated_alias('sphinx.builders.html', { 'SingleFileHTMLBuilder': SingleFileHTMLBuilder, }, RemovedInSphinx40Warning) def setup(app: Sphinx) -> Dict[str, Any]: app.setup_extension('sphinx.builders.html') app.add_builder(SingleFileHTMLBuilder) app.add_config_value('singlehtml_sidebars', lambda self: self.html_sidebars, 'html') return { 'version': 'builtin', 'parallel_read_safe': True, 'parallel_write_safe': True, }
.. _Devhelp: https://wiki.gnome.org/Apps/Devhelp :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import warnings from typing import Any, Dict from sphinxcontrib.devhelp import DevhelpBuilder from sphinx.application import Sphinx from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias deprecated_alias('sphinx.builders.devhelp', { 'DevhelpBuilder': DevhelpBuilder, }, RemovedInSphinx40Warning, {'DevhelpBuilder': 'sphinxcontrib.devhelp.DevhelpBuilder'}) def setup(app: Sphinx) -> Dict[str, Any]: warnings.warn( 'sphinx.builders.devhelp has been moved to sphinxcontrib-devhelp.', RemovedInSphinx40Warning) app.setup_extension('sphinxcontrib.devhelp') return { 'version': 'builtin', 'parallel_read_safe': True, 'parallel_write_safe': True, }
value = attrgetter(subject, name) directly_defined = name in obj_dict if name not in members: members[name] = Attribute(name, directly_defined, value) except AttributeError: continue if analyzer: # append instance attributes (cf. self.attr1) if analyzer knows from sphinx.ext.autodoc import INSTANCEATTR namespace = '.'.join(objpath) for (ns, name) in analyzer.find_attr_docs(): if namespace == ns and name not in members: members[name] = Attribute(name, True, INSTANCEATTR) return members from sphinx.ext.autodoc.mock import ( # NOQA _MockModule, _MockObject, MockFinder, MockLoader, mock) deprecated_alias( 'sphinx.ext.autodoc.importer', { '_MockModule': _MockModule, '_MockObject': _MockObject, 'MockFinder': MockFinder, 'MockLoader': MockLoader, 'mock': mock, }, RemovedInSphinx40Warning)
chm_locales, chm_htmlescape, HTMLHelpBuilder, default_htmlhelp_basename ) from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias if False: # For type annotation from typing import Any, Dict # NOQA from sphinx.application import Sphinx # NOQA deprecated_alias('sphinx.builders.devhelp', { 'chm_locales': chm_locales, 'chm_htmlescape': chm_htmlescape, 'HTMLHelpBuilder': HTMLHelpBuilder, 'default_htmlhelp_basename': default_htmlhelp_basename, }, RemovedInSphinx40Warning) def setup(app): # type: (Sphinx) -> Dict[str, Any] warnings.warn('sphinx.builders.htmlhelp has been moved to sphinxcontrib-htmlhelp.', RemovedInSphinx40Warning) app.setup_extension('sphinxcontrib.htmlhelp') return { 'version': 'builtin', 'parallel_read_safe': True, 'parallel_write_safe': True,
import warnings from sphinxcontrib.qthelp import QtHelpBuilder, render_file import sphinx from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias if False: # For type annotation from typing import Any, Dict # NOQA from sphinx.application import Sphinx # NOQA deprecated_alias('sphinx.builders.qthelp', { 'render_file': render_file, 'QtHelpBuilder': QtHelpBuilder, }, RemovedInSphinx40Warning) def setup(app): # type: (Sphinx) -> Dict[str, Any] warnings.warn('sphinx.builders.qthelp has been moved to sphinxcontrib-qthelp.', RemovedInSphinx40Warning) app.setup_extension('sphinxcontrib.qthelp') return { 'version': sphinx.__display_version__, 'parallel_read_safe': True, 'parallel_write_safe': True,
epilog = __('You can now process the JSON files in %(outdir)s.') implementation = jsonimpl implementation_dumps_unicode = True indexer_format = jsonimpl indexer_dumps_unicode = True out_suffix = '.fjson' globalcontext_filename = 'globalcontext.json' searchindex_filename = 'searchindex.json' deprecated_alias('sphinx.builders.html', { 'LAST_BUILD_FILENAME': LAST_BUILD_FILENAME, 'JSONHTMLBuilder': JSONHTMLBuilder, 'PickleHTMLBuilder': PickleHTMLBuilder, 'SerializingHTMLBuilder': SerializingHTMLBuilder, 'WebHTMLBuilder': PickleHTMLBuilder, }, RemovedInSphinx40Warning) def setup(app: Sphinx) -> Dict[str, Any]: app.setup_extension('sphinx.builders.html') app.add_builder(JSONHTMLBuilder) app.add_builder(PickleHTMLBuilder) app.add_message_catalog(__name__, path.join(package_dir, 'locales')) return { 'version': __version__, 'parallel_read_safe': True,