From bcdbb3640c44a4bc8e6d36df7408fb5802f27b98 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 14 Nov 2018 10:28:38 +0000 Subject: [PATCH] Add type annotions to irc->ansi color functions --- src/utils/irc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/irc.py b/src/utils/irc.py index 4366573d..f4973df1 100644 --- a/src/utils/irc.py +++ b/src/utils/irc.py @@ -144,11 +144,11 @@ def strip_font(s: str) -> str: s = s.replace(utils.consts.COLOR, "") return s -def _color_tokenize(s): +def _color_tokens(s: str) -> typing.List[str]: is_color = False foreground = "" background = "" - matches = [] + matches = [] # type: typing.List[str] for char in s: if char == utils.consts.COLOR: @@ -173,12 +173,12 @@ def _color_tokenize(s): background = "" return matches -def to_ansi_colors(s): +def to_ansi_colors(s: str) -> str: color = False ansi_bold = False bold = False - for token in _color_tokenize(s): + for token in _color_tokens(s): replace = "" type = token[0]