Fix #4538: autodoc: `sphinx.ext.autodoc.Options` has been moved

This commit is contained in:
Takeshi KOMIYA
2018-02-04 15:11:14 +09:00
parent 499e3bc852
commit 212baa9740
3 changed files with 14 additions and 11 deletions

View File

@@ -18,6 +18,7 @@ Bugs fixed
* #4019: inheritance_diagram AttributeError stoping make process
* #4531: autosummary: methods are not treated as attributes
* #4538: autodoc: ``sphinx.ext.autodoc.Options`` has been moved
Testing
--------

View File

@@ -226,6 +226,18 @@ def between(marker, what=None, keepempty=False, exclude=False):
return process
# This class is used only in ``sphinx.ext.autodoc.directive``,
# But we define this class here to keep compatibility (see #4538)
class Options(dict):
"""A dict/attribute hybrid that returns None on nonexisting keys."""
def __getattr__(self, name):
# type: (unicode) -> Any
try:
return self[name.replace('_', '-')]
except KeyError:
return None
class Documenter(object):
"""
A Documenter knows how to autodocument a single object type. When

View File

@@ -12,7 +12,7 @@ from docutils.parsers.rst import Directive
from docutils.statemachine import ViewList
from docutils.utils import assemble_option_dict
from sphinx.ext.autodoc import get_documenters
from sphinx.ext.autodoc import Options, get_documenters
from sphinx.util import logging
from sphinx.util.docutils import switch_source_input
from sphinx.util.nodes import nested_parse_with_titles
@@ -43,16 +43,6 @@ class DummyOptionSpec(object):
return lambda x: x
class Options(dict):
"""A dict/attribute hybrid that returns None on nonexisting keys."""
def __getattr__(self, name):
# type: (unicode) -> Any
try:
return self[name.replace('_', '-')]
except KeyError:
return None
class DocumenterBridge(object):
"""A parameters container for Documenters."""