관리-도구
편집 파일: persistor.cpython-39.pyc
a �����!cV����������������������@���s����d�dl�mZ�d�dl�mZ�d�dlmZ�d�dlZd�dlZd�dlZd�dl Z d�dl Z d�dlZd�dlZe � d�ZG�dd��de�ZG�dd ��d e�ZG�d d��de�ZdS�)�����)�absolute_import)�unicode_literals)�_N�dnfc�������������������@���s,���e�Zd�Zdd��Zg�fdd�Zedd���ZdS�)�JSONDBc�����������������C���s0���t�j�|�s,tj�t�j�|���|��|g���d�S��N)�os�path�isfiler����utilZ ensure_dir�dirname�_write_json_db)�self� json_path��r����1/usr/lib/python3.9/site-packages/dnf/persistor.py�_check_json_db*���s����zJSONDB._check_json_dbc�������������� ���C���s����t�|d��}|���}W�d�����n1�s(0����Y��|dkrXt�td�|��|��||��n>zt�|�}W�n.�ty��}�zt�|��W�Y�d�}~n d�}~0�0�|S�)N�r��z%s is empty file) �open�read�logger�warningr���r ����json�loads� ValueError)r���r����default�f�content�er���r���r����_get_json_db0���s����& zJSONDB._get_json_dbc�����������������C���s:���t�|�d��}t�||��W�d�����n1�s,0����Y��d�S�)N�w)r���r����dump)r���r���r���r���r���r���r ���>���s����zJSONDB._write_json_dbN)�__name__� __module__�__qualname__r���r ����staticmethodr ���r���r���r���r���r���(���s���r���c�������������������@���s<���e�Zd�ZdZdd��Zedd���Zdd��Zdd ��Zd d��Z dS�) � RepoPersistorzePersistent data kept for repositories. Is arch/releasever specific and stores to cachedir. c�����������������C���s*���||�_�tj�|�j�d�|�_t��|�_d|�_d�S�)Nzexpired_repos.jsonF)�cachedirr���r ����join�db_path�set�expired_to_add�reset_last_makecache�r���r(���r���r���r����__init__K���s����zRepoPersistor.__init__c�����������������C���s���t�j�|�jd�S�)NZlast_makecache)r���r ���r)���r(����r���r���r���r����_last_makecache_pathQ���s����z"RepoPersistor._last_makecache_pathc�������������� ���C���sZ���z|���|�j��t|��|�j��W�S��tyT�}�zt�td�|��W�Y�d�}~d�S�d�}~0�0�d�S�)Nz&Failed to load expired repos cache: %s)r���r*���r+���r ����OSErrorr���r���r����r���r���r���r���r����get_expired_reposU���s����zRepoPersistor.get_expired_reposc�������������� ���C���s����z$|���|�j��|��|�jt|�j���W�n6�tyZ�}�zt�td�|��W�Y�d�}~dS�d�}~0�0�|�j r�zt j�|�j ��W�dS��ty����t�td���Y�dS�0�d�S�)Nz'Failed to store expired repos cache: %sFTz#Failed storing last makecache time.)r���r*���r ����listr,���r2���r���r���r���r-���r���r����touchr1����IOErrorr3���r���r���r����save]���s����zRepoPersistor.savec�����������������C���s<���zt�tj�|�j��W�S��ty6���t�td���Y�d�S�0�d�S�)Nz'Failed determining last makecache time.) �intr���r���Zfile_ager1���r2���r���r���r���r0���r���r���r����since_last_makecachel���s ����z"RepoPersistor.since_last_makecacheN) r#���r$���r%����__doc__r/����propertyr1���r4���r8���r:���r���r���r���r���r'���D���s��� r'���c�������������������@���s,���e�Zd�Zdd��Zdd��Zdd��Zdd��Zd S�) �TempfilePersistorc�����������������C���s"���t�j�|d�|�_t��|�_d|�_d�S�)Nztempfiles.jsonF)r���r ���r)���r*���r+����tempfiles_to_add�_emptyr.���r���r���r���r/���v���s����zTempfilePersistor.__init__c�����������������C���s���|���|�j��|��|�j�S�r���)r���r*���r ���r0���r���r���r����get_saved_tempfiles{���s����z%TempfilePersistor.get_saved_tempfilesc�����������������C���sl���|�j�s|�jsd�S�|��|�j��|�j�r4|��|�jg���d�S�|�jrht|��|�j��}|�|�j��|��|�jt|���d�S�r���) r?���r>���r���r*���r ���r+���r ����updater5���)r����datar���r���r���r8������s����zTempfilePersistor.savec�����������������C���s ���d|�_�d�S�)NT)r?���r0���r���r���r����empty����s����zTempfilePersistor.emptyN)r#���r$���r%���r/���r@���r8���rC���r���r���r���r���r=���t���s���r=���)Z __future__r���r���Zdnf.i18nr���Zdnf.utilr����errno�fnmatchr���Zloggingr����reZ getLoggerr����objectr���r'���r=���r���r���r���r����<module>���s��� 0