Skip to content

Commit 8eadafa

Browse files
committed
fix: ruff check
Signed-off-by: guoguangwu <[email protected]>
1 parent 47c4034 commit 8eadafa

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

ciphers/rsa_cipher.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ def encrypt_and_write_to_file(
7676
key_size, n, e = read_key_file(key_filename)
7777
if key_size < block_size * 8:
7878
sys.exit(
79-
"ERROR: Block size is {} bits and key size is {} bits. The RSA cipher "
79+
f"ERROR: Block size is {block_size * 8} bits and key size is {key_size} bits. The RSA cipher "
8080
"requires the block size to be equal to or greater than the key size. "
81-
"Either decrease the block size or use different keys.".format(
82-
block_size * 8, key_size
81+
"Either decrease the block size or use different keys."
8382
)
8483
)
8584

@@ -102,10 +101,9 @@ def read_from_file_and_decrypt(message_filename: str, key_filename: str) -> str:
102101

103102
if key_size < block_size * 8:
104103
sys.exit(
105-
"ERROR: Block size is {} bits and key size is {} bits. The RSA cipher "
104+
f"ERROR: Block size is {block_size * 8} bits and key size is {key_size} bits. The RSA cipher "
106105
"requires the block size to be equal to or greater than the key size. "
107-
"Did you specify the correct key file and encrypted file?".format(
108-
block_size * 8, key_size
106+
"Did you specify the correct key file and encrypted file?"
109107
)
110108
)
111109

other/lfu_cache.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ def __init__(self, key: T | None, val: U | None):
2424
self.prev: DoubleLinkedListNode[T, U] | None = None
2525

2626
def __repr__(self) -> str:
27-
return "Node: key: {}, val: {}, freq: {}, has next: {}, has prev: {}".format(
28-
self.key, self.val, self.freq, self.next is not None, self.prev is not None
27+
return f"Node: key: {self.key}, val: {self.val}, freq: {self.freq}, has next: {self.next is not None}, has prev: {self.prev is not None}"
2928
)
3029

3130

0 commit comments

Comments
 (0)