# HG changeset patch # User Mads Kiilerich # Date 2019-11-23 21:42:11 # Node ID d10caf4351704a3dfc9c4c4cf21702498003f096 # Parent 0cfd7728185317965422832f4b9cda7afd574b1f pygmentsutils: simplify get_index_filenames diff --git a/kallithea/lib/pygmentsutils.py b/kallithea/lib/pygmentsutils.py --- a/kallithea/lib/pygmentsutils.py +++ b/kallithea/lib/pygmentsutils.py @@ -26,7 +26,6 @@ Original author and date, and relevant c """ from collections import defaultdict -from itertools import ifilter from pygments import lexers @@ -59,15 +58,11 @@ def get_index_filenames(): """ Get list of known indexable filenames from pygment lexer internals """ - filenames = [] - - def likely_filename(s): - return s.find('*') == -1 and s.find('[') == -1 - for lx, t in sorted(lexers.LEXERS.items()): - for f in ifilter(likely_filename, t[-2]): - filenames.append(f) + for f in t[-2]: + if '*' not in f and '[' not in f: + filenames.append(f) return filenames