Skip to content

Commit f2eb965

Browse files
FrogBattlecclauss
authored andcommitted
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.
1 parent c2f2fa8 commit f2eb965

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

~script.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ def _markdown(parent, ignores, ignores_ext, depth):
2020
for i in os.listdir(parent):
2121
full = os.path.join(parent, i)
2222
name, ext = os.path.splitext(i)
23-
if i in ignores or ext in ignores_ext:
24-
continue
25-
if os.path.isfile(full):
26-
# generate list
27-
pre = parent.replace("./", "").replace(" ", "%20")
28-
# replace all spaces to safe URL
29-
child = i.replace(" ", "%20")
30-
files.append((pre, child, name))
31-
else:
32-
dirs.append(i)
23+
if i not in ignores and ext not in ignores_ext:
24+
if os.path.isfile(full):
25+
# generate list
26+
pre = parent.replace("./", "").replace(" ", "%20")
27+
# replace all spaces to safe URL
28+
child = i.replace(" ", "%20")
29+
files.append((pre, child, name))
30+
else:
31+
dirs.append(i)
3332
# Sort files
3433
files.sort(key=lambda e: e[2].lower())
3534
for f in files:

0 commit comments

Comments
 (0)