hotfix: skip 0 line count files in sz.py

This commit is contained in:
George Hotz 2024-04-23 11:56:03 +04:00
parent acf4ba5c9f
commit 9b7efa72ea
1 changed files with 1 additions and 1 deletions

2
sz.py
View File

@ -21,7 +21,7 @@ def gen_stats(base_path="."):
with tokenize.open(filepath) as file_: with tokenize.open(filepath) as file_:
tokens = [t for t in tokenize.generate_tokens(file_.readline) if t.type in TOKEN_WHITELIST and not is_docstring(t)] tokens = [t for t in tokenize.generate_tokens(file_.readline) if t.type in TOKEN_WHITELIST and not is_docstring(t)]
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([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]) if line_count > 0: table.append([relfilepath, line_count, token_count/line_count])
return table return table
def gen_diff(table_old, table_new): def gen_diff(table_old, table_new):