DebugClients/Python3/getpass.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1509
c0b5e693b0eb
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
12 This module is a replacement for the one found in the Python distribution. It 12 This module is a replacement for the one found in the Python distribution. It
13 is to provide a debugger compatible variant of the a.m. functions. 13 is to provide a debugger compatible variant of the a.m. functions.
14 """ 14 """
15 15
16 __all__ = ["getpass", "getuser"] 16 __all__ = ["getpass", "getuser"]
17
17 18
18 def getuser(): 19 def getuser():
19 """ 20 """
20 Function to get the username from the environment or password database. 21 Function to get the username from the environment or password database.
21 22
35 36
36 # If this fails, the exception will "explain" why 37 # If this fails, the exception will "explain" why
37 import pwd 38 import pwd
38 return pwd.getpwuid(os.getuid())[0] 39 return pwd.getpwuid(os.getuid())[0]
39 40
40 def getpass(prompt = 'Password: '): 41
42 def getpass(prompt='Password: '):
41 """ 43 """
42 Function to prompt for a password, with echo turned off. 44 Function to prompt for a password, with echo turned off.
43 45
44 @param prompt Prompt to be shown to the user (string) 46 @param prompt Prompt to be shown to the user (string)
45 @return Password entered by the user (string) 47 @return Password entered by the user (string)

eric ide

mercurial