LOR¶
- class pyrcs.line_data.LOR(data_dir=None, update=False, verbose=True)[source]¶
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 | 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.
valid_prefixes (list) – A list of 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
The key for accessing the data.
The key for accessing the data of ELR/LOR converter.
The key for accessing the data of prefixes.
The key used to reference the last updated date in the data.
The name of the data.
A short name of the data
The URL of the main web page for the data.
Methods
collect_codes
(prefix[, ...])Collects data of PRIDE/LOR codes for the given prefix.
collect_elr_lor_converter
([...])Collects data of ELR/LOR converter from the source web page.
collect_keys_to_prefixes
([...])Collects the keys to PRIDE/LOR code prefixes from the source web page.
collect_page_urls
([confirmation_required, ...])Collects a list of URLs to PRIDE/LOR codes web pages.
fetch_codes
([prefix, update, dump_dir, verbose])Fetches data of PRIDE/LOR codes.
fetch_elr_lor_converter
([update, dump_dir, ...])Fetches data of ELR/LOR converter.
get_keys_to_prefixes
([prefixes_only, ...])Gets the keys to PRIDE/LOR code prefixes.
get_page_urls
([update, dump_dir, verbose])get_url
(prefix)Generates the URL for the given PRIDE/LOR code prefix.
validate_prefix
(prefix)Validates and standardises a PRIDE/LOR code prefix.