Refactor configuration file parsing

Now the time for importing the kitty.config module has been halved, from
16ms from 32ms on my machine. Also, the new architecture will eventually
allow for auto generating a bunch of python-to-C boilerplate code.
This commit is contained in:
Kovid Goyal
2021-05-31 17:40:49 +05:30
parent dd5715ce79
commit 6d7df1c5e8
47 changed files with 7051 additions and 2370 deletions
+7 -3
View File
@@ -14,19 +14,23 @@ from contextlib import suppress
from functools import lru_cache
from time import monotonic
from typing import (
Any, Callable, Dict, Generator, Iterable, List, Mapping, Match, NamedTuple,
Optional, Tuple, Union, cast
TYPE_CHECKING, Any, Callable, Dict, Generator, Iterable, List, Mapping,
Match, NamedTuple, Optional, Tuple, Union, cast
)
from .constants import (
appname, is_macos, is_wayland, read_kitty_resource, shell_path,
supports_primary_selection
)
from .options_stub import Options
from .rgb import Color, to_color
from .types import run_once
from .typing import AddressFamily, PopenType, Socket, StartupCtx
if TYPE_CHECKING:
from .options.types import Options
else:
Options = object
def expandvars(val: str, env: Mapping[str, str] = {}, fallback_to_os_env: bool = True) -> str: