The ama
Module¶
Base Asker class
Asker¶
-
class
ama.
Asker
(ds=None, json_string=None)¶ An object which mediates the question asking.
Parameters: - ds (Any object with a read metod) – A datastream to read the questions from
- json_string (str) – A JSON formatted string to load the questions from
-
ask
(questions=None, initial_answers=None, all_questions=True)¶ Ask the questions and return the answers
Parameters: - questions (string or dict) – The questions to prompt for answers. Can either be a json formatted string or a dict subclass
- initial_answers (dict) – A dictionary containing the already answered questions
- all_questions (bool) – If True only the already unanswered questions will be asked; if False all questions will be asked.
- validators (dict) – A dictionary of custom validator functions
Returns: The answers
Return type: OrderedDict
-
add_question
(key, question)¶ Overridden by subclasses to add a question to the list to ask. Called by the
ask()
method
-
run
()¶ Overridden by subclasses to ask the questions. Subclasses should return a dictionary of the answers