LineNames¶
A class for collecting British railway line names.
LineNames.collect_line_names ([…]) |
Collect data of railway line names from source web page. |
LineNames.fetch_line_names ([update, …]) |
Fetch data of railway line names from local backup. |
-
class
pyrcs.line_data.
LineNames
(data_dir=None, update=False)[source]¶ A class for collecting British railway line names.
Parameters: - data_dir (str, None) – name of data directory, defaults to
None
- update (bool) – whether to check on update and proceed to update the package data, defaults to
False
Example:
from pyrcs.line_data import LineNames ln = LineNames() print(ln.Name) # Railway line names print(ln.SourceURL) # http://www.railwaycodes.org.uk/misc/line_names.shtm
-
collect_line_names
(confirmation_required=True, verbose=False)[source]¶ Collect data of railway line names from source web page.
Parameters: - confirmation_required (bool) – whether to require users to confirm and proceed, defaults to
True
- verbose (bool) – whether to print relevant information in console as the function runs, defaults to
False
Returns: railway line names and routes data and date of when the data was last updated
Return type: dict, None
Example:
from pyrcs.line_data import LineNames ln = LineNames() confirmation_required = True line_names_data = ln.collect_line_names(confirmation_required) # To collect British railway line names? [No]|Yes: # >? yes print(line_names_data) # {'Line names': <code>, # 'Last updated date': <date>}
- confirmation_required (bool) – whether to require users to confirm and proceed, defaults to
-
fetch_line_names
(update=False, pickle_it=False, data_dir=None, verbose=False)[source]¶ Fetch data of railway line names from local backup.
Parameters: - update (bool) – whether to check on update and proceed to update the package data, defaults to
False
- pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to
False
- data_dir (str, None) – name of package data folder, defaults to
None
- verbose (bool) – whether to print relevant information in console as the function runs, defaults to
False
Returns: railway line names and routes data and date of when the data was last updated
Return type: dict
Example:
from pyrcs.line_data import LineNames ln = LineNames() update = False pickle_it = False data_dir = None line_names_data = ln.fetch_line_names(update, pickle_it, data_dir) print(line_names_data) # {'Line names': <code>, # 'Last updated date': <date>}
- update (bool) – whether to check on update and proceed to update the package data, defaults to
- data_dir (str, None) – name of data directory, defaults to