LOR

class pyrcs.line_data.lor_code.LOR(data_dir=None, update=False, verbose=True)

A class for collecting data of Line of Route (LOR/PRIDE).

Note

‘LOR’ and ‘PRIDE’ stands for ‘Line Of Route’ and ‘Possession Resource Information Database’, respectively.

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

  • update (bool) – whether to do an update check (for the package 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

  • valid_prefixes (list) – valid prefixes

Examples:

>>> from pyrcs.line_data import LOR  # from pyrcs import LOR

>>> lor = LOR()

>>> lor.NAME
'Possession Resource Information Database (PRIDE)/Line Of Route (LOR) codes'

>>> lor.URL
'http://www.railwaycodes.org.uk/pride/pride0.shtm'

Attributes

KEY

Key of the dict-type data

KEY_ELC

Key of the dict-type data of ELR/LOR converter

KEY_P

Key of the dict-type data of prefixes

KEY_TO_LAST_UPDATED_DATE

Key of the data of the last updated date

NAME

Name of the data

SHORT_NAME

Short name of the data

URL

URL of the main web page of the data

Methods

collect_codes_by_prefix(prefix[, update, ...])

Collect PRIDE/LOR codes by a given prefix.

collect_elr_lor_converter([...])

Collect ELR/LOR converter from source web page.

fetch_codes([update, dump_dir, verbose])

Fetch data of PRIDE/LOR codes.

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

Fetch data of ELR/LOR converter.

get_keys_to_prefixes([prefixes_only, ...])

Get the keys to PRIDE/LOR code prefixes.

get_page_urls([update, verbose])

Get URLs to PRIDE/LOR codes with different prefixes.