Tunnels

class pyrcs.other_assets.tunnel.Tunnels(data_dir=None, update=False, verbose=True)

A class for collecting data of 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
  • catalogue (dict) – catalogue of the data

  • last_updated_date (str) – last updated date

  • data_dir (str) – path to the data directory

  • current_data_dir (str) – path to the current data directory

Examples:

>>> from pyrcs.other_assets import Tunnels  # from pyrcs import Tunnels

>>> tunl = Tunnels()

>>> tunl.NAME
'Railway tunnel lengths'

>>> tunl.URL
'http://www.railwaycodes.org.uk/tunnels/tunnels0.shtm'

Attributes

KEY

Key of the dict-type data

KEY_TO_LAST_UPDATED_DATE

Key of the data of the last updated date

NAME

Name of the data

URL

URL of the main web page of the data

Methods

collect_codes_by_page(page_no[, update, verbose])

Collect data of railway tunnel lengths for a page number from source web page.

fetch_codes([update, dump_dir, verbose])

Fetch data of railway tunnel lengths.

parse_length(x)

Parse data in 'Length' column, i.e. convert miles/yards to metres.