From db4dd6c9f90dbdeed00eef42fcbe5699903c6782 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 15 May 2019 00:09:58 +0900 Subject: [PATCH 1/2] Fix FakeDirective emits warnings --- sphinx/ext/autosummary/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index 656e67bf1..70d501f85 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -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): From 0489fad63a9213584e3c34e9d14e0e9b8c801fea Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 15 May 2019 00:09:59 +0900 Subject: [PATCH 2/2] Do not emit warning for Documenter.format_args() --- sphinx/ext/autodoc/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 26936956e..d6cebb2a1 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -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') %