MCPcopy Index your code
hub / github.com/RustPython/RustPython / _readline_with_echo_char

Function _readline_with_echo_char

Lib/getpass.py:189–215  ·  view source on GitHub ↗
(stream, input, echo_char)

Source from the content-addressed store, hash-verified

187
188
189def _readline_with_echo_char(stream, input, echo_char):
190 passwd = ""
191 eof_pressed = False
192 while True:
193 char = input.read(1)
194 if char == '\n' or char == '\r':
195 break
196 elif char == '\x03':
197 raise KeyboardInterrupt
198 elif char == '\x7f' or char == '\b':
199 if passwd:
200 stream.write("\b \b")
201 stream.flush()
202 passwd = passwd[:-1]
203 elif char == '\x04':
204 if eof_pressed:
205 break
206 else:
207 eof_pressed = True
208 elif char == '\x00':
209 continue
210 else:
211 passwd += char
212 stream.write(echo_char)
213 stream.flush()
214 eof_pressed = False
215 return passwd
216
217
218def getuser():

Callers 1

_raw_inputFunction · 0.85

Calls 3

readMethod · 0.45
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected