From c711badb46025b7f613e00b528490effc9c2d2c6 Mon Sep 17 00:00:00 2001 From: 7d <61975820+iiiii7d@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:45:25 +0800 Subject: [PATCH] fix name beint None when stripped --- .../src/gatelogue_aggregator/sources/rail/dynmap_mrt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gatelogue-aggregator/src/gatelogue_aggregator/sources/rail/dynmap_mrt.py b/gatelogue-aggregator/src/gatelogue_aggregator/sources/rail/dynmap_mrt.py index 4acdc456..b8c30083 100644 --- a/gatelogue-aggregator/src/gatelogue_aggregator/sources/rail/dynmap_mrt.py +++ b/gatelogue-aggregator/src/gatelogue_aggregator/sources/rail/dynmap_mrt.py @@ -46,7 +46,8 @@ def __init__(self, cache_dir: Path = DEFAULT_CACHE_DIR, timeout: int = DEFAULT_T code = k.upper() coordinates = (vv["x"], vv["z"]) name = None if (result := re.search(r"(.*) \((.*?)\)", vv["label"])) is None else result.group(1) - name = name.strip().removesuffix("Station") + if name is not None: + name = name.strip().removesuffix("Station") self.rail_station(codes={code}, company=company, coordinates=coordinates, name=name, world="New") rich.print(RESULT + f"MRT {line_code} has {len(v['markers'])} stations")