Skip to content

Commit bad910e

Browse files
committed
fixed last issues with ruff
1 parent 4359762 commit bad910e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compression/ppm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import sys
21
from __future__ import annotations
32
from collections import defaultdict
3+
import sys
44

55
# Description for the ppm algorithm can be found at https://en.wikipedia.org/wiki/Prediction_by_partial_matching
66

@@ -44,7 +44,8 @@ def compress(self, data: str) -> list[float]:
4444
self.update_model(context, symbol)
4545
# Encode the symbol based on the current context
4646
compressed_output.append(self.encode_symbol(context, symbol))
47-
# Update the context by appending the symbol, keeping it within the specified order
47+
# Update the context by appending the symbol,
48+
# keeping it within the specified order
4849
context = (context + symbol)[-self.order :] # Keep the context within order
4950

5051
return compressed_output
@@ -103,7 +104,7 @@ def decode_symbol(self, context: str, prob: float) -> str | None:
103104

104105
def read_file(file_path: str) -> str:
105106
"""Read the entire file and return its content as a string."""
106-
with open(file_path, "r") as f:
107+
with open(file_path) as f:
107108
return f.read()
108109

109110

0 commit comments

Comments
 (0)