Attempt to temporarily fix #2
This commit is contained in:
@@ -2,11 +2,15 @@ from datetime import datetime
|
||||
from typing import Any, Mapping
|
||||
|
||||
from pyrmv.classes.message import Message
|
||||
from pyrmv.utility import ref_upgrade
|
||||
|
||||
|
||||
class LineArrival:
|
||||
def __init__(self, data: Mapping[str, Any], client, retrieve_stops: bool = True):
|
||||
self.journey = client.journey_detail(data["JourneyDetailRef"]["ref"])
|
||||
# Upgrade is temporarily used due to RMV API mismatch
|
||||
# self.journey = client.journey_detail(data["JourneyDetailRef"]["ref"])
|
||||
self.journey = client.journey_detail(ref_upgrade(data["JourneyDetailRef"]["ref"]))
|
||||
|
||||
self.status = data["JourneyStatus"]
|
||||
self.messages = []
|
||||
self.name = data["name"]
|
||||
@@ -40,7 +44,10 @@ class LineArrival:
|
||||
|
||||
class LineDeparture:
|
||||
def __init__(self, data: Mapping[str, Any], client, retrieve_stops: bool = True):
|
||||
self.journey = client.journey_detail(data["JourneyDetailRef"]["ref"])
|
||||
# Upgrade is temporarily used due to RMV API mismatch
|
||||
# self.journey = client.journey_detail(data["JourneyDetailRef"]["ref"])
|
||||
self.journey = client.journey_detail(ref_upgrade(data["JourneyDetailRef"]["ref"]))
|
||||
|
||||
self.status = data["JourneyStatus"]
|
||||
self.messages = []
|
||||
self.name = data["name"]
|
||||
|
@@ -121,7 +121,7 @@ class Client:
|
||||
* BoardArrival: Instance of `BoardArrival` object.
|
||||
"""
|
||||
|
||||
if isinstance(direction, Stop) or isinstance(direction, StopTrip):
|
||||
if isinstance(direction, (Stop, StopTrip)):
|
||||
direction = direction.id
|
||||
|
||||
board_raw = raw_board_arrival(
|
||||
@@ -827,10 +827,7 @@ class Client:
|
||||
* List[Trip]: List of `Trip` objects. Empty list if none found.
|
||||
"""
|
||||
|
||||
if real_time_mode == None:
|
||||
real_time_mode = None
|
||||
else:
|
||||
real_time_mode = real_time_mode.code
|
||||
real_time_mode = None if real_time_mode is None else real_time_mode.code
|
||||
|
||||
if isinstance(context, Trip):
|
||||
context = context.ctx_recon
|
||||
|
@@ -2,6 +2,7 @@ from typing import Any, Mapping
|
||||
|
||||
from pyrmv.classes.message import Message
|
||||
from pyrmv.classes.stop import Stop
|
||||
from pyrmv.utility import ref_upgrade
|
||||
|
||||
|
||||
class Journey:
|
||||
@@ -9,7 +10,11 @@ class Journey:
|
||||
|
||||
def __init__(self, data: Mapping[str, Any]):
|
||||
self.stops = []
|
||||
self.ref = data["ref"]
|
||||
|
||||
# Upgrade is temporarily used due to RMV API mismatch
|
||||
# self.ref = data["ref"]
|
||||
self.ref = ref_upgrade(data["ref"])
|
||||
|
||||
self.direction = data["Directions"]["Direction"][0]["value"]
|
||||
self.direction_flag = data["Directions"]["Direction"][0]["flag"]
|
||||
self.stops.extend(Stop(stop) for stop in data["Stops"]["Stop"])
|
||||
|
Reference in New Issue
Block a user