mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-21 03:27:55 +03:00
Minor strictness increases
This commit is contained in:
parent
5f06d3a427
commit
c912eef040
@ -14,7 +14,8 @@
|
|||||||
import time
|
import time
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import (
|
from typing import (
|
||||||
Any, Callable, Dict, Iterable, List, Match, Optional, Tuple, Union
|
Any, Callable, Dict, Iterable, List, Match, Optional, Sequence, Tuple,
|
||||||
|
Union
|
||||||
)
|
)
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
@ -27,13 +28,13 @@
|
|||||||
from sphinx.environment.adapters.toctree import TocTree # type: ignore
|
from sphinx.environment.adapters.toctree import TocTree # type: ignore
|
||||||
from sphinx.util.logging import getLogger # type: ignore
|
from sphinx.util.logging import getLogger # type: ignore
|
||||||
|
|
||||||
|
from kitty.conf.definition import Option, Shortcut # noqa
|
||||||
|
from kitty.constants import str_version # noqa
|
||||||
|
|
||||||
kitty_src = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
kitty_src = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
if kitty_src not in sys.path:
|
if kitty_src not in sys.path:
|
||||||
sys.path.insert(0, kitty_src)
|
sys.path.insert(0, kitty_src)
|
||||||
|
|
||||||
from kitty.constants import str_version # noqa
|
|
||||||
from kitty.conf.definition import Option, Sequence, Shortcut # noqa
|
|
||||||
|
|
||||||
|
|
||||||
# config {{{
|
# config {{{
|
||||||
# -- Project information -----------------------------------------------------
|
# -- Project information -----------------------------------------------------
|
||||||
|
@ -591,5 +591,5 @@ def main(args: List[str]) -> None:
|
|||||||
cd['options'] = OPTIONS
|
cd['options'] = OPTIONS
|
||||||
cd['help_text'] = help_text
|
cd['help_text'] = help_text
|
||||||
elif __name__ == '__conf__':
|
elif __name__ == '__conf__':
|
||||||
from .config import all_options
|
from .config_data import all_options
|
||||||
sys.all_options = all_options # type: ignore
|
sys.all_options = all_options # type: ignore
|
||||||
|
@ -31,7 +31,8 @@ class OptionDict(TypedDict):
|
|||||||
OptionDict = Dict[str, Any] # type: ignore
|
OptionDict = Dict[str, Any] # type: ignore
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .config import BadLine, KeyAction, KeySpec, SequenceMap # noqa
|
from .config import KeyAction, KeySpec, SequenceMap # noqa
|
||||||
|
from .conf.utils import BadLine # noqa
|
||||||
|
|
||||||
CONFIG_HELP = '''\
|
CONFIG_HELP = '''\
|
||||||
Specify a path to the configuration file(s) to use. All configuration files are
|
Specify a path to the configuration file(s) to use. All configuration files are
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
from . import fast_data_types as defines
|
from . import fast_data_types as defines
|
||||||
from .conf.definition import Option, Shortcut, option_func
|
from .conf.definition import Option, Shortcut, option_func
|
||||||
from .conf.utils import (
|
from .conf.utils import (
|
||||||
Color, choices, positive_float, positive_int, to_bool, to_cmdline,
|
choices, positive_float, positive_int, to_bool, to_cmdline, to_color,
|
||||||
to_color, to_color_or_none, unit_float
|
to_color_or_none, unit_float
|
||||||
)
|
)
|
||||||
from .constants import config_dir, is_macos
|
from .constants import config_dir, is_macos
|
||||||
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
||||||
from .layout import all_layouts
|
from .layout import all_layouts
|
||||||
from .rgb import color_as_int, color_as_sharp, color_from_int
|
from .rgb import Color, color_as_int, color_as_sharp, color_from_int
|
||||||
from .utils import log_error
|
from .utils import log_error
|
||||||
|
|
||||||
MINIMUM_FONT_SIZE = 4
|
MINIMUM_FONT_SIZE = 4
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
from . import ListedFont
|
from . import ListedFont
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from kitty.fast_data_types import CoreTextFont
|
from kitty.fast_data_types import CoreTextFont as C
|
||||||
CoreTextFont
|
CoreTextFont = C
|
||||||
|
|
||||||
|
|
||||||
attr_map = {(False, False): 'font_family',
|
attr_map = {(False, False): 'font_family',
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
from . import ListedFont
|
from . import ListedFont
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from kitty.fast_data_types import FontConfigPattern
|
from kitty.fast_data_types import FontConfigPattern as F
|
||||||
FontConfigPattern
|
FontConfigPattern = F
|
||||||
|
|
||||||
|
|
||||||
attr_map = {(False, False): 'font_family',
|
attr_map = {(False, False): 'font_family',
|
||||||
|
@ -26,13 +26,11 @@
|
|||||||
if is_macos:
|
if is_macos:
|
||||||
from .core_text import get_font_files as get_font_files_coretext, font_for_family as font_for_family_macos
|
from .core_text import get_font_files as get_font_files_coretext, font_for_family as font_for_family_macos
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .core_text import CoreTextFont
|
from .core_text import CoreTextFont # noqa
|
||||||
CoreTextFont
|
|
||||||
else:
|
else:
|
||||||
from .fontconfig import get_font_files as get_font_files_fontconfig, font_for_family as font_for_family_fontconfig
|
from .fontconfig import get_font_files as get_font_files_fontconfig, font_for_family as font_for_family_fontconfig
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .fontconfig import FontConfigPattern
|
from .fontconfig import FontConfigPattern # noqa
|
||||||
FontConfigPattern
|
|
||||||
|
|
||||||
FontObject = Union['CoreTextFont', 'FontConfigPattern']
|
FontObject = Union['CoreTextFont', 'FontConfigPattern']
|
||||||
current_faces: List[Tuple[FontObject, bool, bool]] = []
|
current_faces: List[Tuple[FontObject, bool, bool]] = []
|
||||||
|
@ -9,16 +9,19 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
from kitty.cli import get_defaults_from_seq, parse_args, parse_option_spec
|
from kitty.cli import get_defaults_from_seq, parse_args, parse_option_spec
|
||||||
from kitty.cli_stub import RCOptions
|
from kitty.cli_stub import RCOptions as R
|
||||||
from kitty.constants import appname, running_in_kitty
|
from kitty.constants import appname, running_in_kitty
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from kitty.boss import Boss
|
from kitty.boss import Boss as B
|
||||||
from kitty.window import Window
|
from kitty.window import Window as W
|
||||||
from kitty.tabs import Tab
|
from kitty.tabs import Tab
|
||||||
Boss, Window, Tab
|
Window = W
|
||||||
|
Boss = B
|
||||||
|
Tab
|
||||||
else:
|
else:
|
||||||
Boss = Window = Tab = None
|
Boss = Window = Tab = None
|
||||||
|
RCOptions = R
|
||||||
|
|
||||||
|
|
||||||
class NoResponse:
|
class NoResponse:
|
||||||
|
@ -6,17 +6,17 @@
|
|||||||
from typing import TYPE_CHECKING, Optional
|
from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from kitty.launch import (
|
from kitty.launch import (
|
||||||
LaunchCLIOptions, launch as do_launch, options_spec as launch_options_spec,
|
launch as do_launch, options_spec as launch_options_spec,
|
||||||
parse_launch_args
|
parse_launch_args
|
||||||
)
|
)
|
||||||
|
|
||||||
from .base import (
|
from .base import (
|
||||||
MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType,
|
MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions,
|
||||||
RCOptions, RemoteCommand, ResponseType, Window
|
RemoteCommand, ResponseType, Window
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from kitty.cli_stub import LaunchRCOptions as CLIOptions
|
from kitty.cli_stub import LaunchRCOptions as CLIOptions, LaunchCLIOptions
|
||||||
|
|
||||||
|
|
||||||
class Launch(RemoteCommand):
|
class Launch(RemoteCommand):
|
||||||
|
@ -27,6 +27,9 @@ warn_unused_configs = True
|
|||||||
check_untyped_defs = True
|
check_untyped_defs = True
|
||||||
disallow_untyped_defs = True
|
disallow_untyped_defs = True
|
||||||
disallow_untyped_decorators = True
|
disallow_untyped_decorators = True
|
||||||
|
disallow_untyped_calls = True
|
||||||
|
disallow_incomplete_defs = True
|
||||||
|
no_implicit_reexport = True
|
||||||
|
|
||||||
[mypy-conf]
|
[mypy-conf]
|
||||||
# ignored because on the CI server sphinx type stubs are available somehow, but
|
# ignored because on the CI server sphinx type stubs are available somehow, but
|
||||||
|
Loading…
Reference in New Issue
Block a user