Skip to content

Commit 305dfea

Browse files
committed
Work around bad type definitions.
1 parent 8941d27 commit 305dfea

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/antsibull_docutils/markdown.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,11 @@ def render_as_markdown(
729729
# pylint: disable=duplicate-code
730730
parts = publish_parts(
731731
source=source,
732-
source_path=source_path,
733-
destination_path=destination_path,
732+
# The type information for the following two parameters seems to be wrong.
733+
# According to the docutils sources the expected type is StrPath | None, which
734+
# is defined as str | os.PathLike[str] | None.
735+
source_path=source_path, # type: ignore
736+
destination_path=destination_path, # type: ignore
734737
parser_name=parser_name,
735738
writer=MarkDownWriter(document_context),
736739
settings_overrides=get_docutils_publish_settings(

src/antsibull_docutils/rst_code_finder.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,12 @@ def _parse_document(
286286

287287
# Parse the document
288288
try:
289+
# mypy gives errors for the next line, but this is literally what docutils itself
290+
# is also doing. So we're going to ignore this error...
289291
return publisher.reader.read(
290-
publisher.source, publisher.parser, publisher.settings
292+
publisher.source,
293+
publisher.parser,
294+
publisher.settings, # type: ignore
291295
)
292296
except SystemMessage as exc:
293297
raise ValueError(f"Cannot parse document: {exc}") from exc

0 commit comments

Comments
 (0)