Structural changes
This commit is contained in:
10
src/pyrmv/enums/__init__.py
Normal file
10
src/pyrmv/enums/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from .product import Product
|
||||
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 .aff_journey_mode import AffectedJourneyMode
|
||||
from .aff_journey_stop_mode import AffectedJourneyStopMode
|
11
src/pyrmv/enums/aff_journey_mode.py
Normal file
11
src/pyrmv/enums/aff_journey_mode.py
Normal 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."
|
14
src/pyrmv/enums/aff_journey_stop_mode.py
Normal file
14
src/pyrmv/enums/aff_journey_stop_mode.py
Normal 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."
|
19
src/pyrmv/enums/auto_name.py
Normal file
19
src/pyrmv/enums/auto_name.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Class is taken from source code of Pyrogram:
|
||||
# https://github.com/pyrogram/pyrogram/blob/master/pyrogram/enums/auto_name.py
|
||||
|
||||
from enum import Enum
|
||||
from pyrmv.const.product import PRODUCTS
|
||||
|
||||
class AutoName(Enum):
|
||||
def __init__(self, code) -> None:
|
||||
self.code = code
|
||||
|
||||
def _generate_next_value_(self, *args):
|
||||
return self.lower()
|
||||
|
||||
def __repr__(self):
|
||||
return f"pyrmv.enums.{self}"
|
||||
|
||||
class AutoNameProduct(AutoName):
|
||||
def __init__(self, code) -> None:
|
||||
self.code = PRODUCTS[code]
|
44
src/pyrmv/enums/board_type.py
Normal file
44
src/pyrmv/enums/board_type.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from enum import auto
|
||||
from .auto_name import AutoName
|
||||
|
||||
class BoardArrivalType(AutoName):
|
||||
"""Enumeration used to declare types of arrival board.
|
||||
|
||||
* ARR - Arrival board as configured in HAFAS
|
||||
* ARR_EQUIVS - Arrival board with all journeys at any masts and equivalent stops
|
||||
* ARR_MAST - Arrival board at mast
|
||||
* ARR_STATION - Arrival board with all journeys at any masts of the requested station
|
||||
"""
|
||||
|
||||
ARR = auto()
|
||||
"Arrival board as configured in HAFAS"
|
||||
|
||||
ARR_EQUIVS = auto()
|
||||
"Arrival board with all journeys at any masts and equivalent stops"
|
||||
|
||||
ARR_MAST = auto()
|
||||
"Arrival board at mast"
|
||||
|
||||
ARR_STATION = auto()
|
||||
"Arrival board with all journeys at any masts of the requested station"
|
||||
|
||||
class BoardDepartureType(AutoName):
|
||||
"""Enumeration used to declare types of departure board.
|
||||
|
||||
* DEP - Departure board as configured in HAFAS
|
||||
* DEP_EQUIVS - Departure board with all journeys at any masts and equivalent stops
|
||||
* DEP_MAST - Departure board at mast
|
||||
* DEP_STATION - Departure board with all journeys at any masts of the requested station
|
||||
"""
|
||||
|
||||
DEP = auto()
|
||||
"Departure board as configured in HAFAS"
|
||||
|
||||
DEP_EQUIVS = auto()
|
||||
"Departure board with all journeys at any masts and equivalent stops"
|
||||
|
||||
DEP_MAST = auto()
|
||||
"Departure board at mast"
|
||||
|
||||
DEP_STATION = auto()
|
||||
"Departure board with all journeys at any masts of the requested station"
|
19
src/pyrmv/enums/filter_mode.py
Normal file
19
src/pyrmv/enums/filter_mode.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from enum import auto
|
||||
from .auto_name import AutoName
|
||||
|
||||
class FilterMode(AutoName):
|
||||
"""Enumeration used to declare filters for nearby searches.
|
||||
|
||||
* DIST_PERI - Accentuate matches. Matches in the radius are first
|
||||
* EXCL_PERI - Returns matches inside the radius only
|
||||
* SLCT_PERI - Matches in the radius are excluded. Returns matches outside the radius only
|
||||
"""
|
||||
|
||||
DIST_PERI = auto()
|
||||
"Accentuate matches. Matches in the radius are first."
|
||||
|
||||
EXCL_PERI = auto()
|
||||
"Returns matches inside the radius only."
|
||||
|
||||
SLCT_PERI = auto()
|
||||
"Matches in the radius are excluded. Returns matches outside the radius only."
|
41
src/pyrmv/enums/lang.py
Normal file
41
src/pyrmv/enums/lang.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from enum import auto
|
||||
from .auto_name import AutoName
|
||||
|
||||
class Language(AutoName):
|
||||
"""Enumeration used to declare locales as ISO-3166 codes (but only available in HAFAS ones)."""
|
||||
|
||||
DE = auto()
|
||||
"German"
|
||||
|
||||
DA = auto()
|
||||
"Danish"
|
||||
|
||||
EN = auto()
|
||||
"English"
|
||||
|
||||
ES = auto()
|
||||
"Spanish"
|
||||
|
||||
FR = auto()
|
||||
"French"
|
||||
|
||||
HU = auto()
|
||||
"Hungarian"
|
||||
|
||||
IT = auto()
|
||||
"Italian"
|
||||
|
||||
NL = auto()
|
||||
"Dutch"
|
||||
|
||||
NO = auto()
|
||||
"Norwegian"
|
||||
|
||||
PL = auto()
|
||||
"Polish"
|
||||
|
||||
SV = auto()
|
||||
"Swedish"
|
||||
|
||||
TR = auto()
|
||||
"Turkish"
|
47
src/pyrmv/enums/location_type.py
Normal file
47
src/pyrmv/enums/location_type.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from enum import auto
|
||||
from .auto_name import AutoName
|
||||
|
||||
class LocationType(AutoName):
|
||||
"""Enumeration used to declare types of location filter.
|
||||
|
||||
* S - Search for station/stops only
|
||||
* A - Search for addresses only
|
||||
* P - Search for POIs only
|
||||
* AP - Search for addresses and POIs
|
||||
* SA - Search for station/stops and addresses
|
||||
* SE - Search for stations/stops and entrypoints
|
||||
* SP - Search for stations/stops and POIs
|
||||
* ALL - Search in all existing location pools
|
||||
* SPE - Search for stations/stops, POIs and entrypoints
|
||||
|
||||
Note that not all location types may be available for a certain methods.
|
||||
Make sure that selected type is supported by method by looking up
|
||||
its acceptable types in argument description.
|
||||
"""
|
||||
|
||||
S = auto()
|
||||
"Search for station/stops only"
|
||||
|
||||
A = auto()
|
||||
"Search for addresses only"
|
||||
|
||||
P = auto()
|
||||
"Search for POIs only"
|
||||
|
||||
AP = auto()
|
||||
"Search for addresses and POIs"
|
||||
|
||||
SA = auto()
|
||||
"Search for station/stops and addresses"
|
||||
|
||||
SE = auto()
|
||||
"Search for stations/stops and entrypoints"
|
||||
|
||||
SP = auto()
|
||||
"Search for stations/stops and POIs"
|
||||
|
||||
ALL = auto()
|
||||
"Search in all existing location pools"
|
||||
|
||||
SPE = auto()
|
||||
"Search for stations/stops, POIs and entrypoints"
|
47
src/pyrmv/enums/product.py
Normal file
47
src/pyrmv/enums/product.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from enum import auto
|
||||
from .auto_name import AutoNameProduct
|
||||
|
||||
class Product(AutoNameProduct):
|
||||
"""Enumeration used to declare types of transport."""
|
||||
|
||||
ICE = auto()
|
||||
"The Intercity Express (commonly known as ICE) is a system of high-speed trains predominantly running in Germany."
|
||||
|
||||
IC = auto()
|
||||
"InterCity (commonly abbreviated IC on timetables and tickets) is the classification applied to certain long-distance passenger train services in Europe. Such trains (in contrast to regional, local, or commuter trains) generally call at major stations only."
|
||||
|
||||
EC = auto()
|
||||
"EuroCity, abbreviated as EC, is a cross-border train category within the European inter-city rail network. In contrast to trains allocated to the lower-level \"IC\" (InterCity) category, EC trains are international services that meet 20 criteria covering comfort, speed, food service, and cleanliness."
|
||||
|
||||
R = auto()
|
||||
"Regional rail, also known as local trains and stopping trains, are passenger rail services that operate between towns and cities. These trains operate with more stops over shorter distances than inter-city rail, but fewer stops and faster service than commuter rail."
|
||||
|
||||
RB = auto()
|
||||
"The Regionalbahn (lit. Regional train; abbreviated RB) is a type of local passenger train (stopping train) in Germany. It is similar to the Regionalzug (R) and Regio (R) train categories in neighboring Austria and Switzerland, respectively."
|
||||
|
||||
RE = auto()
|
||||
"In Germany, Luxembourg and Austria, the Regional-Express (RE, or in Austria: REX) is a type of regional train. It is similar to a semi-fast train, with average speed at about 70-90 km/h (top speed often 160 km/h) as it calls at fewer stations than Regionalbahn or S-Bahn trains, but stops more often than InterCity services."
|
||||
|
||||
SBAHN = auto()
|
||||
"The S-Bahn is the name of hybrid urban-suburban rail systems serving a metropolitan region in German-speaking countries. Some of the larger S-Bahn systems provide service similar to rapid transit systems, while smaller ones often resemble commuter or even regional rail. The term derives from Schnellbahn, Stadtbahn or Stadtschnellbahn."
|
||||
|
||||
UBAHN = auto()
|
||||
"A U-Bahn (short for subway, underground express train or metropolitan) is a usually underground, rail-bound means of transport for urban public transport (ÖPNV, city transport)."
|
||||
|
||||
TRAM = auto()
|
||||
"A tram (also known as a streetcar or trolley in North America) is a rail vehicle that travels on tramway tracks on public urban streets; some include segments on segregated right-of-way."
|
||||
|
||||
BUS = auto()
|
||||
"A bus (contracted from omnibus, with variants multibus, motorbus, autobus, etc.) is a road vehicle that carries significantly more passengers than an average car or van."
|
||||
|
||||
BUS2 = auto()
|
||||
"Also a bus, but now idea why it exists anyway."
|
||||
|
||||
FERRY = auto()
|
||||
"A ferry is a ship used to carry passengers, and sometimes vehicles and cargo, across a body of water."
|
||||
|
||||
TAXI = auto()
|
||||
"A taxi, also known as a taxicab or simply a cab, is a type of vehicle for hire with a driver, used by a single passenger or small group of passengers, often for a non-shared ride."
|
||||
|
||||
BAHN = auto()
|
||||
"Rail transport (also known as train transport) is a means of transport that transfers passengers and goods on wheeled vehicles running on rails, which are located on tracks. In contrast to road transport, where the vehicles run on a prepared flat surface, rail vehicles (rolling stock) are directionally guided by the tracks on which they run."
|
20
src/pyrmv/enums/rt_mode.py
Normal file
20
src/pyrmv/enums/rt_mode.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from enum import auto
|
||||
from .auto_name import AutoName
|
||||
|
||||
class RealTimeMode(AutoName):
|
||||
"""Enumeration used to declare types of real-time traffic."""
|
||||
|
||||
FULL = auto()
|
||||
"Combined search on planned and real-time data This search consists of two steps: i. Search on scheduled data ii. If the result of step (i) contains a non-feasible connection, a search on real-time data is performed and all results are combined"
|
||||
|
||||
INFOS = auto()
|
||||
"Search on planned data, use real-time information for display only: Connections are computed on the basis of planned data. Delays and feasibility of the connections are integrated into the result. Note that additional trains (supplied via realtime feed) will not be part of the resulting connections."
|
||||
|
||||
OFF = auto()
|
||||
"Search on planned data, ignore real-time information completely: Connections are computed on the basis of planned data. No real-time information is shown."
|
||||
|
||||
REALTIME = auto()
|
||||
"Search on real-time data: Connections are computed on the basis of real-time data, using planned schedule only whenever no real-time data is available. All connections computed are feasible with respect to the currently known real-time situation. Additional trains (supplied via real-time feed) will be found if these are part of a fast, comfortable, or direct connection (or economic connection, if economic search is activated)."
|
||||
|
||||
SERVER_DEFAULT = auto()
|
||||
"One of the other real-times modes used by default for RMV."
|
14
src/pyrmv/enums/search_mode.py
Normal file
14
src/pyrmv/enums/search_mode.py
Normal 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."
|
15
src/pyrmv/enums/selection_mode.py
Normal file
15
src/pyrmv/enums/selection_mode.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from enum import auto
|
||||
from .auto_name import AutoName
|
||||
|
||||
class SelectionMode(AutoName):
|
||||
"""Enumeration used to declare location selection modes.
|
||||
|
||||
* SLCT_A - Selectable
|
||||
* SLCT_N - Not selectable
|
||||
"""
|
||||
|
||||
SLCT_A = auto()
|
||||
"Selectable"
|
||||
|
||||
SLCT_N = auto()
|
||||
"Not selectable"
|
Reference in New Issue
Block a user