mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #4547 from tk0miya/4538_autodoc_options
Fix #4538: autodoc: ``sphinx.ext.autodoc.Options`` has been moved
This commit is contained in:
commit
dbecbcdbf2
1
CHANGES
1
CHANGES
@ -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
|
||||
--------
|
||||
|
@ -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
|
||||
|
@ -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."""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user