Use a stub rather than TYPE_CHECKING

This commit is contained in:
Kovid Goyal
2020-03-15 13:27:40 +05:30
parent 871ca4dda6
commit 382c31ddf2
27 changed files with 267 additions and 326 deletions

8
kitty/key_encoding.py generated
View File

@@ -3,7 +3,7 @@
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import string
from typing import NamedTuple, Optional
from typing import Dict, NamedTuple, Optional
from . import fast_data_types as defines
from .key_names import key_name_aliases
@@ -457,14 +457,16 @@ class KeyEvent(NamedTuple):
key: str
PRESS, REPEAT, RELEASE = 1, 2, 4
PRESS: int = 1
REPEAT: int = 2
RELEASE: int = 4
SHIFT, ALT, CTRL, SUPER = 1, 2, 4, 8
type_map = {'p': PRESS, 't': REPEAT, 'r': RELEASE}
rtype_map = {v: k for k, v in type_map.items()}
mod_map = {c: i for i, c in enumerate('ABCDEFGHIJKLMNOP')}
rmod_map = {v: k for k, v in mod_map.items()}
key_rmap = {}
key_defs = {}
key_defs: Dict[str, str] = {}
config_key_map = {}
config_mod_map = {
'SHIFT': SHIFT,