zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
U
H=®d,ã@s²ddlmZddlZddlZddlZddlmmmZddl    m
Z
ddl m Z m Z ddlmZmZddlmZer”ddlmZddlmZmZe e¡ZGd    d
„d
e
ƒZdS) é)Úabsolute_importN)ÚCommand)ÚERRORÚSUCCESS)Ú CommandErrorÚPipError)ÚMYPY_CHECK_RUNNING)ÚValues)ÚAnyÚListc@sXeZdZdZdZdZdd„Zdd„Zdd    „Zd
d „Z    d d „Z
dd„Z dd„Z dd„Z dS)Ú CacheCommandaw
    Inspect and manage pip's wheel cache.
 
    Subcommands:
 
    - dir: Show the cache directory.
    - info: Show information about the cache.
    - list: List filenames of packages stored in the cache.
    - remove: Remove one or more package from the cache.
    - purge: Remove all items from the cache.
 
    ``<pattern>`` can be a glob expression or a package name.
    Tz|
        %prog dir
        %prog info
        %prog list [<pattern>]
        %prog remove <pattern>
        %prog purge
    c
Csº|j|j|j|j|jdœ}|js.t d¡tS|r>|d|krXt dd     t
|ƒ¡¡tS|d}z||||dd…ƒWn:t k
r´}zt |j d¡tWY¢Sd}~XYnXt S)N)ÚdirÚinfoÚlistÚremoveÚpurgez<pip cache commands can not function since cache is disabled.rzNeed an action (%s) to perform.z, é)Ú get_cache_dirÚget_cache_infoÚlist_cache_itemsÚremove_cache_itemsÚ purge_cacheÚ    cache_dirÚloggerÚerrorrÚjoinÚsortedrÚargsr)ÚselfÚoptionsrÚhandlersÚactionÚe©r#úSD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_internal/commands/cache.pyÚrun-s,û
 þzCacheCommand.runcCs|r tdƒ‚t |j¡dS)NúToo many arguments)rrrr©rrrr#r#r$rOszCacheCommand.get_cache_dircCsX|r tdƒ‚t| |d¡ƒ}| |¡}t |¡}t d¡j|||d     ¡}t
  |¡dS)Nr&Ú*zq
            Location: {location}
            Size: {size}
            Number of wheels: {package_count}
        )ÚlocationZ package_countÚsize) rÚlenÚ _find_wheelsÚ_wheels_cache_dirÚ
filesystemÚformat_directory_sizeÚtextwrapÚdedentÚformatÚstriprr)rrrZ num_packagesZcache_locationZ
cache_sizeÚmessager#r#r$rVs
 
 
ù
 
zCacheCommand.get_cache_infoc    Csœt|ƒdkrtdƒ‚|r"|d}nd}| ||¡}|sDt d¡dSg}|D],}tj |¡}t     |¡}| 
d  ||¡¡qLt d¡t d  t |ƒ¡¡dS)    Nrr&rr(zNothing cached.z
 - {} ({})zCache contents:
Ú
)r+rr,rrÚosÚpathÚbasenamer.Úformat_file_sizeÚappendr2rr)    rrrÚpatternÚfilesÚresultsÚfilenameÚwheelr*r#r#r$rls  
 
 
 
zCacheCommand.list_cache_itemscCspt|ƒdkrtdƒ‚|s tdƒ‚| ||d¡}|s<tdƒ‚|D]}t |¡t d|¡q@t dt|ƒ¡dS)Nrr&zPlease provide a patternrzNo matching packagesz
Removed %szFiles removed: %s)r+rr,r6ÚunlinkrÚdebugr)rrrr<r>r#r#r$r„s 
zCacheCommand.remove_cache_itemscCs|r tdƒ‚| |dg¡S)Nr&r()rrr'r#r#r$r•szCacheCommand.purge_cachecCstj |jd¡S)NÚwheels)r6r7rr)rrr#r#r$r-œszCacheCommand._wheels_cache_dircCs*| |¡}|d|krdnd}t ||¡S)Nú-z*.whlz-*.whl)r-r.Ú
find_files)rrr;Ú    wheel_dirr#r#r$r, s
zCacheCommand._find_wheelsN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Úignore_require_venvÚusager%rrrrrr-r,r#r#r#r$r s"r )Ú
__future__rÚloggingr6r0Úpip._internal.utils.filesystemÚ    _internalÚutilsr.Úpip._internal.cli.base_commandrÚpip._internal.cli.status_codesrrÚpip._internal.exceptionsrrÚpip._internal.utils.typingrÚoptparser    Útypingr
r Ú    getLoggerrFrr r#r#r#r$Ú<module>s