21 Function to get the username from the environment or password database. |
21 Function to get the username from the environment or password database. |
22 |
22 |
23 First try various environment variables, then the password |
23 First try various environment variables, then the password |
24 database. This works on Windows as long as USERNAME is set. |
24 database. This works on Windows as long as USERNAME is set. |
25 |
25 |
26 @return username (string) |
26 @return username |
|
27 @rtype str |
27 """ |
28 """ |
28 # this is copied from the oroginal getpass.py |
29 # this is copied from the oroginal getpass.py |
29 |
30 |
30 import os |
31 import os |
31 |
32 |
41 |
42 |
42 def getpass(prompt='Password: '): |
43 def getpass(prompt='Password: '): |
43 """ |
44 """ |
44 Function to prompt for a password, with echo turned off. |
45 Function to prompt for a password, with echo turned off. |
45 |
46 |
46 @param prompt Prompt to be shown to the user (string) |
47 @param prompt Prompt to be shown to the user |
47 @return Password entered by the user (string) |
48 @type str |
|
49 @return Password entered by the user |
|
50 @rtype str |
48 """ |
51 """ |
49 return input(prompt, False) |
52 return input(prompt, False) |
50 |
53 |
51 |
54 |
52 unix_getpass = getpass |
55 unix_getpass = getpass |
53 win_getpass = getpass |
56 win_getpass = getpass |
54 default_getpass = getpass |
57 default_getpass = getpass |
|
58 fallback_getpass = getpass |
55 |
59 |
56 # |
60 # |
57 # eflag: noqa = M702 |
61 # eflag: noqa = M702 |