No global typing issues in all code (excluding tests)
This commit is contained in:
parent
36eb52424f
commit
8ad62106e0
@ -12,6 +12,7 @@ from functools import partial
|
||||
from html.entities import html5
|
||||
from itertools import groupby
|
||||
from operator import itemgetter
|
||||
from typing import DefaultDict, Dict, Set
|
||||
from urllib.request import urlopen
|
||||
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
@ -42,10 +43,10 @@ def get_data(fname, folder='UCD'):
|
||||
|
||||
|
||||
# Map of class names to set of codepoints in class
|
||||
class_maps = {}
|
||||
class_maps: Dict[str, Set[int]] = {}
|
||||
all_symbols = set()
|
||||
name_map = {}
|
||||
word_search_map = defaultdict(set)
|
||||
word_search_map: DefaultDict[str, Set[int]] = defaultdict(set)
|
||||
zwj = 0x200d
|
||||
marks = set(emoji_skin_tone_modifiers) | {zwj}
|
||||
not_assigned = set(range(0, sys.maxunicode))
|
||||
@ -110,9 +111,9 @@ def split_two(line):
|
||||
return chars, rest
|
||||
|
||||
|
||||
all_emoji = set()
|
||||
emoji_categories = {}
|
||||
emoji_presentation_bases = set()
|
||||
all_emoji: Set[int] = set()
|
||||
emoji_categories: Dict[str, Set[int]] = {}
|
||||
emoji_presentation_bases: Set[int] = set()
|
||||
|
||||
|
||||
def parse_emoji():
|
||||
@ -130,7 +131,8 @@ def parse_emoji():
|
||||
emoji_presentation_bases.add(base)
|
||||
|
||||
|
||||
doublewidth, ambiguous = set(), set()
|
||||
doublewidth: Set[int] = set()
|
||||
ambiguous: Set[int] = set()
|
||||
|
||||
|
||||
def parse_eaw():
|
||||
|
||||
@ -16,6 +16,7 @@ import sys
|
||||
import tempfile
|
||||
import time
|
||||
from contextlib import suppress
|
||||
from typing import cast
|
||||
|
||||
import requests
|
||||
|
||||
@ -25,11 +26,11 @@ docs_dir = os.path.abspath('docs')
|
||||
publish_dir = os.path.abspath(os.path.join('..', 'kovidgoyal.github.io', 'kitty'))
|
||||
with open('kitty/constants.py') as f:
|
||||
raw = f.read()
|
||||
nv = re.search(
|
||||
r'^version\s+=\s+\((\d+), (\d+), (\d+)\)', raw, flags=re.MULTILINE)
|
||||
nv = cast(re.Match, re.search(
|
||||
r'^version\s+=\s+\((\d+), (\d+), (\d+)\)', raw, flags=re.MULTILINE))
|
||||
version = '%s.%s.%s' % (nv.group(1), nv.group(2), nv.group(3))
|
||||
appname = re.search(
|
||||
r"^appname\s+=\s+'([^']+)'", raw, flags=re.MULTILINE).group(1)
|
||||
appname = cast(re.Match, re.search(
|
||||
r"^appname\s+=\s+'([^']+)'", raw, flags=re.MULTILINE)).group(1)
|
||||
|
||||
ALL_ACTIONS = 'man html build tag sdist upload website'.split()
|
||||
|
||||
|
||||
@ -12,3 +12,6 @@ blank_line_before_nested_class_or_def = True
|
||||
[isort]
|
||||
combine_as_imports = True
|
||||
multi_line_output = 5
|
||||
|
||||
[mypy]
|
||||
files = kitty,kittens,glfw/glfw.py,*.py
|
||||
|
||||
7
setup.py
7
setup.py
@ -19,6 +19,7 @@ from functools import partial
|
||||
from collections import namedtuple
|
||||
from contextlib import suppress
|
||||
from pathlib import Path
|
||||
from typing import cast
|
||||
|
||||
base = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.insert(0, 'glfw')
|
||||
@ -29,13 +30,13 @@ build_dir = 'build'
|
||||
constants = os.path.join('kitty', 'constants.py')
|
||||
with open(constants, 'rb') as f:
|
||||
constants = f.read().decode('utf-8')
|
||||
appname = re.search(r"^appname = '([^']+)'", constants, re.MULTILINE).group(1)
|
||||
appname = cast(re.Match, re.search(r"^appname = '([^']+)'", constants, re.MULTILINE)).group(1)
|
||||
version = tuple(
|
||||
map(
|
||||
int,
|
||||
re.search(
|
||||
cast(re.Match, re.search(
|
||||
r"^version = \((\d+), (\d+), (\d+)\)", constants, re.MULTILINE
|
||||
).group(1, 2, 3)
|
||||
)).group(1, 2, 3)
|
||||
)
|
||||
)
|
||||
_plat = sys.platform.lower()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user