get_id() method removed
This commit is contained in:
parent
0bbda88433
commit
428442d1cb
@ -4,6 +4,7 @@ from datetime import datetime
|
|||||||
class Stop():
|
class Stop():
|
||||||
|
|
||||||
def __init__(self, data: dict):
|
def __init__(self, data: dict):
|
||||||
|
|
||||||
self.name = data["name"]
|
self.name = data["name"]
|
||||||
self.id = data["id"]
|
self.id = data["id"]
|
||||||
if "extId" in data:
|
if "extId" in data:
|
||||||
@ -13,29 +14,17 @@ class Stop():
|
|||||||
self.lon = data["lon"]
|
self.lon = data["lon"]
|
||||||
self.lat = data["lat"]
|
self.lat = data["lat"]
|
||||||
|
|
||||||
def get_id(self) -> str:
|
|
||||||
if self.id != None:
|
|
||||||
return self.id
|
|
||||||
elif self.ext_id != None:
|
|
||||||
return self.ext_id
|
|
||||||
elif self.name != None:
|
|
||||||
return self.name
|
|
||||||
else:
|
|
||||||
return f"{self.lon}, {self.lat}"
|
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return f"Stop {self.name} at {self.lon}, {self.lat}"
|
return f"Stop {self.name} at {self.lon}, {self.lat}"
|
||||||
|
|
||||||
class StopTrip(Stop):
|
class StopTrip(Stop):
|
||||||
|
|
||||||
def __init__(self, data: dict):
|
def __init__(self, data: dict):
|
||||||
|
|
||||||
self.type = data["type"]
|
self.type = data["type"]
|
||||||
self.date = datetime.strptime(data["date"], "%Y-%m-%d")
|
self.date = datetime.strptime(data["date"], "%Y-%m-%d")
|
||||||
self.time = datetime.strptime(data["time"], "%H:%M:%S")
|
self.time = datetime.strptime(data["time"], "%H:%M:%S")
|
||||||
super().__init__(data)
|
super().__init__(data)
|
||||||
|
|
||||||
def get_id(self) -> str:
|
|
||||||
return super().get_id()
|
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return f"Stop {self.name} at {self.lon}, {self.lat} at {self.time.time()} {self.date.date()}"
|
return f"Stop {self.name} at {self.lon}, {self.lat} at {self.time.time()} {self.date.date()}"
|
Loading…
Reference in New Issue
Block a user