From f2eb965604ef704d1ffc1a79acaba8b8c58e204b Mon Sep 17 00:00:00 2001 From: FrogBattle <44649323+FrogBattle@users.noreply.github.com> Date: Thu, 11 Jul 2019 17:21:48 +0100 Subject: [PATCH] Update ~script.py (#990) Changing the boolean expression avoids the use of a continue statement. This way the code becomes easier/faster to compute on lower level and it has a better coding style. --- ~script.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/~script.py b/~script.py index c44f3436f..1fbb1e838 100644 --- a/~script.py +++ b/~script.py @@ -20,16 +20,15 @@ def _markdown(parent, ignores, ignores_ext, depth): for i in os.listdir(parent): full = os.path.join(parent, i) name, ext = os.path.splitext(i) - if i in ignores or ext in ignores_ext: - continue - if os.path.isfile(full): - # generate list - pre = parent.replace("./", "").replace(" ", "%20") - # replace all spaces to safe URL - child = i.replace(" ", "%20") - files.append((pre, child, name)) - else: - dirs.append(i) + if i not in ignores and ext not in ignores_ext: + if os.path.isfile(full): + # generate list + pre = parent.replace("./", "").replace(" ", "%20") + # replace all spaces to safe URL + child = i.replace(" ", "%20") + files.append((pre, child, name)) + else: + dirs.append(i) # Sort files files.sort(key=lambda e: e[2].lower()) for f in files: