Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed Nov 4, 2023
1 parent 5c81008 commit 3027f1c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mkdocstrings_handlers/crystal/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def substitute(self, location: DocLocation) -> str:
data = {"file": location.filename[len(self.src_path) :], "line": location.line}
try:
return self.dest_url.format_map(
collections.ChainMap(data, _DictAccess(self), _crystal_info)
) # type: ignore
collections.ChainMap(data, _DictAccess(self), _crystal_info) # type: ignore[arg-type]
)
except KeyError as e:
raise PluginError(
f"The source_locations template {self.dest_url!r} did not resolve correctly: {e}"
Expand Down
6 changes: 4 additions & 2 deletions mkdocstrings_handlers/crystal/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import contextlib
import xml.etree.ElementTree as etree
from typing import TYPE_CHECKING, Any, Mapping, TypeVar
from typing import TYPE_CHECKING, Any, Mapping, TypeVar, cast

import jinja2
import markdown_callouts
Expand Down Expand Up @@ -105,7 +105,9 @@ def do_reference(self, path: str | DocPath, text: str | None = None) -> str:
def do_convert_markdown_ctx(
self, text: str, context: DocItem, heading_level: int, html_id: str
):
self._md.treeprocessors["mkdocstrings_crystal_xref"].context = context
cast(
_RefInsertingTreeprocessor, self._md.treeprocessors["mkdocstrings_crystal_xref"]
).context = context
return super().do_convert_markdown(text, heading_level=heading_level, html_id=html_id)

def _monkeypatch_highlight_function(self, default_lang: str):
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ allow-dict-calls-with-keyword-arguments = true

[tool.mypy]
warn_unreachable = true
allow_redefinition = true

[tool.pytest.ini_options]
addopts = "--tb=native"
Expand Down

0 comments on commit 3027f1c

Please sign in to comment.