File: //lib/python3.6/site-packages/certbot/_internal/display/__pycache__/completer.cpython-36.pyc
3
گaU
� @ s� d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z e rddd l
mZ yddlZW n" e
k
r� ddljjjZY nX G d
d� d�ZdS )z8Provides Tab completion when prompting users for a path.� N)�
TracebackType)�Callable)�Iterator)�Optional)�Type)�
TYPE_CHECKING)�Literalc @ sf e Zd ZdZdd�dd�Zeeee d�dd�Zdd�d d
�Z ee
e ee ee dd�d
d�Z
dS )� 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.
N)�returnc C s | | | d S )N� )�selfr r �/usr/lib/python3.6/completer.py�__init__% s zCompleter.__init__)�text�stater
c C s$ |dkrt j|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)�globZiglobZ_iter�next)r r r r r r
�complete* s zCompleter.completec C sX t j� | _t j� | _t j| j� t jd� t jd k rJdt jkrJt j d� n
t j d� d S )Nz
;�libeditzbind ^I rl_completez
tab: complete)
�readlineZ
get_completer�_original_completerZget_completer_delims�_original_delims�
set_completerr �set_completer_delims�__doc__�parse_and_bind)r r r r
� __enter__9 s
zCompleter.__enter__zLiteral[False])�unused_type�unused_value�unused_tracebackr
c C s t j| j� t j| j� dS )NF)r r r r r )r r r r r r r
�__exit__G s zCompleter.__exit__)�__name__�
__module__�__qualname__r r �str�intr r r r �
BaseExceptionr r! r r r r
r s
r )r r �typesr Ztypingr r r r r Ztyping_extensionsr r �ImportErrorZ(certbot._internal.display.dummy_readlineZ _internalZdisplayZdummy_readliner r r r r
�<module> s