Skip to content

Commit

Permalink
chore(mypy): docutils linting
Browse files Browse the repository at this point in the history
src/django_docutils/lib/roles/common.py:134: error: Too many arguments for "Text"  [call-arg]
src/django_docutils/lib/metadata/extract.py:57: error: Need more than 0 values to unpack (2 expected)  [misc]
src/django_docutils/lib/publisher.py:36: error: Need type annotation for "reader"  [var-annotated]
src/django_docutils/lib/publisher.py:48: error: Unused "type: ignore" comment  [unused-ignore]
src/django_docutils/lib/publisher.py:50: error: Unused "type: ignore" comment  [unused-ignore]
src/django_docutils/lib/publisher.py:124: error: Returning Any from function declared to return "document"  [no-any-return]
Found 6 errors in 3 files (checked 55 source files)
  • Loading branch information
tony committed Dec 24, 2024
1 parent 6242dff commit 219f9ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/django_docutils/lib/metadata/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def extract_metadata(document: nodes.document) -> dict[str, str]:
continue

if element.tagname == "field": # custom fields (e.g. summary)
assert len(element.children) == 2
name_elem, body_elem = element.children
assert isinstance(name_elem, (nodes.Text, nodes.Element))
assert isinstance(body_elem, (nodes.Text, nodes.Element))
Expand Down
8 changes: 4 additions & 4 deletions src/django_docutils/lib/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def publish_parts_from_doctree(
enable_exit_status: bool = False,
) -> dict[str, str]:
"""Render docutils doctree into docutils parts."""
reader = Reader(parser_name="null")
reader = Reader(parser_name="null") # type:ignore
pub = Publisher(
reader,
None,
Expand All @@ -45,9 +45,9 @@ def publish_parts_from_doctree(
if not writer and writer_name:
pub.set_writer(writer_name)
pub.process_programmatic_settings(
settings_spec, # type:ignore
settings_spec,
settings_overrides,
config_section, # type:ignore
config_section,
)
pub.set_destination(None, destination_path)
pub.publish(enable_exit_status=enable_exit_status)
Expand Down Expand Up @@ -121,7 +121,7 @@ def publish_doctree(
register_django_docutils_directives()
register_django_docutils_roles()

return docutils_publish_doctree(
return docutils_publish_doctree( # type:ignore
source=force_bytes(source),
settings_overrides=settings_overrides,
)
Expand Down
2 changes: 1 addition & 1 deletion src/django_docutils/lib/roles/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def url_handler(target):
if not has_explicit_title:
title = utils.unescape(remote_title)

sn = innernodeclass(title, title)
sn = innernodeclass(title)
rn = nodes.reference("", "", internal=True, refuri=url, classes=[name])
rn += sn
return [rn], []

0 comments on commit 219f9ee

Please sign in to comment.