MCPcopy
hub / github.com/pallets/werkzeug / ensure_echo_on

Function ensure_echo_on

src/werkzeug/_reloader.py:417–433  ·  view source on GitHub ↗

Ensure that echo mode is enabled. Some tools such as PDB disable it which causes usability issues after a reload.

()

Source from the content-addressed store, hash-verified

415
416
417def ensure_echo_on() -> None:
418 """Ensure that echo mode is enabled. Some tools such as PDB disable
419 it which causes usability issues after a reload."""
420 # tcgetattr will fail if stdin isn't a tty
421 if sys.stdin is None or not sys.stdin.isatty():
422 return
423
424 try:
425 import termios
426 except ImportError:
427 return
428
429 attributes = termios.tcgetattr(sys.stdin)
430
431 if not attributes[3] & termios.ECHO:
432 attributes[3] |= termios.ECHO
433 termios.tcsetattr(sys.stdin, termios.TCSANOW, attributes)
434
435
436def run_with_reloader(

Callers 1

run_with_reloaderFunction · 0.85

Calls 1

isattyMethod · 0.45

Tested by

no test coverage detected