MCPcopy Index your code
hub / github.com/python/cpython / readline

Method readline

Lib/getpass.py:384–409  ·  view source on GitHub ↗

Read a line of password input with echo character support.

(self, input)

Source from the content-addressed store, hash-verified

382 return False
383
384 def readline(self, input):
385 """Read a line of password input with echo character support."""
386 while True:
387 assert self.cursor_pos >= 0
388 char = input.read(1)
389 if self.is_eol(char):
390 break
391 # Handle literal next mode first as Ctrl+V quotes characters.
392 elif self.literal_next:
393 self.insert_char(char)
394 self.literal_next = False
395 # Handle EOF now as Ctrl+D must be pressed twice
396 # consecutively to stop reading from the input.
397 elif self.is_eof(char):
398 if self.eof_pressed:
399 break
400 elif self.handle(char):
401 # Dispatched to handler.
402 pass
403 else:
404 # Insert as normal character.
405 self.insert_char(char)
406
407 self.eof_pressed = self.is_eof(char)
408
409 return ''.join(self.password)
410
411
412def getuser():

Callers 2

_raw_inputFunction · 0.45
_readline_with_echo_charFunction · 0.45

Calls 6

is_eolMethod · 0.95
insert_charMethod · 0.95
is_eofMethod · 0.95
handleMethod · 0.95
readMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected