Minor strictness increases

This commit is contained in:
Kovid Goyal 2020-03-14 14:59:31 +05:30
parent 5f06d3a427
commit c912eef040
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
10 changed files with 31 additions and 25 deletions

View File

@ -14,7 +14,8 @@
import time
from functools import partial
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
@ -27,13 +28,13 @@
from sphinx.environment.adapters.toctree import TocTree # 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__)))
if kitty_src not in sys.path:
sys.path.insert(0, kitty_src)
from kitty.constants import str_version # noqa
from kitty.conf.definition import Option, Sequence, Shortcut # noqa
# config {{{
# -- Project information -----------------------------------------------------

View File

@ -591,5 +591,5 @@ def main(args: List[str]) -> None:
cd['options'] = OPTIONS
cd['help_text'] = help_text
elif __name__ == '__conf__':
from .config import all_options
from .config_data import all_options
sys.all_options = all_options # type: ignore

View File

@ -31,7 +31,8 @@ class OptionDict(TypedDict):
OptionDict = Dict[str, Any] # type: ignore
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 = '''\
Specify a path to the configuration file(s) to use. All configuration files are

View File

@ -13,13 +13,13 @@
from . import fast_data_types as defines
from .conf.definition import Option, Shortcut, option_func
from .conf.utils import (
Color, choices, positive_float, positive_int, to_bool, to_cmdline,
to_color, to_color_or_none, unit_float
choices, positive_float, positive_int, to_bool, to_cmdline, to_color,
to_color_or_none, unit_float
)
from .constants import config_dir, is_macos
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
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
MINIMUM_FONT_SIZE = 4

View File

@ -14,8 +14,8 @@
from . import ListedFont
if TYPE_CHECKING:
from kitty.fast_data_types import CoreTextFont
CoreTextFont
from kitty.fast_data_types import CoreTextFont as C
CoreTextFont = C
attr_map = {(False, False): 'font_family',

View File

@ -15,8 +15,8 @@
from . import ListedFont
if TYPE_CHECKING:
from kitty.fast_data_types import FontConfigPattern
FontConfigPattern
from kitty.fast_data_types import FontConfigPattern as F
FontConfigPattern = F
attr_map = {(False, False): 'font_family',

View File

@ -26,13 +26,11 @@
if is_macos:
from .core_text import get_font_files as get_font_files_coretext, font_for_family as font_for_family_macos
if TYPE_CHECKING:
from .core_text import CoreTextFont
CoreTextFont
from .core_text import CoreTextFont # noqa
else:
from .fontconfig import get_font_files as get_font_files_fontconfig, font_for_family as font_for_family_fontconfig
if TYPE_CHECKING:
from .fontconfig import FontConfigPattern
FontConfigPattern
from .fontconfig import FontConfigPattern # noqa
FontObject = Union['CoreTextFont', 'FontConfigPattern']
current_faces: List[Tuple[FontObject, bool, bool]] = []

View File

@ -9,16 +9,19 @@
)
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
if TYPE_CHECKING:
from kitty.boss import Boss
from kitty.window import Window
from kitty.boss import Boss as B
from kitty.window import Window as W
from kitty.tabs import Tab
Boss, Window, Tab
Window = W
Boss = B
Tab
else:
Boss = Window = Tab = None
RCOptions = R
class NoResponse:

View File

@ -6,17 +6,17 @@
from typing import TYPE_CHECKING, Optional
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
)
from .base import (
MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType,
RCOptions, RemoteCommand, ResponseType, Window
MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions,
RemoteCommand, ResponseType, Window
)
if TYPE_CHECKING:
from kitty.cli_stub import LaunchRCOptions as CLIOptions
from kitty.cli_stub import LaunchRCOptions as CLIOptions, LaunchCLIOptions
class Launch(RemoteCommand):

View File

@ -27,6 +27,9 @@ warn_unused_configs = True
check_untyped_defs = True
disallow_untyped_defs = True
disallow_untyped_decorators = True
disallow_untyped_calls = True
disallow_incomplete_defs = True
no_implicit_reexport = True
[mypy-conf]
# ignored because on the CI server sphinx type stubs are available somehow, but