Depots¶
A class for collecting depot codes.
Depots.collect_two_char_tops_codes ([…]) |
Collect two-character TOPS codes from source web page. |
Depots.fetch_two_char_tops_codes ([update, …]) |
Fetch two-character TOPS codes from local backup. |
Depots.collect_four_digit_pre_tops_codes ([…]) |
Collect four-digit pre-TOPS codes from source web page. |
Depots.fetch_four_digit_pre_tops_codes ([…]) |
Fetch four-digit pre-TOPS codes from local backup. |
Depots.collect_1950_system_codes ([…]) |
Collect 1950 system (pre-TOPS) codes from source web page. |
Depots.fetch_1950_system_codes ([update, …]) |
Fetch 1950 system (pre-TOPS) codes from local backup. |
Depots.collect_gwr_codes ([…]) |
Collect Great Western Railway (GWR) depot codes from source web page. |
Depots.fetch_gwr_codes ([update, pickle_it, …]) |
Fetch Great Western Railway (GWR) depot codes from local backup. |
Depots.fetch_depot_codes ([update, …]) |
Fetch depots codes from local backup. |
-
class
pyrcs.other_assets.
Depots
(data_dir=None, update=False)[source]¶ A class for collecting depot codes.
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.other_assets import Depots depots = Depots() print(depots.Name) # Depot codes print(depots.SourceURL) # http://www.railwaycodes.org.uk/depots/depots0.shtm
-
collect_two_char_tops_codes
(confirmation_required=True, verbose=False)[source]¶ Collect two-character TOPS codes from source web page.
Parameters: - confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to
True
- verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to
False
Returns: data of two-character TOPS codes and date of when the data was last updated
Return type: dict, None
Example:
from pyrcs.other_assets import Depots depots = Depots() confirmation_required = True two_char_tops_codes_data = depots.collect_two_char_tops_codes(confirmation_required) # To collect data of two character TOPS codes? [No]|Yes: # >? yes print(two_char_tops_codes_data) # {'Two character TOPS codes': <codes>, # 'Last updated date': <date>}
- confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to
-
fetch_two_char_tops_codes
(update=False, pickle_it=False, data_dir=None, verbose=False)[source]¶ Fetch two-character TOPS codes 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: data of two-character TOPS codes and date of when the data was last updated
Return type: dict
Example:
from pyrcs.other_assets import Depots depots = Depots() update = False pickle_it = False data_dir = None two_char_tops_codes_data = depots.fetch_two_char_tops_codes(update, pickle_it, data_dir) print(two_char_tops_codes_data) # {'Two character TOPS codes': <codes>, # 'Last updated date': <date>}
- update (bool) – whether to check on update and proceed to update the package data, defaults to
-
collect_four_digit_pre_tops_codes
(confirmation_required=True, verbose=False)[source]¶ Collect four-digit pre-TOPS codes from source web page.
Parameters: - confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to
True
- verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to
False
Returns: data of two-character TOPS codes and date of when the data was last updated
Return type: dict, None
Example:
from pyrcs.other_assets import Depots depots = Depots() confirmation_required = True four_digit_pre_tops_codes = depots.collect_four_digit_pre_tops_codes(confirmation_required) # To collect data of four digit pre-TOPS codes? [No]|Yes: # >? yes print(four_digit_pre_tops_codes) # {'Four digit pre-TOPS codes': <codes>, # 'Last updated date': <date>}
- confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to
-
fetch_four_digit_pre_tops_codes
(update=False, pickle_it=False, data_dir=None, verbose=False)[source]¶ Fetch four-digit pre-TOPS codes 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: data of two-character TOPS codes and date of when the data was last updated
Return type: dict
Example:
from pyrcs.other_assets import Depots depots = Depots() update = False pickle_it = False data_dir = None four_digit_pretops_codes = depots.fetch_four_digit_pre_tops_codes(update, pickle_it, data_dir) print(four_digit_pretops_codes) # {'Four digit pre-TOPS codes': <codes>, # 'Last updated date': <date>}
- update (bool) – whether to check on update and proceed to update the package data, defaults to
-
collect_1950_system_codes
(confirmation_required=True, verbose=False)[source]¶ Collect 1950 system (pre-TOPS) codes from source web page.
Parameters: - confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to
True
- verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to
False
Returns: data of 1950 system (pre-TOPS) codes and date of when the data was last updated
Return type: dict, None
Example:
from pyrcs.other_assets import Depots depots = Depots() confirmation_required = True system_1950_codes_data = depots.collect_1950_system_codes(confirmation_required) # To collect data of 1950 system (pre-TOPS) codes? [No]|Yes: # >? yes print(system_1950_codes_data) # {'1950 system (pre-TOPS) codes': <codes>, # 'Last updated date': <date>}
- confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to
-
fetch_1950_system_codes
(update=False, pickle_it=False, data_dir=None, verbose=False)[source]¶ Fetch 1950 system (pre-TOPS) codes 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: data of 1950 system (pre-TOPS) codes and date of when the data was last updated
Return type: dict
Example:
from pyrcs.other_assets import Depots depots = Depots() update = False pickle_it = False data_dir = None system_1950_codes_data = depots.fetch_1950_system_codes(update, pickle_it, data_dir) print(system_1950_codes_data) # {'1950 system (pre-TOPS) codes': <codes>, # 'Last updated date': <date>}
- update (bool) – whether to check on update and proceed to update the package data, defaults to
-
collect_gwr_codes
(confirmation_required=True, verbose=False)[source]¶ Collect Great Western Railway (GWR) depot codes from source web page.
Parameters: - confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to
True
- verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to
False
Returns: data of GWR depot codes and date of when the data was last updated
Return type: dict, None
Example:
from pyrcs.other_assets import Depots depots = Depots() confirmation_required = True gwr_codes_data = depots.collect_gwr_codes(confirmation_required) # To collect data of GWR codes? [No]|Yes: # >? yes print(gwr_codes_data) # {'GWR codes': <codes>, # 'Last updated date': <date>}
- confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to
-
fetch_gwr_codes
(update=False, pickle_it=False, data_dir=None, verbose=False)[source]¶ Fetch Great Western Railway (GWR) depot codes 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: data of GWR depot codes and date of when the data was last updated
Return type: dict
Example:
from pyrcs.other_assets import Depots depots = Depots() update = False pickle_it = False data_dir = None gwr_codes_data = depots.fetch_gwr_codes(update, pickle_it, data_dir) print(gwr_codes_data) # {'GWR codes': <codes>, # 'Last updated date': <date>}
- update (bool) – whether to check on update and proceed to update the package data, defaults to
-
fetch_depot_codes
(update=False, pickle_it=False, data_dir=None, verbose=False)[source]¶ Fetch depots codes 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: data of depot codes and date of when the data was last updated
Return type: dict
Example:
from pyrcs.other_assets import Depots depots = Depots() update = False pickle_it = False data_dir = None depot_codes = depots.fetch_depot_codes(update, pickle_it, data_dir) print(depot_codes) # {'Depots': <codes>, # '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