changeset 7794:62659d3824a0

celerylib: simplify over engineered repo walk
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 06 Aug 2019 21:26:37 +0200
parents 708f1a55f174
children d6af0bc38471
files kallithea/lib/celerylib/tasks.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/celerylib/tasks.py	Sun Jul 21 19:03:30 2019 +0200
+++ b/kallithea/lib/celerylib/tasks.py	Tue Aug 06 21:26:37 2019 +0200
@@ -488,15 +488,13 @@
     tip = repo.get_changeset()
     code_stats = {}
 
-    def aggregate(cs):
-        for f in cs[2]:
-            ext = f.extension.lower()
-            if ext in LANGUAGES_EXTENSIONS_MAP.keys() and not f.is_binary:
+    for _topnode, _dirnodes, filenodes in tip.walk('/'):
+        for filenode in filenodes:
+            ext = filenode.extension.lower()
+            if ext in LANGUAGES_EXTENSIONS_MAP.keys() and not filenode.is_binary:
                 if ext in code_stats:
                     code_stats[ext] += 1
                 else:
                     code_stats[ext] = 1
 
-    map(aggregate, tip.walk('/'))
-
     return code_stats or {}