관리-도구
편집 파일: file_cache.cpython-311.pyc
� �܋f � �� � d dl mZ d dlZd dlZd dlmZ d dlmZmZm Z d dl mZ d dlm Z mZ d dlmZ erd dlmZ d d lmZ dd�Z G d� d� � Z G d� dee � � Z G d� dee� � Zdd�ZdS )� )�annotationsN)�dedent)�IO� TYPE_CHECKING�Union)�Path)� BaseCache�SeparateBodyBaseCache)�CacheController)�datetime)�BaseFileLock�filename�str�fmode�int�return� IO[bytes]c � � t j }|t j t j z z }t t d� � r|t j z }t t d� � r|t j z } t j | � � n# t $ r Y nw xY wt j | ||� � } t j |d� � S # t j |� � � xY w)N� O_NOFOLLOW�O_BINARY�wb)�os�O_WRONLY�O_CREAT�O_EXCL�hasattrr r �remove�OSError�open�fdopen�close)r r �flags�fds �a/opt/cloudlinux/venv/lib64/python3.11/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py�_secure_open_writer% s� � ��K�E� �R�Z�"�)� #�#�E� �r�<� � � � ����� �r�:��� � ����� � � �(������� � � ��� ���� ���5�%� (� (�B���y��T�"�"�"��� ������ ���s �2B � B�B�.C �Cc �h � e Zd ZdZ d$d%d�Zed&d�� � Zd'd�Zd(d�Z d)d*d�Z d+d!�Z d,d#�ZdS )-�_FileCacheMixinz2Shared implementation for both FileCache variants.F� � N� directory� str | Path�forever�bool�filemoder �dirmode� lock_class�type[BaseFileLock] | Noner �Nonec � � |�ddl m} |}n,# t $ r t d� � }t |� � �w xY w|| _ || _ || _ || _ || _ d S )Nr )�FileLockz� NOTE: In order to use the FileCache you must have filelock installed. You can install it via pip: pip install cachecontrol[filecache] ) �filelockr4 �ImportErrorr r* r, r. r/ r0 )�selfr* r, r. r/ r0 r4 �notices r$ �__init__z_FileCacheMixin.__init__A s� � � &��!�-�-�-�-�-�-�%� ���� &� &� &���� �F� �f�%�%�%� &���� #������ �� ����$����s � �)6�xr c �r � t j | � � � � � � � � S �N)�hashlib�sha224�encode� hexdigest)r: s r$ r? z_FileCacheMixin.encode^ s&