Commit c73598fa authored by Jakob Moser's avatar Jakob Moser
Browse files

Add @classmethod get and from_dir

parent 77848d40
Loading
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
from dataclasses import dataclass
from pathlib import Path
from typing import Self
from collections.abc import Iterable, Iterator
from pathlib import Path

from ..integration.schwalbe.studienfachschaften import Studienfachschaft
from ..utils import group_by

from .PaymentOrder import PaymentOrder
@@ -13,6 +15,14 @@ class PaymentOrderCollection(Iterable[PaymentOrder]):

    base_dir: Path

    @classmethod
    def get(cls, studienfachschaft: Studienfachschaft, year: int) -> Self:
        pass  # TODO

    @classmethod
    def from_dir(cls, path_or_str: Path | str) -> Self:
        pass  # TODO

    def __iter__(self) -> Iterator[PaymentOrder]:
        return (load_pdf(pdf) for pdf in self.base_dir.rglob("*.pdf"))