Skip to content

Commit

Permalink
ci: resolve mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKing committed Jun 23, 2024
1 parent 4e2f15f commit 7c263ad
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mdformat_mkdocs/mdit_plugins/_mkdocstrings_autorefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _mkdocstrings_autorefs_plugin(state: StateInline, silent: bool) -> bool:
return True

anchor = match["anchor"]
with new_token(state, MKDOCSTRINGS_AUTOREFS_PREFIX, "a") as token: # type: ignore[arg-type]
with new_token(state, MKDOCSTRINGS_AUTOREFS_PREFIX, "a") as token:
token.attrs = {"id": anchor, "href": ""}
token.meta = {"content": f"[](){{#{anchor}}}"}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _mkdocstrings_crossreference(state: StateInline, silent: bool) -> bool:
original_pos_max = state.posMax
state.pos += 1
state.posMax = state.pos + len(match["link"])
with new_token(state, MKDOCSTRINGS_CROSSREFERENCE_PREFIX, "a") as token: # type: ignore[arg-type]
with new_token(state, MKDOCSTRINGS_CROSSREFERENCE_PREFIX, "a") as token:
token.attrs = {"href": f'#{match["href"] or match["link"]}'}
token.meta = {"content": match.group()}

Expand Down
6 changes: 3 additions & 3 deletions mdformat_mkdocs/mdit_plugins/_pymd_abbreviations.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
PYMD_ABBREVIATIONS_PREFIX = "mkdocs_abbreviation"


def _new_match(state: StateBlock, start_line: int) -> re.Match | None:
def _new_match(state: StateBlock, start_line: int) -> re.Match[str] | None:
"""Determine match between start and end lines."""
start = state.bMarks[start_line] + state.tShift[start_line]
maximum = state.eMarks[start_line]
Expand Down Expand Up @@ -61,15 +61,15 @@ def _pymd_abbreviations(
return False

match = _new_match(state, start_line)
if not match:
if match is None:
return False

if silent:
return True

matches = [match]
max_line = start_line
while match:
while match is not None:
if max_line == end_line:
break
if match := _new_match(state, max_line + 1):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ classifiers = [
]
dependencies = [
"mdformat >= 0.7.17",
"mdformat-admon >= 2.0.3",
"mdformat-admon >= 2.0.5",
"mdformat-gfm >= 0.3.6",
"mdit-py-plugins >= 0.4.1",
"more-itertools >= 10.2.0",
Expand Down

0 comments on commit 7c263ad

Please sign in to comment.