From 8fd1ab5ce381042a416832bde818914ab19f0c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 5 Jan 2024 18:37:34 +0100 Subject: [PATCH] ci: Ignore type warnings --- src/markdown_exec/processors.py | 2 +- src/markdown_exec/rendering.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/markdown_exec/processors.py b/src/markdown_exec/processors.py index 7e1a430..e335730 100644 --- a/src/markdown_exec/processors.py +++ b/src/markdown_exec/processors.py @@ -64,7 +64,7 @@ def run(self, root: Element) -> None: # noqa: D102 el = copy.copy(el) # noqa: PLW2901 # 'toc' extension's first pass (which we require to build heading stubs/ids) also edits the HTML. # Undo the permalink edit so we can pass this heading to the outer pass of the 'toc' extension. - if len(el) > 0 and el[-1].get("class") == self.md.treeprocessors["toc"].permalink_class: + if len(el) > 0 and el[-1].get("class") == self.md.treeprocessors["toc"].permalink_class: # type: ignore[attr-defined] del el[-1] self.headings.append(el) diff --git a/src/markdown_exec/rendering.py b/src/markdown_exec/rendering.py index 34ad3ec..1a33f32 100644 --- a/src/markdown_exec/rendering.py +++ b/src/markdown_exec/rendering.py @@ -221,11 +221,11 @@ def _mimic(md: Markdown, headings: list[Element], *, update_toc: bool = True) -> def _id_prefix(md: Markdown, prefix: str | None) -> Iterator[None]: MarkdownConverter.counter += 1 id_prepending_processor = md.treeprocessors[IdPrependingTreeprocessor.name] - id_prepending_processor.id_prefix = prefix if prefix is not None else f"exec-{MarkdownConverter.counter}--" + id_prepending_processor.id_prefix = prefix if prefix is not None else f"exec-{MarkdownConverter.counter}--" # type: ignore[attr-defined] try: yield finally: - id_prepending_processor.id_prefix = "" + id_prepending_processor.id_prefix = "" # type: ignore[attr-defined] class MarkdownConverter: @@ -243,7 +243,7 @@ def _original_md(self) -> Markdown: return getattr(self._md_ref, "_original_md", self._md_ref) def _report_headings(self, markup: Markup) -> None: - self._original_md.treeprocessors[InsertHeadings.name].headings[markup] = self._headings + self._original_md.treeprocessors[InsertHeadings.name].headings[markup] = self._headings # type: ignore[attr-defined] self._headings = [] def convert(self, text: str, stash: dict[str, str] | None = None, id_prefix: str | None = None) -> Markup: