
    hK                     F    S SK Jr   " S S\R                  5      rS rS rg)    )resourcec                   ,    \ rS rSrS rS rS rS rSrg)RewriterResource   c                 n    [         R                  R                  U 5        Xl         [        U5      U l        g N)r   Resource__init__listrewriteRules)selforigr   s      Z/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/web/rewrite.pyr
   RewriterResource.__init__	   s(    ""4( .    c                 :    U R                    H  nU" U5        M     g r   )r   )r   requestrewriteRules      r   _rewriteRewriterResource._rewrite   s    ,,K  -r   c                 2   UR                   R                  SU5        UR                  R                  5         U R	                  U5        UR                   R                  S5      nUR                  R                  U5        U R                  R                  X5      $ )Nr   )postpathinsertprepathpopr   appendr   getChildWithDefault)r   pathr   s      r   getChildRewriterResource.getChild   sq    4(g##A&t$}}00??r   c                 Z    U R                  U5        U R                  R                  U5      $ r   )r   r   render)r   r   s     r   r"   RewriterResource.render   s#    g}}##G,,r   )r   r   N)	__name__
__module____qualname____firstlineno__r
   r   r   r"   __static_attributes__ r   r   r   r      s    /
!@-r   r   c                     U R                   (       ai  U R                   S   S S S:X  aR  SU R                   S   SS  /U R                   S S& SSR                  U R                  U R                   -   5      -   U l        g g g )Nr      ~users/)r   joinr   r   )r   s    r   tildeToUsersr0      sy    G,,Q/3s: ')9)9!)<QR)@A!SXXgoo8H8H&HII ;r   c                 \   ^ ^ TR                  S5      mT R                  S5      m U U4S jnU$ )ay  
I am not a very good aliaser. But I'm the best I can be. If I'm
aliasing to a Resource that generates links, and it uses any parts
of request.prepath to do so, the links will not be relative to the
aliased path, but rather to the aliased-to path. That I can't
alias static.File directory listings that nicely. However, I can
still be useful, as many resources will play nice.
r.   c                    > U R                   S [        T5       T:X  aS  U R                   [        T5      S  nTU-   U l         SSR                  U R                  U R                   -   5      -   U l        g g )Nr.   )r   lenr/   r   r   )r   after	aliasPath
sourcePaths     r   rewriteralias.<locals>.rewriter1   sj    ,c)n-:$$S^%56E)E1G'//G<L<L*L!MMGL ;r   )split)r5   r6   r7   s   `` r   aliasr:   %   s0     !!#&J$IN Or   N)twisted.webr   r	   r   r0   r:   r)   r   r   <module>r<      s'   
 !-x(( -.Jr   