Input helper module

class rebasehelper.helpers.input_helper.InputHelper[source]

Class for command line interaction with the user.

classmethod get_message(message, default_yes=True, any_input=False)[source]

Prompts a user with yes/no message and gets the response.

Parameters:
  • message (str) – Prompt string.
  • default_yes (bool) – If the default value should be YES.
  • any_input (bool) – Whether to return default value regardless of input.
Returns:

True or False, based on user’s input.

Return type:

bool

static strtobool(message)[source]

Converts a user message to a corresponding truth value.

This method is a replacement for deprecated strtobool from distutils, its behaviour remains the same.

Parameters:message (str) – Message to evaluate.
Returns:
True on ‘y’, ‘yes’, ‘t’, ‘true’, ‘on’ and ‘1’.
False on ‘n’, ‘no’, ‘f’, ‘false’, ‘off’ and ‘0’.
Return type:bool
Raises:ValueError – On any other value.