Skip to content

Commit 02d44c8

Browse files
committed
Use open()
1 parent 1ea779c commit 02d44c8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

rounds/1_histogram/baseline.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"""
66

77
from collections import Counter, deque
8-
from pathlib import Path
98

109

1110
def compute_histogram(path: str) -> dict[bytes, int]:
1211
"""Frequency of every 2-byte bigram in the file at ``path``."""
13-
return Counter(deque(Path(path).read_bytes(), maxlen=2))
12+
with open(path, "rb") as f:
13+
data = f.read()
14+
return Counter(deque(data, maxlen=2))

0 commit comments

Comments
 (0)