/
proc
/
self
/
root
/
lib
/
python3
/
dist-packages
/
certbot
/
_internal
/
display
/
__pycache__
/
Upload File
HOME
� E��cU � � � d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z e rdd l mZ ddlZn# e $ r ddlmc mc mZ Y nw xY w G d � d� � ZdS )z8Provides Tab completion when prompting users for a path.� N)� TracebackType)�Callable)�Iterator)�Optional)�Type)� TYPE_CHECKING)�Literalc � � e Zd ZdZdd�Zdededee fd�Zdd�Z d ee e d ee dee ddfd �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. �returnNc � � | | | d S )N� ��selfs �E/usr/lib/python3/dist-packages/certbot/_internal/display/completer.py�__init__zCompleter.__init__% s � ��!��4��"�"�"� �text�statec �p � |dk rt j |dz � � | _ t | j d� � 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)�glob�iglob�_iter�next)r r r s r �completezCompleter.complete* s4 � � �A�:�:���D�3�J�/�/�D�J��D�J��%�%�%r c �H � t j � � | _ t j � � | _ t j | j � � t j d� � t j �$dt j v rt j d� � d S t j d� � d S )Nz ;�libeditzbind ^I rl_completez tab: complete) �readline� get_completer�_original_completer�get_completer_delims�_original_delims� set_completerr �set_completer_delims�__doc__�parse_and_bindr s r � __enter__zCompleter.__enter__9 s� � �#+�#9�#;�#;�� � (� =� ?� ?�����t�}�-�-�-��%�h�/�/�/� ��'�I��9I�,I�,I��#�$9�:�:�:�:�:��#�O�4�4�4�4�4r �unused_type�unused_value�unused_tracebackzLiteral[False]c �j � t j | j � � t j | j � � dS )NF)r r% r# r$ r! )r r) r* r+ s r �__exit__zCompleter.__exit__G s1 � � �%�d�&;�<�<�<���t�7�8�8�8��ur )r N)�__name__� __module__�__qualname__r&