This commit is contained in:
Kovid Goyal 2026-03-17 08:32:38 +05:30
parent c977d1edcb
commit 02a34ecd04
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -9,7 +9,7 @@ from collections.abc import Callable, Iterable, Iterator
from functools import lru_cache
from importlib import import_module
from re import Match
from typing import Any, Optional, Union, cast
from typing import Any, Optional, Sequence, Union, cast
import kitty.conf.utils as generic_parsers
from kitty.constants import website_url
@ -244,7 +244,7 @@ class Option:
def is_color_table_color(self) -> bool:
return self.name.startswith('color') and self.name[5:].isdigit()
def as_conf(self, commented: bool = False, level: int = 0, option_group: list['Option'] = []) -> list[str]:
def as_conf(self, commented: bool = False, level: int = 0, option_group: Sequence['Option'] = ()) -> list[str]:
ans: list[str] = []
a = ans.append
if not self.documented:
@ -264,13 +264,13 @@ class Option:
def as_rst(
self, conf_name: str, shortcut_slugs: dict[str, tuple[str, str]],
kitty_mod: str, level: int = 0, option_group: list['Option'] = []
kitty_mod: str, level: int = 0, option_group: Sequence['Option'] = ()
) -> list[str]:
ans: list[str] = []
a = ans.append
if not self.documented:
return ans
mopts = [self] + option_group
mopts = [self] + list(option_group)
a('.. opt:: ' + ', '.join(f'{conf_name}.{mo.name}' for mo in mopts))
if any(mo.defval_as_string for mo in mopts):
a('.. code-block:: conf')