����JFIF��`�`�����Viewing File: /lib/python3.9/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-39.pyc
a

�&cl�@s^ddlmZddlmZddlmZddlmZddlZddlZ	ddl
Z
Gdd�dej�ZdS)�)�absolute_import)�unicode_literals)�ucd)�loggerNcs<eZdZdZ�fdd�Zedd��Zdd�Zdd	�Z�Z	S)
�BashCompletionCacheZgenerate_completion_cachecs"tt|��||�||_d|_dS)Nz/var/cache/dnf/packages.db)�superr�__init__�base�
cache_file)�selfr	Zcli��	__class__��I/usr/lib/python3.9/site-packages/dnf-plugins/generate_completion_cache.pyrszBashCompletionCache.__init__cCst�d|�dS)NzCompletion plugin: %s)r�debug)�msgrrr�_out$szBashCompletionCache._outc
Csd}|jj��D]}|jdur|jjrd}q0qtj�|j�rD|�rz�t	�
|j��r}|�d�|��}|�
d�|�
d�|�
d�|jj����}dd	�|D�}|�d
|�|��Wd�n1s�0YWn:t	j�y}z|�dt|��WYd}~n
d}~00dS)z& Generate cache of available packages FNT�Generating completion cache...z/create table if not exists available (pkg TEXT)zAcreate unique index if not exists pkg_available ON available(pkg)zdelete from availablecSs g|]}|jdkrt|�g�qS��src�Zarch�str��.0�xrrr�
<listcomp>@�z,BashCompletionCache.sack.<locals>.<listcomp>z*insert or ignore into available values (?)� Can't write completion cache: %s)r	ZreposZiter_enabled�metadata�fresh�os�path�existsr
�sqlite3�connectr�cursor�execute�sack�queryZ	available�executemany�commit�OperationalErrorr)rrZrepo�conn�curZ
avail_pkgsZavail_pkgs_insert�errrr'(s2
��
�*zBashCompletionCache.sackc
Cs�|js
dSz�t�|j��x}|�d�|��}|�d�|�d�|�d�tj�	|j
�����}dd�|D�}|�
d|�|��Wd�n1s�0YWn8tjy�}z|�d	t|��WYd}~n
d}~00dS)
z& Generate cache of installed packages Nrz/create table if not exists installed (pkg TEXT)zAcreate unique index if not exists pkg_installed ON installed(pkg)zdelete from installedcSs g|]}|jdkrt|�g�qSrrrrrrrVrz3BashCompletionCache.transaction.<locals>.<listcomp>z*insert or ignore into installed values (?)r)�transactionr#r$r
rr%r&�dnfr'Z_rpmdb_sackr	r(Z	installedr)r*r+r)rr,r-Z	inst_pkgsZinst_pkgs_insertr.rrrr/Gs&

�
�*zBashCompletionCache.transaction)
�__name__�
__module__�__qualname__�namer�staticmethodrr'r/�
__classcell__rrrrrs
r)
Z
__future__rrZdnf.i18nrZdnfpluginscorerr0Zos.pathr r#ZPluginrrrrr�<module>s
Back to Directory �������}�!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������������� ������w�!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz������������������������������������������������������������������������ ��?��_��+��?��(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(�����