From: Oleg Broytman Date: Sun, 15 Mar 2015 22:54:58 +0000 (+0300) Subject: gen-sitemap: minor optimization X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=deb1c3b89079430679d9cc459a2b272fb004b40c;p=phdru.name%2Fphdru.name.git gen-sitemap: minor optimization Append the leaf to current_subtree once after if. --- 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