Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/prompt_toolkit/__pycache__/history.cpython-39.pyc
Ðазад
a d�h�$ � @ s� d Z ddlmZ ddlZddlZddlZddlmZmZ ddl m Z ddlmZm Z mZmZ g d�ZG dd � d ed �ZG dd� de�ZG d d� de�ZG dd� de�Zeeeddf ZG dd� de�ZdS )aW Implementations for the history of a `Buffer`. NOTE: There is no `DynamicHistory`: This doesn't work well, because the `Buffer` needs to be able to attach an event handler to the event when a history entry is loaded. This loading can be done asynchronously and making the history swappable would probably break this. � )�annotationsN)�ABCMeta�abstractmethod)�get_running_loop)�AsyncGenerator�Iterable�Sequence�Union)�History�ThreadedHistory�DummyHistory�FileHistory�InMemoryHistoryc @ sp e Zd ZdZdd�dd�Zdd�dd�Zd d�d d�Zddd �dd�Zedd�dd��Z eddd �dd��Z dS )r zg Base ``History`` class. This also includes abstract methods for loading/storing history. �None��returnc C s d| _ g | _d S )NF)�_loaded�_loaded_strings��self� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/prompt_toolkit/history.py�__init__$ s zHistory.__init__�AsyncGenerator[str, None]c C s0 | j st| �� �| _d| _ | jD ] }|V q dS )a� Load the history and yield all the entries in reverse order (latest, most recent history entry first). This method can be called multiple times from the `Buffer` to repopulate the history when prompting for a new input. So we are responsible here for both caching, and making sure that strings that were were appended to the history will be incorporated next time this method is called. TN)r �list�load_history_stringsr )r �itemr r r �load0 s zHistory.loadz list[str]c C s | j ddd� S )zq Get the strings from the history that are loaded so far. (In order. Oldest item first.) N���)r r r r r �get_stringsB s zHistory.get_strings�str��stringr c C s | j �d|� | �|� dS )zAdd string to the history.r N)r �insert�store_string�r r"