Package qanda
[hide private]
[frames] | no frames]

Source Code for Package qanda

 1  """ 
 2  Simple text prompts and validation for user input. 
 3   
 4  Interactive command-line programs need to query users for information, be it 
 5  text, choices from a list, or simple yes-no answers. *qanda* is a library of 
 6  simple functions to prompt users for such information, with validation and 
 7  cleanup of answers, allowing default answers, consistent formatting and 
 8  presentation. 
 9   
10  For example:: 
11   
12          from qanda import prompt 
13          prompt.string ("What is your name") 
14   
15  will give:: 
16   
17          What is your name: 
18   
19  While this code:: 
20   
21          fname = prompt.string ("Your friends name is", 
22                  help="I need to know your friends name as well before I talk to you.", 
23                  hints="first name", 
24                  default='Bar', 
25          ) 
26   
27  will show:: 
28   
29          I need to know your friends name as well before I talk to you. 
30          Your friends name is (first name) [Bar]: 
31   
32  and will capture the returned name or ``Bar`` if nothing is entered. 
33   
34  """ 
35   
36  __version__ = "0.1" 
37  __author__ = "Paul-Michael Agapow" 
38  __email__ = "pma@agapow.net" 
39   
40   
41  ### IMPORTS 
42   
43  from session import * 
44   
45   
46  ### CONSTANTS & DEFINES 
47   
48  ### IMPLEMENTATION ### 
49   
50  ### END ####################################################################### 
51