Depots

class pyrcs.other_assets.Depots(data_dir=None, update=False, verbose=True)[source]

A class for collecting data of depot codes.

Parameters:
  • data_dir (str | None) – The name of the directory for storing the data; defaults to None.

  • update (bool) – Whether to check for updates to the catalogue; defaults to False.

  • verbose (bool | int) – Whether to print relevant information to the console; defaults to True.

Variables:
  • catalogue (dict) – The catalogue of the data.

  • last_updated_date (str) – The date when the data was last updated.

  • data_dir (str) – The path to the directory containing the data.

  • current_data_dir (str) – The 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

The key for accessing the data.

KEY_TO_1950_SYSTEM

The key for accessing the data of 1950 system (pre-TOPS) codes

KEY_TO_GWR

The key for accessing the data of GWR codes

KEY_TO_LAST_UPDATED_DATE

The key used to reference the last updated date in the data.

KEY_TO_PRE_TOPS

The key for accessing the data of four digit pre-TOPS codes

KEY_TO_TOPS

The key for accessing the data of two character TOPS codes

NAME

The name of the data.

URL

The URL of the main web page for the data.

Methods

collect_1950_system_codes([...])

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

collect_gwr_codes([confirmation_required, ...])

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

collect_pre_tops_codes([...])

Collects four-digit pre-TOPS codes from the source web page.

collect_tops_codes([confirmation_required, ...])

Collects two-character TOPS codes from the source web page.

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

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

fetch_codes([update, dump_dir, verbose])

Fetches data of depot codes.

fetch_gwr_codes([update, dump_dir, verbose])

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

fetch_pre_tops_codes([update, dump_dir, verbose])

Fetches data of four-digit pre-TOPS codes.

fetch_tops_codes([update, dump_dir, verbose])

Fetches data of two-character TOPS codes.