← Back
Editing: completer.cpython-38.pyc
U �]t � @ sT d Z ddlZzddlZW n& ek r> ddlm mZ Y nX G dd� de�ZdS )z8Provides Tab completion when prompting users for a path.� Nc @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd S )� Completera/ Provides Tab completion when prompting users for a path. This class is meant to be used with readline to provide Tab completion for users entering paths. The complete method can be passed to readline.set_completer directly, however, this function works best as a context manager. For example: with Completer(): raw_input() In this example, Tab completion will be available during the call to raw_input above, however, readline will be restored to its previous state when exiting the body of the with statement. c C s d | _ | _| _d S �N)�_iter�_original_completer�_original_delims��self� r �;/usr/lib/python3/dist-packages/certbot/display/completer.py�__init__ s zCompleter.__init__c C s$ |dkrt �|d �| _t| jd�S )a( Provides path completion for use with readline. :param str text: text to offer completions for :param int state: which completion to return :returns: possible completion for text or ``None`` if all completions have been returned :rtype: str r �*N)�globZiglobr �next)r �text�stater r r �complete s zCompleter.completec C sX t �� | _t �� | _t �| j� t �d� t jd k rJdt jkrJt � d� n t � d� d S )Nz ;�libeditzbind ^I rl_completez tab: complete) �readlineZ get_completerr Zget_completer_delimsr � set_completerr �set_completer_delims�__doc__�parse_and_bindr r r r � __enter__- s zCompleter.__enter__c C s t �| j� t �| j� d S r )r r r r r )r Zunused_typeZunused_valueZunused_tracebackr r r �__exit__; s zCompleter.__exit__N)�__name__� __module__�__qualname__r r r r r r r r r r s r ) r r r �ImportErrorZcertbot.display.dummy_readlineZdisplayZdummy_readline�objectr r r r r �<module> s
Save File
Cancel