
    9i                        S SK r S SKrS SKrS SKJr  S SKJr  S SKJr  S SK	J
r
  S SKJr  S SKJr  \" \ R                  S9r\R"                  R%                  \R"                  R'                  \5      5      rS	 r " S
 S\5      rg)    N)ArgumentParser)Optional)
CLICommand)scan_cache_dir)CacheNotFound)
get_logger)	log_levelc                     [        U 5      $ )z=Function which will be called for a specific sub parser.
    )ScanCacheCMD)argss    X/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/modelscope/cli/scancache.pysubparser_funcr      s         c                   <    \ rS rSrSrS r\S\4S j5       rS r	Sr
g)	r      z
scan-cachec                 2    Xl         UR                  U l        g )N)r   dir	cache_dir)selfr   s     r   __init__ScanCacheCMD.__init__   s    	(,r   parsersc                     U R                  [        R                  5      nUR                  5       nUR	                  S[
        SSS9  UR                  [        S9  g)z:define args for create pipeline template command.
        z--dirNzLcache directory to scan (optional). Default to the default ModelScope cache.)typedefaulthelp)func)
add_parserr   nameadd_mutually_exclusive_groupadd_argumentstrset_defaultsr   )r   parsergroups      r   define_argsScanCacheCMD.define_args   sZ     ##L$5$56335Z 	 	
 	0r   c           	      L    [         R                   " 5       n[        U R                  5      n[         R                   " 5       n[	        UR                  5       5        [	        S[        X1-
  S5       S[        UR                  5       SUR                   S35        [        UR                  5      S:  aC  S[        UR                  5       S	3n[	        U5        UR                   H  n[	        U5        M     g g ! [         a$  nUR                  n[	        SU 35         S nAg S nAff = f)
NzCache directory not found: z	
Done in    zs. Scanned z repo(s) for a total of .r   zGot z warning(s) while scanning.)timer   r   r   printexport_as_tableroundlenrepossize_on_disk_strwarnings)r   t0
cache_infot1excr   messagewarnings           r   executeScanCacheCMD.execute/   s   	B'7JB
 	j((*+rw*+;s:;K;K7L6M N)::;1>	? z""#a'S!4!4566QRG'N%..g / (  	I/	{;<	s   ?C5 5
D#?DD#)r   r   N)__name__
__module____qualname____firstlineno__r   r   staticmethodr   r&   r9   __static_attributes__ r   r   r   r      s,    D1 1^ 1 1r   r   )loggingosr+   argparser   typingr   modelscope.cli.baser   modelscope.hub.cache_managerr   modelscope.hub.errorsr   modelscope.utils.loggerr   WARNINGloggerpathdirnameabspath__file__current_pathr   r   rA   r   r   <module>rQ      s^     	  #  * 7 / .	goo	.wwrwwx89(: (r   