Skip to content

Commit

Permalink
rename the collect_ and fetch_ methods in station.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeqfu committed Oct 31, 2020
1 parent ad1dace commit 6dd583d
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pyrcs/other_assets/station.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ def parse_current_operator(x):

return operators

def collect_railway_station_data_by_initial(self, initial, update=False,
verbose=False):
def collect_station_data_by_initial(self, initial, update=False, verbose=False):
"""
Collect railway station data for the given ``initial`` letter.
Expand All @@ -149,7 +148,7 @@ def collect_railway_station_data_by_initial(self, initial, update=False,
>>> stn = Stations()
>>> stn_data_a = stn.collect_railway_station_data_by_initial(initial='a')
>>> stn_data_a = stn.collect_station_data_by_initial(initial='a')
>>> type(stn_data_a)
<class 'dict'>
Expand Down Expand Up @@ -207,8 +206,8 @@ def parse_degrees(x):
itertools.chain.from_iterable(
itertools.repeat(x, 2) for x in list(range(1, length))))
col_names = zip(col_names_current * (length - 1), prev_no)
col_names = col_names_current + \
['_'.join(['Prev', x, str(d)]) for x, d in col_names]
col_names = col_names_current + [
'_'.join(['Prev', x, str(d)]) for x, d in col_names]

for i in range(len(temp)):
if len(temp[i]) < length:
Expand Down Expand Up @@ -243,8 +242,8 @@ def parse_degrees(x):

return railway_station_data

def fetch_railway_station_data(self, update=False, pickle_it=False, data_dir=None,
verbose=False):
def fetch_station_data(self, update=False, pickle_it=False, data_dir=None,
verbose=False):
"""
Fetch railway station data from local backup.
Expand All @@ -260,7 +259,7 @@ def fetch_railway_station_data(self, update=False, pickle_it=False, data_dir=Non
as the function runs, defaults to ``False``
:type verbose: bool, int
:return: railway station data
(incl. the station name, ELR, mileage, status, owner, operator,
(including the station name, ELR, mileage, status, owner, operator,
degrees of longitude and latitude, and grid reference) and
date of when the data was last updated
:rtype: dict
Expand All @@ -271,7 +270,7 @@ def fetch_railway_station_data(self, update=False, pickle_it=False, data_dir=Non
>>> stn = Stations()
>>> stn_data = stn.fetch_railway_station_data()
>>> stn_data = stn.fetch_station_data()
>>> type(stn_data)
<class 'dict'>
Expand All @@ -293,7 +292,7 @@ def fetch_railway_station_data(self, update=False, pickle_it=False, data_dir=Non
"""

verbose_ = False if data_dir or not verbose else True
data_sets = [self.collect_railway_station_data_by_initial(x, update, verbose_)
data_sets = [self.collect_station_data_by_initial(x, update, verbose_)
for x in string.ascii_lowercase]

railway_station_tables = (
Expand Down

0 comments on commit 6dd583d

Please sign in to comment.