SignalBoxes

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

A class for collecting data of signal box prefix 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 SignalBoxes  # from pyrcs import SignalBoxes
>>> sb = SignalBoxes()
>>> sb.NAME
'Signal box prefix codes'
>>> sb.URL
'http://www.railwaycodes.org.uk/signal/signal_boxes0.shtm'

Attributes

KEY

The key for accessing the data.

KEY_TO_BELL_CODES

The key for accessing the data of bell codes.

KEY_TO_IRELAND

The key for accessing the data of Ireland.

KEY_TO_LAST_UPDATED_DATE

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

KEY_TO_NON_NATIONAL_RAIL

The key for accessing the data of non-national rail.

KEY_TO_WRMASD

The key for accessing the data of WR (Western region) MAS (multiple aspect signalling) dates.

NAME

The name of the data.

URL

The URL of the main web page for the data.

Methods

collect_bell_codes([confirmation_required, ...])

Collects data of bell codes from the source web page.

collect_ireland_codes([...])

Collects data of Irish signal cabin prefix codes from the source web page.

collect_non_national_rail_codes([...])

Collects signal box prefix codes for non-national rail from the source web page.

collect_prefix_codes(initial[, ...])

Collects signal box prefix codes for a given initial letter from the source web page.

collect_wr_mas_dates([...])

Collects data of WR (western region) MAS (multiple aspect signalling) dates from the source web page.

fetch_bell_codes([update, dump_dir, verbose])

Fetches data of bell codes.

fetch_ireland_codes([update, dump_dir, verbose])

Fetches data of Irish signal cabin prefix codes.

fetch_non_national_rail_codes([update, ...])

Fetches signal box prefix codes for non-national rail.

fetch_prefix_codes([initial, update, ...])

Fetches data of signal box prefix codes.

fetch_wr_mas_dates([update, dump_dir, verbose])

Fetches data of WR (western region) MAS (multiple aspect signalling) dates.