parse_location_name

pyrcs.utils.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, if any, note

Return type

tuple

Examples:

>>> from pyrcs.utils import parse_location_name

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

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

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

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

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