/usr/share/netplan/netplan/__pycache__
NameSizeModeActions
configmanager.cpython-38.pyc92550644editdlrm
libnetplan.cpython-38.pyc92210644editdlrm
terminal.cpython-38.pyc40580644editdlrm
_features.cpython-38.pyc3760644editdlrm
__init__.cpython-38.pyc1940644editdlrm
Edit: /usr/share/netplan/netplan/__pycache__/terminal.cpython-38.pyc (4058B)
U ø)/b»ã@s`dZddlZddlZddlZddlZddlZGdd„deƒZGdd„deƒZ Gdd„deƒZ dS) z Terminal / input handling éNc@sVeZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zddd„Z ddd„Z ddd„Z d S)ÚTerminalz@ Do minimal terminal mangling to prompt users for input cCs||_d|_d|_| ¡dS©N)ÚfdÚ orig_flagsÚ orig_termÚsave)Úselfr©r ú&/usr/share/netplan/netplan/terminal.pyÚ__init__"szTerminal.__init__cCsPtj ¡rLt |j¡}|dtjB|d<|dtjB|d<t |jtj |¡dS©Né© ÚsysÚstdinÚisattyÚtermiosÚ tcgetattrrZICANONZECHOÚ tcsetattrZTCSANOW©rÚattrsr r r Ú enable_echo(s   zTerminal.enable_echocCsTtj ¡rPt |j¡}|dtj@|d<|dtj@|d<t |jtj |¡dSr rrr r r Ú disable_echo/s   zTerminal.disable_echocCs,t |jtj¡}t |jtj|tjB¡dSr©ÚfcntlrÚF_GETFLÚF_SETFLÚosÚ O_NONBLOCK©rÚflagsr r r Úenable_nonblocking_io6szTerminal.enable_nonblocking_iocCs.t |jtj¡}t |jtj|tj@¡dSrrrr r r Údisable_nonblocking_io:szTerminal.disable_nonblocking_ioéxNcCsÔtdƒtƒ}| |¡| ¡| ¡|s0d}td |¡ƒ|}|dkrÀtd |tt|ƒƒ¡ddt t j gggd¡z&t j   ¡}|d krž|  |¡t ƒ‚Wntk r´YnX|d8}qB|  |¡tƒ‚d S) a Get a "confirmation" input from the user, for at most (timeout) seconds. Optionally, customize the message to be displayed. timeout -- timeout to wait for input (default 120) message -- optional customized message ("Press ENTER to (message)") raises: InputAccepted -- the user confirmed the changes InputRejected -- the user rejected the changes z%Do you want to keep these settings? zaccept the new configurationz&Press ENTER before the timeout to {} rz%Changes will revert in {:>{}} secondsú )ÚendéÚ N)ÚprintÚdictrrr!ÚformatÚlenÚstrÚselectrrÚreadÚresetÚ InputAcceptedÚ TypeErrorÚ InputRejected)rÚtimeoutÚmessageÚsettingsZ timeout_nowÚcr r r Úget_confirmation_input>s,       zTerminal.get_confirmation_inputcCsTt |jtj¡}d}tj ¡r*t |j¡}|dk rD| ||dœ¡n ||_ ||_ dS)z• Save the terminal's current attributes and flags Optional argument: - dest: if set, save settings to this dict N)r Úterm) rrrrrrrrÚupdaterr)rÚdestrrr r r rps  ÿ z Terminal.savecCsdd}d}|dk r&| d¡}| d¡}n |j}|j}tj ¡rNt |jtj |¡t   |jt j |¡dS)z¢ Reset the terminal to its original attributes and flags Optional argument: - orig: if set, reset to settings from this dict Nr8r ) ÚgetrrrrrrrrZ TCSAFLUSHrr)rÚorigrrr r r r/‚s   zTerminal.reset)r#N)N)N) Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrr!r"r7rr/r r r r rs 2 rc@seZdZdZdS)r0z Denotes has accepted inputN©r=r>r?r@r r r r r0–sr0c@seZdZdZdS)r2z) Denotes that the user has rejected inputNrAr r r r r2›sr2) r@rrrr-rÚobjectrÚ Exceptionr0r2r r r r Úsy