parse_location_name

pyrcs.parser.parse_location_name(location_name)

Parse location name (and its associated note).

Parameters

location_name (str or None) – location name (in raw data)

Returns

location name and note (if any)

Return type

tuple

Examples:

>>> from pyrcs.parser import parse_location_name

>>> dat_and_note = parse_location_name('Abbey Wood')
>>> dat_and_note
('Abbey Wood', '')

>>> dat_and_note = parse_location_name(None)
>>> dat_and_note
('', '')

>>> dat_and_note = parse_location_name('Abercynon (formerly Abercynon South)')
>>> dat_and_note
('Abercynon', 'formerly Abercynon South')

>>> location_dat = 'Allerton (reopened as Liverpool South Parkway)'
>>> dat_and_note = parse_location_name(location_dat)
>>> dat_and_note
('Allerton', 'reopened as Liverpool South Parkway')

>>> location_dat = 'Ashford International [domestic portion]'
>>> dat_and_note = parse_location_name(location_dat)
>>> dat_and_note
('Ashford International', 'domestic portion')