OwlCyberSecurity - MANAGER
Edit File: generate_completion_cache.cpython-36.pyc
3 �gt`l������������������@���s^���d�dl�mZ�d�dl�mZ�d�dlmZ�d�dlmZ�d�dlZd�dlZ d�dl Z G�dd��dej�ZdS�)�����)�absolute_import)�unicode_literals)�ucd)�loggerNc�������������������s<���e�Zd�ZdZ��fdd�Zedd���Zdd��Zdd ��Z���Z S�) �BashCompletionCacheZgenerate_completion_cachec����������������s"���t�t|��j||��||�_d|�_d�S�)Nz/var/cache/dnf/packages.db)�superr����__init__�base� cache_file)�selfr ���Zcli)� __class__���//usr/lib/python3.6/generate_completion_cache.pyr������s����zBashCompletionCache.__init__c�������������C���s���t�jd|���d�S�)NzCompletion plugin: %s)r����debug)�msgr ���r ���r����_out$���s����zBashCompletionCache._outc�������������C���s���d}x,|�j�jj��D�]}|jdk r|jjrd}P�qW�tjj|�j��sF|r�y~t j |�j��h}|�jd��|j��}|j d��|j d��|j d��|�j�jj��j��}dd ��|D��}|jd |��|j���W�dQ�R�X�W�n6�t jk r��}�z|�jdt|����W�Y�dd}~X�nX�dS�)z& Generate cache of available packages FNTzGenerating completion cache...z/create table if not exists available (pkg TEXT)zAcreate unique index if not exists pkg_available ON available(pkg)zdelete from availablec�������������S���s ���g�|�]}|j�d�krt|�g�qS�)�src)�arch�str)�.0�xr ���r ���r���� <listcomp>@���s����z,BashCompletionCache.sack.<locals>.<listcomp>z*insert or ignore into available values (?)z Can't write completion cache: %s)r ���ZreposZiter_enabledZmetadata�fresh�os�path�existsr ����sqlite3�connectr����cursor�execute�sack�queryZ available�executemany�commit�OperationalErrorr���)r���r���Zrepo�conn�curZ avail_pkgsZavail_pkgs_insert�er ���r ���r���r ���(���s,���� zBashCompletionCache.sackc�������������C���s����|�j�s dS�y�tj|�j��n}|�jd��|j��}|jd��|jd��|jd��tjj |�j �j��j��}dd��|D��}|j d|��|j���W�dQ�R�X�W�n6�tjk r��}�z|�jd t|����W�Y�dd}~X�nX�dS�) z& Generate cache of installed packages NzGenerating completion cache...z/create table if not exists installed (pkg TEXT)zAcreate unique index if not exists pkg_installed ON installed(pkg)zdelete from installedc�������������S���s ���g�|�]}|j�d�krt|�g�qS�)r���)r���r���)r���r���r ���r ���r���r���V���s����z3BashCompletionCache.transaction.<locals>.<listcomp>z*insert or ignore into installed values (?)z Can't write completion cache: %s)�transactionr���r���r ���r���r���r����dnfr ���Z_rpmdb_sackr ���r!���Z installedr"���r#���r$���r���)r���r%���r&���Z inst_pkgsZinst_pkgs_insertr'���r ���r ���r���r(���G���s"���� zBashCompletionCache.transaction) �__name__� __module__�__qualname__�namer����staticmethodr���r ���r(���� __classcell__r ���r ���)r���r���r������s ���r���) Z __future__r���r���Zdnf.i18nr���Zdnfpluginscorer���r)���Zos.pathr���r���ZPluginr���r ���r ���r ���r����<module>���s���