Skip to content

Commit 2f0a162

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 997ead0 commit 2f0a162

2 files changed

Lines changed: 20 additions & 19 deletions

File tree

‎ciphers/des_ecb.py‎

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -537,21 +537,22 @@ def decrypt(key: str, cipher_text: str) -> str:
537537
if mode not in ["e", "d", "k", "q"]:
538538
print("Invalid option. Please try again.")
539539
continue
540-
if mode == "q":
541-
break
542-
elif mode == "k":
543-
print(f"Generated key: {Des.generate_key()}")
544-
elif mode == "e":
545-
key = input("Enter the key: ").strip()
546-
if len(key) != 16 and not all(char in "0123456789abcdef" for char in key):
547-
print("Invalid key. Please try again.")
548-
continue
549-
input_string = input("Enter the string to encrypt: ").strip()
550-
print(f"Encrypted string: {Des.encrypt(key, input_string)}")
551-
elif mode == "d":
552-
key = input("Enter the key: ").strip()
553-
if len(key) != 16 and not all(char in "0123456789abcdef" for char in key):
554-
print("Invalid key. Please try again.")
555-
continue
556-
cipher_text = input("Enter the cipher text to decrypt: ").strip()
557-
print(f"Decrypted string: {Des.decrypt(key, cipher_text)}")
540+
match mode:
541+
case "q":
542+
break
543+
case "k":
544+
print(f"Generated key: {Des.generate_key()}")
545+
case "e":
546+
key = input("Enter the key: ").strip()
547+
if len(key) != 16 and not all(char in "0123456789abcdef" for char in key):
548+
print("Invalid key. Please try again.")
549+
continue
550+
input_string = input("Enter the string to encrypt: ").strip()
551+
print(f"Encrypted string: {Des.encrypt(key, input_string)}")
552+
case "d":
553+
key = input("Enter the key: ").strip()
554+
if len(key) != 16 and not all(char in "0123456789abcdef" for char in key):
555+
print("Invalid key. Please try again.")
556+
continue
557+
cipher_text = input("Enter the cipher text to decrypt: ").strip()
558+
print(f"Decrypted string: {Des.decrypt(key, cipher_text)}")

‎financial/exponential_moving_average.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def exponential_moving_average(
2222
>>> tuple(exponential_moving_average(iter([10.0, 20.0, 30.0]), 1))
2323
(10.0, 20.0, 30.0)
2424
25-
25+
2626
:param stock_prices: A stream of stock prices
2727
:param window_size: The number of stock prices that will trigger a new calculation
2828
of the exponential average (window_size > 0)

0 commit comments

Comments
 (0)