From 0a810314220a8934971a59f8131d39df796dd1eb Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 20 May 2021 18:41:28 -0400 Subject: [PATCH] Check invalid stations parameter type for Client.select_stations() (#51) --- HinetPy/client.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/HinetPy/client.py b/HinetPy/client.py index 0d265d17..21d57bd6 100644 --- a/HinetPy/client.py +++ b/HinetPy/client.py @@ -1151,9 +1151,16 @@ def select_stations( 0 """ + stations_selected = [] + if stations is None: - stations = [] - stations_selected = stations + pass + elif isinstance(stations, str): # stations is a str, i.e., one station + stations_selected.append(stations) + elif isinstance(stations, list): + stations_selected.extend(stations) + else: + raise ValueError("stations should be either a str or a list.") # get station list from Hi-net server stations_at_server = self.get_station_list(code)