Skip to content

Commit aba5559

Browse files
committed
docs(_ext) Fix mypy ClassVar errors in Pygments lexers
why: mypy treated `filenames: list[str]` as an instance variable, conflicting with Lexer base class's ClassVar declaration. what: - Add `import typing as t` to both lexer modules - Annotate `filenames` as `t.ClassVar[list[str]]` in VcspullOutputLexer and VcspullConsoleLexer - Remove now-redundant `# noqa: RUF012` suppression comments
1 parent 8066bd6 commit aba5559

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

docs/_ext/vcspull_console_lexer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from __future__ import annotations
88

99
import re
10+
import typing as t
1011

1112
from pygments.lexer import Lexer, do_insertions, line_re # type: ignore[attr-defined]
1213
from pygments.lexers.shell import BashLexer
@@ -33,7 +34,7 @@ class VcspullConsoleLexer(Lexer):
3334

3435
name = "Vcspull Console"
3536
aliases = ["vcspull-console"] # noqa: RUF012
36-
filenames: list[str] = [] # noqa: RUF012
37+
filenames: t.ClassVar[list[str]] = []
3738
mimetypes = ["text/x-vcspull-console"] # noqa: RUF012
3839

3940
_venv = re.compile(r"^(\([^)]*\))(\s*)")

docs/_ext/vcspull_output_lexer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from __future__ import annotations
88

9+
import typing as t
10+
911
from pygments.lexer import RegexLexer, bygroups
1012
from pygments.token import (
1113
Comment,
@@ -45,7 +47,7 @@ class VcspullOutputLexer(RegexLexer):
4547

4648
name = "vcspull Output"
4749
aliases = ["vcspull-output", "vcspull"] # noqa: RUF012
48-
filenames: list[str] = [] # noqa: RUF012
50+
filenames: t.ClassVar[list[str]] = []
4951
mimetypes = ["text/x-vcspull-output"] # noqa: RUF012
5052

5153
tokens = { # noqa: RUF012

0 commit comments

Comments
 (0)