From deb1c3b89079430679d9cc459a2b272fb004b40c Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 16 Mar 2015 01:54:58 +0300 Subject: [PATCH] gen-sitemap: minor optimization Append the leaf to current_subtree once after if. --- gen-sitemap.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gen-sitemap.py b/gen-sitemap.py index 1a78a7f..b6ab57d 100755 --- a/gen-sitemap.py +++ b/gen-sitemap.py @@ -38,13 +38,11 @@ for dirpath, dirs, files in sorted(os.walk(fullpath)): current_subtree = tree[1] for i in range(level): current_subtree = current_subtree[-1][1] - current_subtree.append((parts[-1], [])) - elif level == save_level: - current_subtree.append((parts[-1], [])) elif level > save_level: assert level - save_level == 1 current_subtree = current_subtree[-1][1] - current_subtree.append((parts[-1], [])) + #else: # level == save_level: + current_subtree.append((parts[-1], [])) save_level = level except StopIteration: pass -- 2.39.5