SignalBoxes.fetch_bell_codes

SignalBoxes.fetch_bell_codes(update=False, dump_dir=None, verbose=False, **kwargs)[source]

Fetches data of bell codes.

Parameters:
  • update (bool) – Whether to check for updates to the package data; defaults to False.

  • dump_dir (str | None) – The path to a directory where the data file will be saved; defaults to None.

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

Returns:

A dictionary containing the data of bell codes and the date when they were last updated.

Return type:

dict

Examples:

>>> from pyrcs.other_assets import SignalBoxes  # from pyrcs import SignalBoxes

>>> sb = SignalBoxes()

>>> sb_bell_codes = sb.fetch_bell_codes()

>>> list(sb_bell_codes)
['Bell codes', 'Last updated date']

>>> sb_bell_codes_dict: dict = sb_bell_codes.get('Bell codes')

>>> list(sb_bell_codes_dict)
['Network Rail codes',
 'Southern Railway codes',
 'Lancashire & Yorkshire Railway codes']

>>> sb_nr_bell_codes: dict = sb_bell_codes_dict.get('Network Rail codes')

>>> list(sb_nr_bell_codes)
['Codes', 'Notes']

>>> sb_nr_bell_codes_df = sb_nr_bell_codes.get('Codes')

>>> sb_nr_bell_codes_df.shape
(69, 2)
>>> sb_nr_bell_codes_df.head()
    Code                                       Meaning
0      1                                Call attention
1    1-1             Answer telephone [withdrawn 2007]
2  1-1-6           Police assistance urgently required
3    1-2  Signaller required on telephone [added 2007]
4  1-2-1                             Train approaching