
    !h                       S SK Jr  S SKrS SKrS SKJrJrJrJrJ	r	  S SK
Jr  S SKJr  S SKJr  \(       a"  S SKJrJr  S SKJrJr  S S	KJr  S S
KJr  S SKJr  \R8                  " \5      r\" S5      r\	SS j5       r \	SS j5       r \	SS j5       r     SS jr SS jr!\	  S           S S jj5       r"\	  S           S!S jj5       r"\	SSS.         S"S jj5       r"   S#           S$S jjr" " S S\5      r#g)%    )annotationsN)TYPE_CHECKINGAnyLiteralTypeVaroverload)Spider)deferred_from_coro)arg_to_iter)AsyncGeneratorIterable)CoroutineType
ModuleType)Deferred)Request)SpiderLoaderProtocol_Tc                    g N results    Z/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/scrapy/utils/spider.pyiterate_spider_outputr      s    MP    c                    g r   r   r   s    r   r   r      s    PSr   c                    g r   r   r   s    r   r   r   #   s    8;r   c                    [         R                  " U 5      (       a  U $ [         R                  " U 5      (       a"  [        U 5      nUR	                  [
        5        U$ [        [        U 5      5      $ r   )inspect
isasyncgeniscoroutiner
   addCallbackr   r   )r   ds     r   r   r   '   sX     &!!6""v&	+,)&122r   c              #    #    [        U 5      R                  5        Hk  n[        R                  " U5      (       d  M   [	        U[
        5      (       d  M7  UR                  U R                  :X  d  MS  [        USS5      (       d  Mg  Uv   Mm     g7f)zwReturn an iterator over all spider classes defined in the given module
that can be instantiated (i.e. which have name)
nameN)	varsvaluesr   isclass
issubclassr	   
__module____name__getattr)moduleobjs     r   iter_spider_classesr/   3   s^      F|""$OOC  3''&//1VT**I %s   6BBB/B	B.c                    g r   r   spider_loaderrequestdefault_spiderclslog_nonelog_multiples        r   spidercls_for_requestr7   A   s     r   c                    g r   r   r1   s        r   r7   r7   K        r   )r5   r6   c                   g r   r   )r2   r3   r5   r6   s       r   r7   r7   U   r9   r   c                F   U R                  U5      n[        U5      S:X  a  U R                  US   5      $ [        U5      S:  a/  U(       a(  [        R	                  SUSR                  U5      S.5        [        U5      S:X  a  U(       a  [        R	                  SSU05        U$ )a  Return a spider class that handles the given Request.

This will look for the spiders that can handle the given request (using
the spider loader) and return a Spider class if (and only if) there is
only one Spider able to handle the Request.

If multiple spiders (or no spider) are found, it will return the
default_spidercls passed. It can optionally log if multiple or no spiders
are found.
   r   z9More than one spider can handle: %(request)s - %(snames)sz, )r3   snamesz/Unable to find spider that handles: %(request)sr3   )find_by_requestlenloadloggererrorjoin)r2   r3   r4   r5   r6   r=   s         r   r7   r7   _   s    " **73F
6{a!!&),,
6{Q<G499V+<=	

 6{aH=	7?S	
 r   c                      \ rS rSrSrSrg)DefaultSpider   defaultr   N)r+   r*   __qualname____firstlineno__r%   __static_attributes__r   r   r   rE   rE      s    Dr   rE   )r   AsyncGenerator[_T]returnrK   )r   zCoroutineType[Any, Any, _T]rL   zDeferred[_T])r   r   rL   zIterable[Any])r   r   rL   z1Iterable[Any] | AsyncGenerator[_T] | Deferred[_T])r-   r   rL   zIterable[type[Spider]])..)r2   r   r3   r   r4   type[Spider]r5   boolr6   rN   rL   rM   )r2   r   r3   r   r4   zLiteral[None]r5   rN   r6   rN   rL   type[Spider] | None)
r2   r   r3   r   r5   rN   r6   rN   rL   rO   )NFF)r2   r   r3   r   r4   rO   r5   rN   r6   rN   rL   rO   )$
__future__r   r   loggingtypingr   r   r   r   r   scrapy.spidersr	   scrapy.utils.deferr
   scrapy.utils.miscr   collections.abcr   r   typesr   r   twisted.internet.deferr   scrapyr   scrapy.spiderloaderr   	getLoggerr+   rA   r   r   r/   r7   rE   r   r   r   <module>r\      s   "   A A ! 1 )8//8 
		8	$T] 
 P 
 P 
 S 
 S 
 ; 
 ;	3	36	3 

 ' $ 	
   
 

 ' % 	
   
 

 ' 	
   
 .2 '   +  	 
    FF r   