def __formatKeywords(self, keywords, align, length): """Append colors and align keywords properly""" tmp = [] for keyword in keywords: tmp2 = keyword keyword = align_string(keyword, align, length) # % are used as separators for further split so we wont loose spaces and coloring keyword = '%'.join(list(keyword)) if tmp2 in self.__IMPARCHS: tmp.append(colorize_string('darkyellow', keyword)) elif tmp2 in self.__EXP_ARCHS: tmp.append(colorize_string('darkgray', keyword)) else: tmp.append(keyword) return tmp
def __formatVersions(versions, align, length): """Append colors and align keywords properly""" # % are used as separators for further split so we wont loose spaces and coloring tmp = [] for pv in versions: pv = align_string(pv, align, length) pv = '%'.join(list(pv)) if pv.find('[%M%][%I%]') != -1: tmp.append(colorize_string('darkyellow', pv)) elif pv.find('[%M%]') != -1: tmp.append(colorize_string('darkred', pv)) elif pv.find('[%I%]') != -1: tmp.append(colorize_string('bold', pv)) else: tmp.append(pv) return tmp
def __formatEapis(eapis, repos, repos_configs, length): """Align eapis items properly""" # % are used as separators for further split so we wont loose spaces and coloring tmp = [] for eapi, repo in zip(eapis, repos): tmp_eapi = eapi eapi = align_string(eapi, 'left', length) eapi = '%'.join(list(eapi)) if repos_configs[repo].eapi_is_banned(tmp_eapi): eapi = colorize_string('red', eapi) elif repos_configs[repo].eapi_is_deprecated(tmp_eapi): eapi = colorize_string('yellow', eapi) else: eapi = colorize_string('green', eapi) tmp.append(eapi) return tmp
def __formatAdditional(additional, color, length): """Align additional items properly""" # % are used as separators for further split so we wont loose spaces and coloring tmp = [] for x in additional: tmpc = color x = align_string(x, 'left', length) x = '%'.join(list(x)) if x == 'o': # the value is unset so the color is gray tmpc = 'darkgray' x = colorize_string(tmpc, x) tmp.append(x) return tmp