"Jd4dZddlZddlmZddlmZmZddlmZddl m Z ddl m Z ddl mZmZdd lmZd e d efd Zed edfd ZGddeZdS)zHTTP cache implementation. N)contextmanager)IteratorOptional) BaseCache) FileCache)Response)adjacent_tmp_filereplace) ensure_dirresponsereturnc$t|ddS)N from_cacheF)getattr)r s N/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/network/cache.py is_from_cachers 8\5 1 11c#6K dVdS#t$rYdSwxYw)zvIf we can't access the cache then we can just skip caching and process requests as if caching wasn't enabled. N)OSErrorrrsuppressed_cache_errorsrs:         s  c|eZdZdZdeddffd ZdedefdZdedeefd Z ded eddfd Z deddfd Z xZ S) SafeFileCachezw A file based cache which is safe to use even when the target directory may not be accessible or writable. directoryr Ncn| Jdt||_dS)Nz!Cache directory must not be None.)super__init__r)selfr __class__s rrzSafeFileCache.__init__%s9$$&I$$$ "rnamectj|}t|dd|gz}tjj|jg|RS)N)rencodelistospathjoinr)rr hashedpartss r_get_cache_pathzSafeFileCache._get_cache_path*sL!$''VBQBZ  F8+w|DN3U3333rkeyc||}t5t|d5}|cdddcdddS#1swxYwY ddddS#1swxYwYdS)Nrb)r*ropenread)rr+r&fs rgetzSafeFileCache.get2s##C(( $ & &  dD!! Qvvxx                                          s4A;A" A;"A& &A;)A& *A;;A?A?valuecx||}t5ttj|t |5}||dddn #1swxYwYt|j |ddddS#1swxYwYdSN) r*rr r%r&dirnamer writer r )rr+r2r&r0s rsetzSafeFileCache.set8s$##C(( $ & & " " rwt,, - - -"4(( A                AFD ! ! !  " " " " " " " " " " " " " " " " " "s5r% contextlibrtypingrrpip._vendor.cachecontrol.cacherpip._vendor.cachecontrol.cachesrpip._vendor.requests.modelsrpip._internal.utils.filesystemr r pip._internal.utils.miscr boolrrrrrrrJs% %%%%%%%%%%%%%%444444555555000000EEEEEEEE//////2H22222 $    &&&&&I&&&&&r