Merge branch '5.1.x' into 5.x

This commit is contained in:
Jean-François B 2022-08-01 21:05:47 +02:00
commit f72a25ce76
5 changed files with 20 additions and 11 deletions

View File

@ -121,7 +121,7 @@ class RecipeDomain(Domain):
def get_objects(self):
for obj in self.data['recipes']:
yield(obj)
yield obj
def resolve_xref(self, env, fromdocname, builder, typ, target, node,
contnode):

View File

@ -248,8 +248,10 @@ class GoogleDocstring:
def _consume_indented_block(self, indent: int = 1) -> List[str]:
lines = []
line = self._lines.get(0)
while(not self._is_section_break() and
(not line or self._is_indented(line, indent))):
while (
not self._is_section_break() and
(not line or self._is_indented(line, indent))
):
lines.append(self._lines.next())
line = self._lines.get(0)
return lines

View File

@ -72,7 +72,8 @@ Inventory = Dict[str, Dict[str, InventoryItem]]
def get_type_hints(
obj: Any, globalns: Optional[Dict[str, Any]] = None, localns: Optional[Dict] = None
) -> Dict[str, Any]:
"""Return a dictionary containing type hints for a function, method, module or class object.
"""Return a dictionary containing type hints for a function, method, module or class
object.
This is a simple wrapper of `typing.get_type_hints()` that does not raise an error on
runtime.

View File

@ -1519,7 +1519,7 @@ def test_latex_labels(app, status, warning):
def test_latex_figure_in_admonition(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
assert(r'\begin{figure}[H]' in result)
assert r'\begin{figure}[H]' in result
def test_default_latex_documents():

View File

@ -95,8 +95,10 @@ class SetupTest(TestCase):
for name in Config._config_values:
has_config = False
for method_name, args, _kwargs in app.method_calls:
if(method_name == 'add_config_value' and
args[0] == name):
if (
method_name == 'add_config_value' and
args[0] == name
):
has_config = True
if not has_config:
self.fail('Config value was not added to app %s' % name)
@ -105,11 +107,15 @@ class SetupTest(TestCase):
has_skip_member = False
for method_name, args, _kwargs in app.method_calls:
if method_name == 'connect':
if(args[0] == 'autodoc-process-docstring' and
args[1] == _process_docstring):
if (
args[0] == 'autodoc-process-docstring' and
args[1] == _process_docstring
):
has_process_docstring = True
elif(args[0] == 'autodoc-skip-member' and
args[1] == _skip_member):
elif (
args[0] == 'autodoc-skip-member' and
args[1] == _skip_member
):
has_skip_member = True
if not has_process_docstring:
self.fail('autodoc-process-docstring never connected')