TrackDiagrams¶
A class for collecting a catalogue of some sample British railway track diagrams.
TrackDiagrams.collect_sample_track_diagrams_catalogue ([…]) |
Collect catalogue of sample railway track diagrams from source web page. |
TrackDiagrams.fetch_sample_track_diagrams_catalogue ([…]) |
Fetch catalogue of sample railway track diagrams from local backup. |
-
class
pyrcs.line_data.
TrackDiagrams
(data_dir=None, update=False)[source]¶ A class for collecting British railway track diagrams.
Parameters: - data_dir (str, None) – name of data directory, defaults to
None
- update (bool) – whether to check on update and proceed to update the package data, defaults to
False
Example:
from pyrcs.line_data import TrackDiagrams td = TrackDiagrams() print(td.Name) # Railway track diagrams (some samples) print(td.SourceURL) # http://www.railwaycodes.org.uk/track/diagrams0.shtm
-
collect_sample_track_diagrams_catalogue
(confirmation_required=True, verbose=False)[source]¶ Collect catalogue of sample railway track diagrams from source web page.
Parameters: - confirmation_required (bool) – whether to require users to confirm and proceed, defaults to
True
- verbose (bool) – whether to print relevant information in console as the function runs, defaults to
False
Returns: catalogue of sample railway track diagrams and date of when the data was last updated
Return type: dict, None
Example:
from pyrcs.line_data import TrackDiagrams td = TrackDiagrams() confirmation_required = True track_diagrams_catalogue = td.collect_sample_track_diagrams_catalogue(confirmation_required) # To collect the catalogue of sample track diagrams? [No]|Yes: # >? yes print(track_diagrams_catalogue) # {'Track diagrams': <code>, # 'Last updated date': <date>}
- confirmation_required (bool) – whether to require users to confirm and proceed, defaults to
-
fetch_sample_track_diagrams_catalogue
(update=False, pickle_it=False, data_dir=None, verbose=False)[source]¶ Fetch catalogue of sample railway track diagrams from local backup.
Parameters: - update (bool) – whether to check on update and proceed to update the package data, defaults to
False
- pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to
False
- data_dir (str, None) – name of package data folder, defaults to
None
- verbose (bool) – whether to print relevant information in console as the function runs, defaults to
False
Returns: catalogue of sample railway track diagrams and date of when the data was last updated
Return type: dict
Example:
from pyrcs.line_data import TrackDiagrams td = TrackDiagrams() update = False pickle_it = False data_dir = None track_diagrams_cat = td.fetch_sample_track_diagrams_catalogue(update, pickle_it, data_dir) print(track_diagrams_cat) # {'Track diagrams': <code>, # 'Last updated date': <date>}
- update (bool) – whether to check on update and proceed to update the package data, defaults to
- data_dir (str, None) – name of data directory, defaults to