Skip to content

Commit f11519b

Browse files
committed
chore: Update type ignore comments for ty
1 parent 2450211 commit f11519b

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

scripts/gen_credits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _extra_marker(req: Requirement) -> str | None:
5555
if not req.marker:
5656
return None
5757
try:
58-
return next(marker[2].value for marker in req.marker._markers if getattr(marker[0], "value", None) == "extra") # type: ignore[union-attr]
58+
return next(marker[2].value for marker in req.marker._markers if getattr(marker[0], "value", None) == "extra")
5959
except StopIteration:
6060
return None
6161

src/mkdocs_autorefs/_internal/backlinks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
_log = get_plugin_logger(__name__)
2323
except ImportError:
2424
# TODO: remove once support for MkDocs <1.5 is dropped
25-
_log = logging.getLogger(f"mkdocs.plugins.{__name__}") # type: ignore[assignment]
25+
_log = logging.getLogger(f"mkdocs.plugins.{__name__}")
2626

2727

2828
@dataclass(frozen=True, order=True)

src/mkdocs_autorefs/_internal/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
_log = get_plugin_logger(__name__)
4141
except ImportError:
4242
# TODO: Remove once support for MkDocs <1.5 is dropped.
43-
_log = logging.getLogger(f"mkdocs.plugins.{__name__}") # type: ignore[assignment]
43+
_log = logging.getLogger(f"mkdocs.plugins.{__name__}")
4444

4545

4646
class AutorefsConfig(Config):
@@ -345,7 +345,7 @@ def _get_breadcrumb(
345345
if isinstance(page, Page):
346346
if (parent_url := page.url) not in self._breadcrumbs_map:
347347
self._breadcrumbs_map[parent_url] = BacklinkCrumb(
348-
title=page.title,
348+
title=page.title, # ty:ignore[invalid-argument-type]
349349
url=parent_url,
350350
parent=parent_breadcrumb,
351351
)

src/mkdocs_autorefs/_internal/references.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
_log = get_plugin_logger(__name__)
4141
except ImportError:
4242
# TODO: remove once support for MkDocs <1.5 is dropped
43-
_log = logging.getLogger(f"mkdocs.plugins.{__name__}") # type: ignore[assignment]
43+
_log = logging.getLogger(f"mkdocs.plugins.{__name__}")
4444

4545

4646
AUTOREF_RE = re.compile(r"<autoref (?P<attrs>.*?)>(?P<title>.*?)</autoref>", flags=re.DOTALL)
@@ -115,7 +115,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
115115

116116
# Code based on
117117
# https://github.com/Python-Markdown/markdown/blob/8e7528fa5c98bf4652deb13206d6e6241d61630b/markdown/inlinepatterns.py#L780
118-
def handleMatch(self, m: Match[str], data: str) -> tuple[Element | None, int | None, int | None]: # type: ignore[override] # noqa: N802
118+
def handleMatch(self, m: Match[str], data: str) -> tuple[Element | None, int | None, int | None]: # noqa: N802
119119
"""Handle an element that matched.
120120
121121
Arguments:
@@ -141,7 +141,7 @@ def handleMatch(self, m: Match[str], data: str) -> tuple[Element | None, int | N
141141
return self._make_tag(identifier, text, slug=slug), m.start(0), end
142142

143143
def _unstash(self, identifier: str) -> str:
144-
stashed_nodes: dict[str, Element | str] = self.md.treeprocessors["inline"].stashed_nodes # type: ignore[attr-defined]
144+
stashed_nodes: dict[str, Element | str] = self.md.treeprocessors["inline"].stashed_nodes
145145

146146
def _repl(match: Match) -> str:
147147
el = stashed_nodes.get(match[1])
@@ -179,7 +179,7 @@ def _eval_id(self, data: str, index: int, text: str) -> tuple[str | None, str |
179179

180180
# Catch single stash entries, like the result of [`Foo`][].
181181
if match := INLINE_PLACEHOLDER_RE.fullmatch(identifier):
182-
stashed_nodes: dict[str, Element | str] = self.md.treeprocessors["inline"].stashed_nodes # type: ignore[attr-defined]
182+
stashed_nodes: dict[str, Element | str] = self.md.treeprocessors["inline"].stashed_nodes
183183
el = stashed_nodes.get(match[1])
184184
if isinstance(el, Element) and el.tag == "code":
185185
# The title was wrapped in backticks, we only keep the content,
@@ -626,7 +626,7 @@ def _find_url(
626626
for identifier in identifiers:
627627
try:
628628
return url_mapper(identifier)
629-
except KeyError:
629+
except KeyError: # noqa: PERF203
630630
pass
631631
raise KeyError(f"None of the identifiers {identifiers} were found")
632632

0 commit comments

Comments
 (0)