Skip to content

Fix TypeError when docutils can't provide a line #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: namespace-packages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/autodoc2/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def analyse_module(
if not file_path.is_dir():
node = AstroidBuilder().file_build(os.fsdecode(file_path), name)
else:
node = build_namespace_package_module(name, file_path.parts)
node = build_namespace_package_module(name, [str(file_path)])
yield from walk_node(
node, State(node.name.split(".", 1)[0], [], exclude_external_imports)
)
Expand Down
4 changes: 2 additions & 2 deletions src/autodoc2/sphinx/docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def run(self) -> list[nodes.Node]:
)
document.reporter.get_source_and_line = lambda li: (
source_path,
li + source_offset,
li + source_offset if li is not None else None,
)
with parsing_context():
parser.parse(item["doc"], document)
Expand Down Expand Up @@ -214,7 +214,7 @@ def change_source(
state.reporter.source = source_path
state.reporter.get_source_and_line = lambda li: (
source_path,
li + line_offset,
li + line_offset if li is not None else None,
)
yield
finally:
Expand Down