Skip to content

Commit f127126

Browse files
committed
Formatting
1 parent 759564a commit f127126

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

sphinx_inlinecode/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,11 @@ def add_code_blocks(file: Path, objects: Dict[str, Any], highlighter: "PythonLex
124124
else:
125125
target = get_target(viewcode_label.parent)
126126

127-
# this can happen if documentation is not structured perfectly
128-
# skipping keys which don't exist allow the documentation to be built even if the structure isn't perfect
129-
if target not in objects:
127+
if not (obj := objects.get(target)):
130128
continue
131129

132130
# Highlight and insert the source code block after the object signature
133-
code_block = get_code_block(target, objects[target], highlighter)
131+
code_block = get_code_block(target, obj, highlighter)
134132
doc_entry.append(code_block)
135133

136134
if viewcode_label: # Remove the viewcode link, if it exists

0 commit comments

Comments
 (0)