LineNames

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

A class for collecting data of railway line names.

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 data 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.line_data import LineNames  # from pyrcs import LineNames
>>> ln = LineNames()
>>> ln.NAME
'Railway line names'
>>> ln.URL
'http://www.railwaycodes.org.uk/misc/line_names.shtm'

Attributes

KEY

The key for accessing the data.

KEY_TO_LAST_UPDATED_DATE

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

NAME

The name of the data.

URL

The URL of the main web page for the data.

Methods

collect_codes([confirmation_required, ...])

Collects data of railway line names and associated route data from the source web page.

fetch_codes([update, dump_dir, verbose])

Fetches data of railway line names and associated route data.