format_confirmation_prompt

pyrcs.utils.format_confirmation_prompt(data_name, initial=None, ending='?\n')[source]

Format a message confirming whether to proceed with collecting a dataset.

This function pieces together user-facing terminal prompts, customising output layouts depending on alphabetical index constraints.

Parameters:
  • data_name (str) – The name of the dataset to be collected, e.g. "Railway Codes".

  • initial (str | None) – The initial letter for the code. Defaults to None.

  • ending (str) – The ending of the confirmation message. Defaults to "?\n".

Returns:

A confirmation message asking whether to proceed with the dataset collection.

Return type:

str

Examples:

>>> from pyrcs.utils import format_confirmation_prompt

>>> prompt = format_confirmation_prompt(data_name="Railway Codes")
>>> print(prompt)
Proceed with collecting data of "Railway Codes"?
<BLANK_LINE>

>>> prompt = format_confirmation_prompt(data_name="location codes", initial="A")
>>> print(prompt)
Proceed with collecting data of "location codes" beginning with "A"?
<BLANK_LINE>