Abstraction for interacting with the user.
Applications can choose different types of UI, and they deal with displaying messages or progress to the user, and with gathering different types of input.
Several levels are supported, and you can also register new factories such as for a GUI.
Function | bool_from_string | Returns a boolean if the string can be interpreted as such. |
Class | ConfirmationUserInterfacePolicy | Wrapper for a UIFactory that allows or denies all confirmed actions. |
Class | UIFactory | UI abstraction. |
Class | NoninteractiveUIFactory | Base class for UIs with no user. |
Class | SilentUIFactory | A UI Factory which never prints anything. |
Class | CannedInputUIFactory | A silent UI that return canned input. |
Function | make_ui_for_terminal | Construct and return a suitable UIFactory for a text mode program. |
Class | NullProgressView | Soak up and ignore progress information. |
Class | NullOutputStream | Acts like a file, but discard all output. |
Interpret case insensitive strings as booleans. The default values includes: 'yes', 'no, 'y', 'n', 'true', 'false', '0', '1', 'on', 'off'. Alternative values can be provided with the 'accepted_values' parameter.
Parameters | s | A string that should be interpreted as a boolean. It should be of type string or unicode. |
accepted_values | An optional dict with accepted strings as keys and True/False as values. The strings will be tested against a lowered version of 's'. | |
Returns | True or False for accepted strings, None otherwise. |