
    !h                        S SK J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  \(       a  S SKrS S	KJr  S S
KJr  SS jr " S S\
5      rg)    )annotationsN)import_module)Path)TYPE_CHECKING)BaseRunSpiderCommand)
UsageError)iter_spider_classes)PathLike)
ModuleTypec                   [        U 5      R                  5       nUR                  S;  a  [        SU 35      e[	        UR
                  5      nU/[        R                  Q[        l         [        UR                  5      n[        R                  R                  S5        U$ ! [        R                  R                  S5        f = f)N)z.pyz.pywzNot a Python source file: r   )r   resolvesuffix
ValueErrorstrparentsyspathr   stempop)filepathabspathdirnamemodules       `/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/scrapy/commands/runspider.py_import_filer      s    8n$$&G~~_,5gY?@@'..!G##((#CHw||,QM 	Qs   *B   !Cc                  H    \ rS rSrSrSS0rSS jrSS jrSS jrSS jr	S	r
g
)Command   FSPIDER_LOADER_WARN_ONLYTc                    g)Nz[options] <spider_file> selfs    r   syntaxCommand.syntax#   s    (    c                    g)Nz8Run a self-contained spider (without creating a project)r!   r"   s    r   
short_descCommand.short_desc&   s    Ir&   c                    g)Nz(Run the spider defined in the given filer!   r"   s    r   	long_descCommand.long_desc)   s    9r&   c                t   [        U5      S:w  a  [        e[        US   5      nUR                  5       (       d  [        SU S35      e [	        U5      n[        [        U5      5      nU(       d  [        SU S35      eUR                  5       nU R                  (       d   eU R                  R                  " U40 UR                  D6  U R                  R                  5         U R                  R                  (       a  SU l        g g ! [
        [        4 a!  n[        S[        U5      < SU S35      eS nAff = f)N   r   zFile not found: 
zUnable to load z: zNo spider found in file: )lenr   r   existsr   ImportErrorr   r   listr	   r   crawler_processcrawlspargsstartbootstrap_failedexitcode)r#   argsoptsfilenamer   e	spclasses	spiderclss           r   runCommand.run,   s   t9>Q=  /z<==	I!(+F ,V45	8
"EFFMMO	####""9<<""$00DM 1 Z( 	Is8}.?r!BGHH	Is   	D D7D22D7)r9   N)returnr   )r:   z	list[str]r;   zargparse.NamespacerB   None)__name__
__module____qualname____firstlineno__requires_projectdefault_settingsr$   r(   r+   r@   __static_attributes__r!   r&   r   r   r      s(    148)J:r&   r   )r   zstr | PathLike[str]rB   r   )
__future__r   r   	importlibr   pathlibr   typingr   scrapy.commandsr   scrapy.exceptionsr   scrapy.utils.spiderr	   argparseosr
   typesr   r   r   r!   r&   r   <module>rU      s;    " 
 #    0 ( 3 
!" !r&   