mypy: Convert several directories to use typing.Text.

Specifically, these directories are converted: [analytics/, scripts/,
tools/, zerver/management/, zilencer/, zproject/]
This commit is contained in:
anirudhjain75
2016-12-08 09:36:51 +05:30
committed by Tim Abbott
parent 2288120155
commit beaa62cafa
16 changed files with 82 additions and 95 deletions

View File

@@ -8,8 +8,8 @@ import json
import sys
import hashlib
import xml.etree.ElementTree as ET
from six import unichr, text_type
from typing import Union
from six import unichr
from typing import Union, Text
from os.path import dirname
from PIL import Image, ImageDraw, ImageFont
@@ -40,7 +40,7 @@ class MissingGlyphError(Exception):
pass
def color_font(name, code_point, code_point_to_fname_map):
# type: (str, str, Dict[int, Union[text_type, bytes]]) -> None
# type: (str, str, Dict[int, Union[Text, bytes]]) -> None
glyph_name = code_point_to_fname_map[int(code_point, 16)]
in_name = 'bitmaps/strike0/{}.png'.format(glyph_name)
@@ -75,11 +75,11 @@ def bw_font(name, code_point):
)
def code_point_to_file_name_map(ttx):
# type: (str) -> Dict[int, Union[text_type, bytes]]
# type: (str) -> Dict[int, Union[Text, bytes]]
"""Given the NotoColorEmoji.ttx file, parse it to generate a map from
codepoint to filename (a la glyph0****.png)
"""
result = {} # type: Dict[int, Union[text_type, bytes]]
result = {} # type: Dict[int, Union[Text, bytes]]
xml = ET.parse(ttx)
for elem in xml.find("*cmap_format_12"):
code_point = int(elem.attrib["code"], 16)