Tunnels¶
-
class
tunnel.
Tunnels
(data_dir=None, update=False, verbose=True)¶ A class for collecting railway tunnel lengths.
- Parameters
data_dir (str or None) – name of data directory, defaults to
None
update (bool) – whether to do an update check (for the package data), defaults to
False
verbose (bool or int) – whether to print relevant information in console, defaults to
True
- Variables
Name (str) – name of the data
Key (str) – key of the dict-type data
HomeURL (str) – URL of the main homepage
SourceURL (str) – URL of the data web page
LUDKey (str) – key of the last updated date
LUD (str) – last updated date
Catalogue (dict) – catalogue of the data
DataDir (str) – path to the data directory
CurrentDataDir (str) – path to the current data directory
P1Key (str) – key of the dict-type data of Page 1
P2Key (str) – key of the dict-type data of Page 2
P3Key (str) – key of the dict-type data of Page 3
P4Key (str) – key of the dict-type data of Page 4
Example:
>>> from pyrcs.other_assets import Tunnels >>> tunl = Tunnels() >>> print(tunl.Name) Railway tunnel lengths >>> print(tunl.SourceURL) http://www.railwaycodes.org.uk/tunnels/tunnels0.shtm
Methods
collect_lengths_by_page
(page_no[, update, …])Collect data of railway tunnel lengths for a page number from source web page.
fetch_tunnel_lengths
([update, pickle_it, …])Fetch data of railway tunnel lengths from local backup.
parse_length
(x)Parse data in
'Length'
column, i.e. convert miles/yards to metres.