From 45247385eb8f9f69eab8dd3bed762bd8e2fa4c29 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Mon, 1 Jan 2024 11:01:22 -0800 Subject: [PATCH] hotfix: make the line counter correct --- sz.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sz.py b/sz.py index 20e0dd714b..bc521587f5 100755 --- a/sz.py +++ b/sz.py @@ -16,8 +16,7 @@ def gen_stats(base_path="."): relfilepath = os.path.relpath(filepath, base_path) with tokenize.open(filepath) as file_: tokens = [t for t in tokenize.generate_tokens(file_.readline) if t.type in TOKEN_WHITELIST] - #token_count, line_count = len(tokens), len(set([x for t in tokens for x in range(t.start[0], t.end[0]+1)])) - token_count, line_count = len(tokens), len(set([t.start[0] for t in tokens])) + token_count, line_count = len(tokens), len(set([x for t in tokens for x in range(t.start[0], t.end[0]+1)])) table.append([relfilepath, line_count, token_count/line_count]) return table