From b141915cb947d93003cbf32071938c556ff20781 Mon Sep 17 00:00:00 2001 From: Bryan Brattlof Date: Sun, 13 Jan 2019 10:24:19 -0600 Subject: use filter instead of if/continue statement --- __init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/__init__.py b/__init__.py index 50bf8a2..906b5a3 100644 --- a/__init__.py +++ b/__init__.py @@ -18,13 +18,10 @@ def run(pelican): options = pelican.settings.get('MINIFY', {}) htmlfile = re.compile(r'.html?$') pool = multiprocessing.Pool() - + + # find all html & htm files and give them to the workers to minify for base, dirs, files in os.walk(pelican.settings['OUTPUT_PATH']): - for f in files: - # filter only html files - if not htmlfile.search(f): - continue - # add full html path to wooker pool + for f in filter(htmlfile.search, files): filepath = os.path.join(base, f) pool.apply_async(worker, (filepath, options)) -- cgit 22.23.6