him_search() WIP

This commit is contained in:
Profitroll 2022-10-06 15:04:03 +02:00
parent b15da7964c
commit 201fcba766
5 changed files with 81 additions and 2 deletions

View File

@ -3,5 +3,8 @@ from .rt_mode import RealTimeMode
from .lang import Language
from .location_type import LocationType
from .selection_mode import SelectionMode
from .search_mode import SearchMode
from .filter_mode import FilterMode
from .board_type import BoardArrivalType, BoardDepartureType
from .board_type import BoardArrivalType, BoardDepartureType
from .aff_journey_mode import AffectedJourneyMode
from .aff_journey_stop_mode import AffectedJourneyStopMode

View File

@ -0,0 +1,11 @@
from enum import auto
from .auto_name import AutoName
class AffectedJourneyMode(AutoName):
"""Enumeration used to declare types of HIM search modes."""
ALL = auto()
"Return affected journeys."
OFF = auto()
"Do not return affected journeys."

View File

@ -0,0 +1,14 @@
from enum import auto
from .auto_name import AutoName
class AffectedJourneyStopMode(AutoName):
"""Enumeration used to declare types of affected journey stops return modes."""
ALL = auto()
"Return all affected stops of affected journeys."
IMP = auto()
"Return important stops of affected journeys."
OFF = auto()
"Do not return stops of affected journeys."

View File

@ -0,0 +1,14 @@
from enum import auto
from .auto_name import AutoName
class SearchMode(AutoName):
"""Enumeration used to declare types of HIM search modes."""
MATCH = auto()
"Iterate over all trips to find HIM messages."
NOMATCH = auto()
"Iterate over all HIM messages available."
TFMATCH = auto()
"Uses filters defined `metas` parameter."

View File

@ -1,5 +1,42 @@
from datetime import datetime
from typing import OrderedDict, Union
from pyrmv.classes.Stop import Stop
from pyrmv.errors.not_ready import NotReadyYetError
from pyrmv.enums.search_mode import SearchMode
from pyrmv.enums.aff_journey_mode import AffectedJourneyMode
from pyrmv.enums.aff_journey_stop_mode import AffectedJourneyStopMode
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
def him_search(
access_id: str,
date_begin: Union[str, datetime] = None,
date_end: Union[str, datetime] = None,
time_begin: Union[str, datetime] = None,
time_end: Union[str, datetime] = None,
weekdays: Union[str, OrderedDict[str, bool]] = None,
ids: list = None,
operators: list = None,
categories: list = None,
channels: list = None,
companies: list = None,
lines: list = None,
lineids: list = None,
stations: list = None,
station_from: Union[str, Stop] = None,
station_to: Union[str, Stop] = None,
bothways: bool = None,
trainnames: list = None,
search_mode: Literal[SearchMode.MATCH, SearchMode.NOMATCH, SearchMode.TFMATCH] = None,
affected_journey_mode: Literal[AffectedJourneyMode.ALL, AffectedJourneyMode.OFF] = None,
affected_journey_stop_mode: Literal[AffectedJourneyStopMode.ALL, AffectedJourneyStopMode.IMP, AffectedJourneyStopMode.OFF] = None,
priority_min: int = None,
priority_max: int = None
) -> None: #List[Message]:
def him_search():
raise NotReadyYetError()