From 87e16e542395248882d12fc86d6988ddfcfebcd7 Mon Sep 17 00:00:00 2001 From: Rayan Date: Wed, 7 Apr 2021 10:07:41 -0400 Subject: [PATCH] moved the ignore patterns to an existing for loop to avoid redundancy --- pelican/generators.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index ab90b25a..52ef8a4c 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -160,12 +160,12 @@ class Generator: root, topdown=True, followlinks=True): excl = exclusions_by_dirpath.get(dirpath, ()) # We copy the `dirs` list as we will modify it in the loop: - # ---- - if any(fnmatch.fnmatch(dir, willignore) for willignore in subignores): - dirs.remove(dir) - # ---- for d in list(dirs): + # ---- + if any( fnmatch.fnmatch(d, willignore) for willignore in subignores): + dirs.remove(d) + # ---- if (d in excl or any(fnmatch.fnmatch(d, ignore) for ignore in ignores)):