Small refactor and isort+black formatting
Some checks reported warnings
Tests / test (3.11) (push) Has been cancelled
Tests / test (3.8) (push) Has been cancelled
Tests / test (3.9) (push) Has been cancelled
Tests / test (3.10) (push) Has been cancelled

This commit is contained in:
2023-11-24 11:21:02 +01:00
parent fa4f7b83ec
commit f31fa65d78
45 changed files with 1035 additions and 923 deletions

View File

@@ -1,10 +1,10 @@
from .product import Product
from .rt_mode import RealTimeMode
from .aff_journey_mode import AffectedJourneyMode
from .aff_journey_stop_mode import AffectedJourneyStopMode
from .board_type import BoardArrivalType, BoardDepartureType
from .filter_mode import FilterMode
from .lang import Language
from .location_type import LocationType
from .selection_mode import SelectionMode
from .product import Product
from .rt_mode import RealTimeMode
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
from .selection_mode import SelectionMode

View File

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

View File

@@ -1,6 +1,8 @@
from enum import auto
from .auto_name import AutoName
class AffectedJourneyStopMode(AutoName):
"""Enumeration used to declare types of affected journey stops return modes."""
@@ -11,4 +13,4 @@ class AffectedJourneyStopMode(AutoName):
"Return important stops of affected journeys."
OFF = auto()
"Do not return stops of affected journeys."
"Do not return stops of affected journeys."

View File

@@ -2,7 +2,9 @@
# https://github.com/pyrogram/pyrogram/blob/master/pyrogram/enums/auto_name.py
from enum import Enum
from pyrmv.const.product import PRODUCTS
from pyrmv.const import PRODUCTS
class AutoName(Enum):
def __init__(self, code) -> None:
@@ -14,6 +16,7 @@ class AutoName(Enum):
def __repr__(self):
return f"pyrmv.enums.{self}"
class AutoNameProduct(AutoName):
def __init__(self, code) -> None:
self.code = PRODUCTS[code]
self.code = PRODUCTS[code]

View File

@@ -1,9 +1,11 @@
from enum import auto
from .auto_name import AutoName
class BoardArrivalType(AutoName):
"""Enumeration used to declare types of arrival board.
"""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
@@ -22,9 +24,10 @@ class BoardArrivalType(AutoName):
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.
"""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
@@ -41,4 +44,4 @@ class BoardDepartureType(AutoName):
"Departure board at mast"
DEP_STATION = auto()
"Departure board with all journeys at any masts of the requested station"
"Departure board with all journeys at any masts of the requested station"

View File

@@ -1,9 +1,11 @@
from enum import auto
from .auto_name import AutoName
class FilterMode(AutoName):
"""Enumeration used to declare filters for nearby searches.
"""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
@@ -16,4 +18,4 @@ class FilterMode(AutoName):
"Returns matches inside the radius only."
SLCT_PERI = auto()
"Matches in the radius are excluded. Returns matches outside the radius only."
"Matches in the radius are excluded. Returns matches outside the radius only."

View File

@@ -1,24 +1,44 @@
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"
AR = auto()
"Arabic"
CA = auto()
"Catalan, Valencian"
DA = auto()
"Danish"
DE = auto()
"German"
EL = auto()
"Greek"
EN = auto()
"English"
ES = auto()
"Spanish"
FI = auto()
"Finnish"
FR = auto()
"French"
HI = auto()
"Hindi"
HR = auto()
"Croatian"
HU = auto()
"Hungarian"
@@ -34,8 +54,26 @@ class Language(AutoName):
PL = auto()
"Polish"
RU = auto()
"Russian"
SK = auto()
"Slovak"
SL = auto()
"Slovenian"
SV = auto()
"Swedish"
TL = auto()
"Tagalog"
TR = auto()
"Turkish"
"Turkish"
UR = auto()
"Urdu"
ZH = auto()
"Chinese"

View File

@@ -1,9 +1,11 @@
from enum import auto
from .auto_name import AutoName
class LocationType(AutoName):
"""Enumeration used to declare types of location filter.
"""Enumeration used to declare types of location filter.
* S - Search for station/stops only
* A - Search for addresses only
* P - Search for POIs only
@@ -15,7 +17,7 @@ class LocationType(AutoName):
* 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
Make sure that selected type is supported by method by looking up
its acceptable types in argument description.
"""
@@ -44,4 +46,4 @@ class LocationType(AutoName):
"Search in all existing location pools"
SPE = auto()
"Search for stations/stops, POIs and entrypoints"
"Search for stations/stops, POIs and entrypoints"

View File

@@ -1,6 +1,8 @@
from enum import auto
from .auto_name import AutoNameProduct
class Product(AutoNameProduct):
"""Enumeration used to declare types of transport."""
@@ -11,7 +13,7 @@ class Product(AutoNameProduct):
"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."
'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."
@@ -44,4 +46,4 @@ class Product(AutoNameProduct):
"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."
"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."

View File

@@ -1,6 +1,8 @@
from enum import auto
from .auto_name import AutoName
class RealTimeMode(AutoName):
"""Enumeration used to declare types of real-time traffic."""
@@ -17,4 +19,4 @@ class RealTimeMode(AutoName):
"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."
"One of the other real-times modes used by default for RMV."

View File

@@ -1,6 +1,8 @@
from enum import auto
from .auto_name import AutoName
class SearchMode(AutoName):
"""Enumeration used to declare types of HIM search modes."""
@@ -11,4 +13,4 @@ class SearchMode(AutoName):
"Iterate over all HIM messages available."
TFMATCH = auto()
"Uses filters defined `metas` parameter."
"Uses filters defined `metas` parameter."

View File

@@ -1,9 +1,11 @@
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
"""
@@ -12,4 +14,4 @@ class SelectionMode(AutoName):
"Selectable"
SLCT_N = auto()
"Not selectable"
"Not selectable"