mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-15 21:14:35 +02:00
Migrate type checker to ty
Much faster than mypy. Matches usage of ruff from same developer.
This commit is contained in:
@@ -17,7 +17,7 @@ from functools import lru_cache, partial
|
||||
from typing import Any, Callable, Dict, Iterable, Iterator, List, Tuple
|
||||
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst.roles import set_classes
|
||||
from docutils.parsers.rst.roles import normalize_options
|
||||
from pygments.lexer import RegexLexer
|
||||
from pygments.lexer import bygroups as untyped_bygroups
|
||||
from pygments.token import Comment, Error, Keyword, Literal, Name, Number, String, Whitespace
|
||||
@@ -221,7 +221,7 @@ def commit_role(
|
||||
prb = inliner.problematic(rawtext, rawtext, msg)
|
||||
return [prb], [msg]
|
||||
url = f'https://github.com/kovidgoyal/kitty/commit/{commit_id}'
|
||||
set_classes(options)
|
||||
normalize_options(options)
|
||||
short_id = subprocess.check_output(
|
||||
f'git rev-list --max-count=1 --abbrev-commit {commit_id}'.split()).decode('utf-8').strip()
|
||||
node = nodes.reference(rawtext, f'commit: {short_id}', refuri=url, **options)
|
||||
@@ -498,7 +498,7 @@ def link_role(
|
||||
return [prb], [msg]
|
||||
text, url = m.group(1, 2)
|
||||
url = url.replace(' ', '')
|
||||
set_classes(options)
|
||||
normalize_options(options)
|
||||
node = nodes.reference(rawtext, text, refuri=url, **options)
|
||||
return [node], []
|
||||
|
||||
@@ -672,7 +672,7 @@ def monkeypatch_man_writer() -> None:
|
||||
th += "\n"
|
||||
sh_tmpl: str = (".SH Name\n"
|
||||
"%(ktitle)s \\- %(subtitle)s\n")
|
||||
return th + sh_tmpl % di # type: ignore
|
||||
return th + sh_tmpl % di
|
||||
|
||||
setattr(ManualPageTranslator, 'header', header)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user