Merge pull request #6368 from tk0miya/refactor_autodoc

Reduce warnings of autodoc in 2.0 branch
This commit is contained in:
Takeshi KOMIYA 2019-05-15 00:35:25 +09:00 committed by GitHub
commit 048fd3d09c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -400,9 +400,7 @@ class Documenter:
try:
args = self.format_args(**kwargs)
except TypeError:
warnings.warn("Documenter.format_args() takes keyword arguments "
"since Sphinx-2.1",
RemovedInSphinx40Warning)
# retry without arguments for old documenters
args = self.format_args()
except Exception as err:
logger.warning(__('error while formatting arguments for %s: %s') %

View File

@ -63,7 +63,7 @@ from typing import List, cast
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst.states import RSTStateMachine, state_classes
from docutils.parsers.rst.states import RSTStateMachine, Struct, state_classes
from docutils.statemachine import StringList
import sphinx
@ -175,7 +175,10 @@ _app = None # type: Sphinx
class FakeDirective(DocumenterBridge):
def __init__(self):
# type: () -> None
super().__init__({}, None, Options(), 0, None) # type: ignore
settings = Struct(tab_width=8)
document = Struct(settings=settings)
state = Struct(document=document)
super().__init__({}, None, Options(), 0, state) # type: ignore
def get_documenter(app, obj, parent):