Skip to content

Commit 3bfafd7

Browse files
committed
Fix
1 parent 3050038 commit 3bfafd7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

counts.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55

66
def _count(pot) -> tuple[int, int]:
77
pot = pofile(pot)
8-
string_count = 0
98
word_count = 0
109
for entry in pot:
11-
string_count += 1
1210
word_count += len(entry.msgid.split())
13-
return string_count, word_count
11+
return len(pot), word_count
1412

1513

1614
def get_counts(dir: Path) -> tuple[int, int]:
@@ -20,7 +18,13 @@ def get_counts(dir: Path) -> tuple[int, int]:
2018
for file in files:
2119
if file.endswith('.pot'):
2220
pot = root.joinpath(root, file)
23-
strings, words = _count(pot)
21+
strings, words = _count(pot.read_text())
2422
total_string_count += strings
2523
total_word_count += words
2624
return total_string_count, total_word_count
25+
26+
27+
if __name__ == '__main__':
28+
print(
29+
get_counts(Path(__file__).parent.joinpath('clones/cpython/Doc/build/gettext'))
30+
)

0 commit comments

Comments
 (0)