Depots

class pyrcs.other_assets.depot.Depots(data_dir=None, update=False, verbose=True)

A class for collecting data of depot codes.

Parameters
  • data_dir (str or None) – name of data directory, defaults to None

  • update (bool) – whether to do an update check (for the catagloue 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 Depots  # from pyrcs import Depots

>>> depots = Depots()

>>> depots.NAME
'Depot codes'

>>> depots.URL
'http://www.railwaycodes.org.uk/depots/depots0.shtm'

Attributes

KEY

Key of the dict-type data

KEY_TO_1950_SYSTEM

Key of the dict-type data of 1950 system (pre-TOPS) codes

KEY_TO_GWR

Key of the dict-type data of GWR codes

KEY_TO_LAST_UPDATED_DATE

Key of the data of the last updated date

KEY_TO_PRE_TOPS

Key of the dict-type data of four digit pre-TOPS codes

KEY_TO_TOPS

Key of the dict-type data of two character TOPS codes

NAME

Name of the data

URL

URL of the main web page of the data

Methods

collect_1950_system_codes([...])

Collect 1950 system (pre-TOPS) codes from source web page.

collect_gwr_codes([confirmation_required, ...])

Collect Great Western Railway (GWR) depot codes from source web page.

collect_pre_tops_codes([...])

Collect four-digit pre-TOPS codes from source web page.

collect_tops_codes([confirmation_required, ...])

Collect two-character TOPS codes from source web page.

fetch_1950_system_codes([update, dump_dir, ...])

Fetch data of 1950 system (pre-TOPS) codes.

fetch_codes([update, dump_dir, verbose])

Fetch data of depot codes.

fetch_gwr_codes([update, dump_dir, verbose])

Fetch data of Great Western Railway (GWR) depot codes.

fetch_pre_tops_codes([update, dump_dir, verbose])

Fetch data of four-digit pre-TOPS codes.

fetch_tops_codes([update, dump_dir, verbose])

Fetch data of two-character TOPS codes.