관리-도구
편집 파일: file_cache.cpython-38.pyc
U &?�f � @ s� d dl mZ d dlZd dlZd dlmZ d dlmZmZm Z d dl mZ d dlm Z mZ d dlmZ er�d dlmZ d d lmZ d ddd �dd�ZG dd� d�ZG dd� dee �ZG dd� dee�Zd dd d�dd�ZdS )� )�annotationsN)�dedent)�IO� TYPE_CHECKING�Union)�Path)� BaseCache�SeparateBodyBaseCache)�CacheController)�datetime)�BaseFileLock�str�intz IO[bytes])�filename�fmode�returnc C s� t j}|t jt jB O }tt d�r*|t jO }tt d�r>|t jO }zt �| � W n tk r` Y nX t � | ||�}zt � |d�W S t �|� � Y nX d S )N� O_NOFOLLOW�O_BINARY�wb)�os�O_WRONLY�O_CREAT�O_EXCL�hasattrr r �remove�OSError�open�fdopen�close)r r �flags�fd� r! �X/opt/hc_python/lib/python3.8/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py�_secure_open_write s r# c @ s� e Zd ZdZd$ddddd d d�dd �Zeddd�dd��Zddd�dd�Zddd�dd�Zd%dddd d�dd�Z ddd d�dd �Z ddd d!�d"d#�ZdS )&�_FileCacheMixinz2Shared implementation for both FileCache variants.F� � Nz str | Path�boolr ztype[BaseFileLock] | None�None)� directory�forever�filemode�dirmode� lock_classr c C sd z|d krddl m} |}W n$ tk r@ td�}t|��Y nX || _|| _|| _|| _|| _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] ) �filelockr. �ImportErrorr r) r* r+ r, r- )�selfr) r* r+ r, r- r. �noticer! r! r"