Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2fb98f3

Browse files
committedJan 16, 2025·
Merge branch 'main' into fix-latest-sphinx
2 parents 74e2ca4 + f675265 commit 2fb98f3

File tree

7 files changed

+25
-16
lines changed

7 files changed

+25
-16
lines changed
 

‎.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
python -m pip install --upgrade pip
6363
python -m pip install ".[lint]"
6464
- name: Type check with mypy
65-
run: mypy --warn-redundant-casts --warn-unused-ignores breathe tests
65+
run: mypy --warn-redundant-casts --warn-unused-ignores --python-version 3.9 breathe tests
6666

6767
twine:
6868
runs-on: ubuntu-latest

‎Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ black:
4444

4545
.PHONY: type-check
4646
type-check:
47-
mypy --warn-redundant-casts --warn-unused-ignores breathe tests
47+
mypy --warn-redundant-casts --warn-unused-ignores --python-version 3.9 breathe tests

‎breathe/directives/content_block.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ class DoxygenNamespaceDirective(_DoxygenContentBlockDirective):
106106
class DoxygenGroupDirective(_DoxygenContentBlockDirective):
107107
kind = "group"
108108
option_spec = _DoxygenContentBlockDirective.option_spec.copy()
109-
option_spec.update({
110-
"inner": flag,
111-
"no-title": flag
112-
})
109+
option_spec.update(
110+
{
111+
"inner": flag,
112+
"no-title": flag,
113+
}
114+
)
113115

114116

115117
class DoxygenPageDirective(_DoxygenContentBlockDirective):

‎breathe/parser/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class ParserError(Exception):
13-
def __init__(self, error: Exception, filename: str):
13+
def __init__(self, error: Exception, filename: Path):
1414
super().__init__(error)
1515

1616
self.error = error
@@ -21,7 +21,7 @@ def __str__(self):
2121

2222

2323
class FileIOError(Exception):
24-
def __init__(self, error: Exception, filename: str):
24+
def __init__(self, error: Exception, filename: Path):
2525
super().__init__(error)
2626

2727
self.error = error

‎breathe/renderer/filter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def allow(self, node_stack) -> bool:
453453
# If the target_file contains directory separators then
454454
# match against the same length at the end of the location
455455
#
456-
location_match = location[-len(self.target_file):]
456+
location_match = location[-len(self.target_file) :]
457457
return location_match == self.target_file
458458
else:
459459
# If there are no separators, match against the whole filename

‎breathe/renderer/sphinxrenderer.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ def pullup(node, typ, dest):
920920
if self.app.config.breathe_order_parameters_first:
921921
return detailed + fieldLists + admonitions
922922
else:
923-
return detailed + admonitions + fieldLists
923+
return detailed + admonitions + fieldLists # type: ignore[operator]
924924

925925
def update_signature(self, signature, obj_type):
926926
"""Update the signature node if necessary, e.g. add qualifiers."""
@@ -1204,9 +1204,15 @@ def render_signature(file_data, doxygen_target, name, kind):
12041204

12051205
# Set up the title
12061206

1207-
if kind in ["group", "page"] and file_data.compounddef and file_data.compounddef.title:
1207+
if (
1208+
kind in ["group", "page"]
1209+
and file_data.compounddef
1210+
and file_data.compounddef.title
1211+
):
12081212
if "no-title" not in options:
1209-
full_title = " ".join([i.getValue() for i in file_data.compounddef.title.content_])
1213+
full_title = " ".join(
1214+
[i.getValue() for i in file_data.compounddef.title.content_]
1215+
)
12101216
title_signode.append(nodes.emphasis(text=kind))
12111217
title_signode.append(nodes.Text(" "))
12121218
title_signode.append(addnodes.desc_name(text=full_title))
@@ -1883,7 +1889,7 @@ def visit_docrow(self, node) -> List[Node]:
18831889
row = nodes.row()
18841890
cols = self.render_iterable(node.entry)
18851891
elem: Union[nodes.thead, nodes.tbody]
1886-
if all(col.get("heading", False) for col in cols):
1892+
if all(col.get("heading", False) for col in cols): # type: ignore[attr-defined]
18871893
elem = nodes.thead()
18881894
else:
18891895
elem = nodes.tbody()
@@ -1906,9 +1912,9 @@ def visit_doctable(self, node) -> List[Node]:
19061912
# "envelop" rows there, namely thead and tbody (eg it will need to be updated
19071913
# if Doxygen one day adds support for tfoot)
19081914

1909-
tags: Dict[str, List] = {row.starttag(): [] for row in rows}
1915+
tags: Dict[str, List] = {row.starttag(): [] for row in rows} # type: ignore[attr-defined]
19101916
for row in rows:
1911-
tags[row.starttag()].append(row.next_node())
1917+
tags[row.starttag()].append(row.next_node()) # type: ignore[attr-defined]
19121918

19131919
def merge_row_types(root, elem, elems):
19141920
for node in elems:
@@ -2031,7 +2037,7 @@ def visit_function(self, node) -> List[Node]:
20312037
# Insert Doxygen target into the first signature node.
20322038
if not self.app.env.config.breathe_debug_trace_doxygen_ids:
20332039
target = self.create_doxygen_target(node)
2034-
rst_node.children[0].insert(0, target)
2040+
rst_node.children[0].insert(0, target) # type: ignore[attr-defined]
20352041

20362042
finder.content.extend(self.description(node))
20372043
return nodes_

‎tests/test_renderer.py

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def mask(self, node):
168168
class MockContext:
169169
def __init__(self, app, node_stack, domain=None, options=[]):
170170
from docutils.statemachine import StringList
171+
171172
self.domain = domain
172173
self.node_stack = node_stack
173174
self.directive_args = [

0 commit comments

Comments
 (0)
Please sign in to comment.