refactor: split parse into multiple files

Signed-off-by: Konstantin Fickel <mail@konstantinfickel.de>
This commit is contained in:
Konstantin Fickel 2025-06-21 16:43:40 +02:00
parent 082c13b046
commit dc2a97d3b8
6 changed files with 117 additions and 92 deletions

View file

@ -0,0 +1,13 @@
from itertools import pairwise
from typing import TypeVar
A = TypeVar("A")
def split_at(list_to_be_split: list[A], positions: list[int]):
positions = sorted(set([0, *positions, len(list_to_be_split)]))
return [list_to_be_split[left:right] for left, right in pairwise(positions)]
__all__ = ["split_at"]