From fe3e839abbb67a05611af47491a630c034ddd1bb Mon Sep 17 00:00:00 2001 From: profitroll Date: Wed, 5 Oct 2022 12:17:51 +0200 Subject: [PATCH] Classes docstring improved --- pyrmv/classes/Gis.py | 1 + pyrmv/classes/Leg.py | 1 + pyrmv/classes/Message.py | 3 +++ pyrmv/classes/Stop.py | 6 ++++++ pyrmv/classes/Trip.py | 1 + 5 files changed, 12 insertions(+) diff --git a/pyrmv/classes/Gis.py b/pyrmv/classes/Gis.py index 7d3939e..b0c3990 100644 --- a/pyrmv/classes/Gis.py +++ b/pyrmv/classes/Gis.py @@ -1,6 +1,7 @@ from isodate import parse_duration class Gis(): + """Gis object.""" def __init__(self, ref: str, route: dict): diff --git a/pyrmv/classes/Leg.py b/pyrmv/classes/Leg.py index 3b4c561..7de63bc 100644 --- a/pyrmv/classes/Leg.py +++ b/pyrmv/classes/Leg.py @@ -4,6 +4,7 @@ from pyrmv.classes.Stop import StopTrip from isodate import parse_duration class Leg(): + """Trip leg object.""" def __init__(self, data: dict): diff --git a/pyrmv/classes/Message.py b/pyrmv/classes/Message.py index 4d7ec98..d70008b 100644 --- a/pyrmv/classes/Message.py +++ b/pyrmv/classes/Message.py @@ -3,6 +3,7 @@ from datetime import datetime from isodate import parse_duration class Url(): + """Traffic message channel url object.""" def __init__(self, data: dict) -> None: self.name = data["name"] @@ -12,6 +13,7 @@ class Url(): return f"{self.name}: {self.url}" class Channel(): + """Traffic message channel object.""" def __init__(self, data: dict) -> None: self.name = data["name"] @@ -29,6 +31,7 @@ class Channel(): class Message(): + """Traffic message object.""" def __init__(self, data: dict) -> None: diff --git a/pyrmv/classes/Stop.py b/pyrmv/classes/Stop.py index 5301bc5..faa30ef 100644 --- a/pyrmv/classes/Stop.py +++ b/pyrmv/classes/Stop.py @@ -2,6 +2,7 @@ from datetime import datetime class Stop(): + """Stop object.""" def __init__(self, data: dict): @@ -11,6 +12,10 @@ class Stop(): self.ext_id = data["extId"] else: self.ext_id = None + if "description" in data: + self.description = data["description"] + else: + self.description = None self.lon = data["lon"] self.lat = data["lat"] @@ -18,6 +23,7 @@ class Stop(): return f"Stop {self.name} at {self.lon}, {self.lat}" class StopTrip(Stop): + """Trip stop object. It's like a Stop object, but with a date and time.""" def __init__(self, data: dict): diff --git a/pyrmv/classes/Trip.py b/pyrmv/classes/Trip.py index cc463ab..7422d12 100644 --- a/pyrmv/classes/Trip.py +++ b/pyrmv/classes/Trip.py @@ -3,6 +3,7 @@ from pyrmv.classes.Stop import StopTrip from isodate import parse_duration class Trip(): + """Trip object.""" def __init__(self, data: dict):