2022-04-27 05:40:53 +00:00
|
|
|
"""Utils for trafikverket_ferry."""
|
2024-03-08 15:35:23 +00:00
|
|
|
|
2022-04-27 05:40:53 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
from datetime import time
|
|
|
|
|
|
|
|
|
|
|
|
def create_unique_id(
|
|
|
|
ferry_from: str, ferry_to: str, ferry_time: time | str | None, weekdays: list[str]
|
|
|
|
) -> str:
|
|
|
|
"""Create unique id."""
|
|
|
|
return (
|
|
|
|
f"{ferry_from.casefold().replace(' ', '')}-{ferry_to.casefold().replace(' ', '')}"
|
2024-05-08 21:54:49 +00:00
|
|
|
f"-{ferry_time!s}-{weekdays!s}"
|
2022-04-27 05:40:53 +00:00
|
|
|
)
|