first commit

This commit is contained in:
Soph :3 2026-01-01 21:34:03 +02:00
commit f2db1af089
9 changed files with 270 additions and 0 deletions

14
utils.py Normal file
View file

@ -0,0 +1,14 @@
def parse_selection(inp, max_index):
if inp.strip().lower() == "all":
return list(range(max_index))
result = set()
for part in inp.split(","):
part = part.strip()
if "-" in part:
a, b = part.split("-")
result.update(range(int(a) - 1, int(b)))
else:
result.add(int(part) - 1)
return sorted(i for i in result if 0 <= i < max_index)