Skip to content

Commit 1ba4849

Browse files
authored
Merge branch 'master' into docs/strassen-complexity-docstring
2 parents 2770f8c + eea1bac commit 1ba4849

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
- id: auto-walrus
2020

2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.15.20
22+
rev: v0.16.1
2323
hooks:
2424
- id: ruff-check
2525
- id: ruff-format

ciphers/a1z26.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,21 @@ def encode(plain: str) -> list[int]:
1313
"""
1414
>>> encode("myname")
1515
[13, 25, 14, 1, 13, 5]
16+
>>> encode("abCd")
17+
Traceback (most recent call last):
18+
...
19+
ValueError: plain must contain only lowercase letters (a-z)
20+
>>> encode("n0w")
21+
Traceback (most recent call last):
22+
...
23+
ValueError: plain must contain only lowercase letters (a-z)
24+
>>> encode("later!")
25+
Traceback (most recent call last):
26+
...
27+
ValueError: plain must contain only lowercase letters (a-z)
1628
"""
29+
if not plain.islower() or not plain.isalpha():
30+
raise ValueError("plain must contain only lowercase letters (a-z)")
1731
return [ord(elem) - 96 for elem in plain]
1832

1933

0 commit comments

Comments
 (0)