Skip to content

Commit c6e3d9f

Browse files
author
Saiprashanth Pulisetti
committed
chore(ciphers): satisfy ruff UP006/UP035 by using builtin generics
1 parent a27583a commit c6e3d9f

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

ciphers/skytale_cipher.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
from __future__ import annotations
3737

38-
from typing import List
3938

4039

4140
def encrypt(plaintext: str, key: int) -> str:
@@ -77,10 +76,10 @@ def decrypt(ciphertext: str, key: int) -> str:
7776
extra = length % key
7877

7978
# Determine each row length
80-
row_lengths: List[int] = [base + (1 if r < extra else 0) for r in range(key)]
79+
row_lengths: list[int] = [base + (1 if r < extra else 0) for r in range(key)]
8180

8281
# Slice ciphertext into rows
83-
rows: List[str] = []
82+
rows: list[str] = []
8483
idx = 0
8584
for r_len in row_lengths:
8685
rows.append(ciphertext[idx : idx + r_len])
@@ -90,7 +89,7 @@ def decrypt(ciphertext: str, key: int) -> str:
9089
pointers = [0] * key
9190

9291
# Reconstruct by taking characters column-wise across rows
93-
result_chars: List[str] = []
92+
result_chars: list[str] = []
9493
for i in range(length):
9594
r = i % key
9695
if pointers[r] < len(rows[r]):

0 commit comments

Comments
 (0)