v0.4.0 #53
1
.gitignore
vendored
1
.gitignore
vendored
@ -154,6 +154,7 @@ cython_debug/
|
|||||||
|
|
||||||
|
|
||||||
# Custom
|
# Custom
|
||||||
|
.mise.toml
|
||||||
.vscode/
|
.vscode/
|
||||||
.venv_linux/
|
.venv_linux/
|
||||||
.venv_windows/
|
.venv_windows/
|
||||||
|
@ -21,6 +21,7 @@ classifiers = [
|
|||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||||
"Topic :: Utilities",
|
"Topic :: Utilities",
|
||||||
]
|
]
|
||||||
@ -44,7 +45,7 @@ speed = { file = "requirements/speed.txt" }
|
|||||||
where = ["src"]
|
where = ["src"]
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
target-version = ['py38', 'py39', 'py310', 'py311']
|
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']
|
||||||
line-length = 94
|
line-length = 94
|
||||||
|
|
||||||
[tool.isort]
|
[tool.isort]
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
requests~=2.32.0
|
requests~=2.32.3
|
||||||
xmltodict~=0.13.0
|
xmltodict~=0.13.0
|
||||||
isodate~=0.6.1
|
isodate~=0.6.1
|
@ -1,12 +1,12 @@
|
|||||||
black~=24.8.0
|
black~=24.8.0
|
||||||
build==1.2.2
|
|
||||||
isort==5.13.2
|
isort==5.13.2
|
||||||
mypy~=1.11.0
|
mypy~=1.11.2
|
||||||
pylint==3.2.7
|
pylint==3.2.7
|
||||||
pytest-asyncio~=0.24.0
|
|
||||||
pytest-cov~=5.0.0
|
pytest-cov~=5.0.0
|
||||||
pytest~=8.3.1
|
pytest~=8.3.2
|
||||||
tox==4.18.1
|
tox==4.18.1
|
||||||
twine~=5.1.0
|
|
||||||
types-aiofiles~=24.1.0.20240626
|
|
||||||
types-ujson~=5.10.0.20240515
|
types-ujson~=5.10.0.20240515
|
||||||
|
|
||||||
|
# Disabled async libraries for now
|
||||||
|
# types-aiofiles~=24.1.0.20240626
|
||||||
|
# pytest-asyncio~=0.24.0
|
2
requirements/dist.txt
Normal file
2
requirements/dist.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
build==1.2.2
|
||||||
|
twine~=5.1.1
|
@ -3,6 +3,7 @@ from .gis import Gis
|
|||||||
from .journey import Journey
|
from .journey import Journey
|
||||||
from .leg import Leg
|
from .leg import Leg
|
||||||
from .message import Channel, Message, Url
|
from .message import Channel, Message, Url
|
||||||
|
from .platform_type import PlatformType
|
||||||
from .stop import Stop, StopTrip
|
from .stop import Stop, StopTrip
|
||||||
from .ticket import Ticket
|
from .ticket import Ticket
|
||||||
from .trip import Trip
|
from .trip import Trip
|
||||||
|
17
src/pyrmv/classes/platform_type.py
Normal file
17
src/pyrmv/classes/platform_type.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from typing import Any, Mapping, Union
|
||||||
|
|
||||||
|
from pyrmv.enums.platform_type_type import PlatformTypeType
|
||||||
|
|
||||||
|
|
||||||
|
class PlatformType:
|
||||||
|
"""Platform information."""
|
||||||
|
|
||||||
|
def __init__(self, data: Mapping[str, Any]):
|
||||||
|
self.type: PlatformTypeType = (
|
||||||
|
PlatformTypeType.U if "type" not in data else PlatformTypeType(data.get("type"))
|
||||||
|
)
|
||||||
|
self.text: Union[str, None] = data.get("text")
|
||||||
|
self.hidden: bool = bool(data.get("hidden"))
|
||||||
|
self.lon: float = data["lon"]
|
||||||
|
self.lat: float = data["lat"]
|
||||||
|
self.alt: int = data["alt"]
|
@ -4,6 +4,7 @@ from .board_type import BoardArrivalType, BoardDepartureType
|
|||||||
from .filter_mode import FilterMode
|
from .filter_mode import FilterMode
|
||||||
from .lang import Language
|
from .lang import Language
|
||||||
from .location_type import LocationType
|
from .location_type import LocationType
|
||||||
|
from .platform_type_type import PlatformTypeType
|
||||||
from .product import Product
|
from .product import Product
|
||||||
from .rt_mode import RealTimeMode
|
from .rt_mode import RealTimeMode
|
||||||
from .search_mode import SearchMode
|
from .search_mode import SearchMode
|
||||||
|
51
src/pyrmv/enums/platform_type_type.py
Normal file
51
src/pyrmv/enums/platform_type_type.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
from enum import Enum, auto
|
||||||
|
|
||||||
|
|
||||||
|
class PlatformTypeType(Enum):
|
||||||
|
"""Enumeration used to declare types of platform type.
|
||||||
|
|
||||||
|
* U - Undefined
|
||||||
|
* PL - Platform/track at train station
|
||||||
|
* ST - Stop at bus or tram station
|
||||||
|
* GA - Terminal/Gate at airport
|
||||||
|
* PI - Pier if ship or ferry
|
||||||
|
* SL - Slot/parking space if bike or car
|
||||||
|
* FL - Floor in buildings or at footpath
|
||||||
|
* CI - Check-in/entrance
|
||||||
|
* CO - Check-out/exit
|
||||||
|
* X - No explicit type
|
||||||
|
* H - Hide platform information
|
||||||
|
"""
|
||||||
|
|
||||||
|
U = auto()
|
||||||
|
"Undefined"
|
||||||
|
|
||||||
|
PL = auto()
|
||||||
|
"Platform/track at train station"
|
||||||
|
|
||||||
|
ST = auto()
|
||||||
|
"Stop at bus or tram station"
|
||||||
|
|
||||||
|
GA = auto()
|
||||||
|
"Terminal/Gate at airport"
|
||||||
|
|
||||||
|
PI = auto()
|
||||||
|
"Pier if ship or ferry"
|
||||||
|
|
||||||
|
SL = auto()
|
||||||
|
"Slot/parking space if bike or car"
|
||||||
|
|
||||||
|
FL = auto()
|
||||||
|
"Floor in buildings or at footpath"
|
||||||
|
|
||||||
|
CI = auto()
|
||||||
|
"Check-in/entrance"
|
||||||
|
|
||||||
|
CO = auto()
|
||||||
|
"Check-out/exit"
|
||||||
|
|
||||||
|
X = auto()
|
||||||
|
"No explicit type"
|
||||||
|
|
||||||
|
H = auto()
|
||||||
|
"Hide platform information"
|
@ -20,9 +20,12 @@ def test_board_departure(api_client: Client, sample_stop_id: str):
|
|||||||
|
|
||||||
|
|
||||||
def test_him_search(api_client: Client):
|
def test_him_search(api_client: Client):
|
||||||
assert isinstance(
|
response = api_client.him_search(time_end=datetime.now() + timedelta(days=10))
|
||||||
api_client.him_search(time_end=datetime.now() + timedelta(days=10))[0], Message
|
|
||||||
)
|
if len(response) != 0:
|
||||||
|
assert isinstance(response[0], Message)
|
||||||
|
else:
|
||||||
|
assert isinstance(response, list)
|
||||||
|
|
||||||
|
|
||||||
def test_journey_detail(api_client: Client, sample_journey_id: str):
|
def test_journey_detail(api_client: Client, sample_journey_id: str):
|
||||||
|
4
tox.ini
4
tox.ini
@ -1,6 +1,6 @@
|
|||||||
[tox]
|
[tox]
|
||||||
minversion = 3.8.0
|
minversion = 3.8.0
|
||||||
envlist = py38, py39, py310, py311
|
envlist = py38, py39, py310, py311, py312
|
||||||
isolated_build = true
|
isolated_build = true
|
||||||
|
|
||||||
[gh-actions]
|
[gh-actions]
|
||||||
@ -9,6 +9,7 @@ python =
|
|||||||
3.9: py39
|
3.9: py39
|
||||||
3.10: py310
|
3.10: py310
|
||||||
3.11: py311
|
3.11: py311
|
||||||
|
3.12: py312
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
setenv =
|
setenv =
|
||||||
@ -21,4 +22,3 @@ deps =
|
|||||||
-r{toxinidir}/requirements/speed.txt
|
-r{toxinidir}/requirements/speed.txt
|
||||||
commands =
|
commands =
|
||||||
pytest --basetemp={envtmpdir} --cov=pyrmv --cov-report term-missing
|
pytest --basetemp={envtmpdir} --cov=pyrmv --cov-report term-missing
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user