
    h                          S r SSKJr  SSKJrJrJr  SSK	J
r  SR                  \" SS5       V s/ s H  n \" U 5      R                  S5      PM     sn 5      rS	 r " S
 S5      rgs  sn f )z(
L{URLPath}, a representation of a URL.
    )cast)quoteunquote
urlunsplit)URL          asciic                 6   ^ SU -   m[        U4S jU4S j5      $ )z
Attriute declaration to preserve mutability on L{URLPath}.

@param name: a public attribute name
@type name: native L{str}

@return: a descriptor which retrieves the private version of the attribute
    on get and calls rerealize on set.
_c                    > [        U T5      $ N)getattr)selfprivateNames    ]/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/python/urlpath.py<lambda>"_rereconstituter.<locals>.<lambda>   s    WT;/r   c                    > [        U T[        U[        5      (       a  UOUR                  S5      5      =(       d    U R	                  5       $ )Ncharmap)setattr
isinstancebytesencode_reconstitute)r   valuer   s     r   r   r      sC    #E511u||I7N $
 !!#$r   )property)namer   s    @r   _rereconstituterr       s#     *K/	

 
r   c                      \ rS rSrSr SS jrS r\" S5      r\" S5      r	\" S5      r
\" S5      r\" S	5      r\S
 5       rSS jr\S 5       r\S 5       r\S 5       rS rSS jrSS jrSS jrSS jrS rS\4S jrS\4S jrSrg)URLPath)   a  
A representation of a URL.

@ivar scheme: The scheme of the URL (e.g. 'http').
@type scheme: L{bytes}

@ivar netloc: The network location ("host").
@type netloc: L{bytes}

@ivar path: The path on the network location.
@type path: L{bytes}

@ivar query: The query argument (the portion after ?  in the URL).
@type query: L{bytes}

@ivar fragment: The page fragment (the portion after # in the URL).
@type fragment: L{bytes}
c                     U=(       d    SU l         X l        U=(       d    SU l        X@l        XPl        U R                  5         g )Ns   http   /)_scheme_netloc_path_query	_fragmentr   )r   schemenetlocpathqueryfragments         r   __init__URLPath.__init__=   s6     (\T
!r   c           	         [        [        U R                  U R                  U R                  U R
                  U R                  45      [        S9n[        R                  " UR                  S5      R                  S5      5      U l        g)z=
Reconstitute this L{URLPath} from all its given attributes.
safer   N)urlquoter   r&   r'   r(   r)   r*   	_allascii_URLfromTextr   decode_url)r   urltexts     r   r   URLPath._reconstituteG   sc     t||TZZdnnU 	
 MM'.."9"@"@"IJ	r   r+   r,   r-   r.   r/   c                    U R                  U 5      nUR                  UR                  =(       d    S/S9Ul        UR                  R                  R                  S5      Ul        UR                  R                  5       R                  S5      Ul        [        UR                  R                  SS9R                  5       R                  5       R                  S5      Ul        [        UR                  R                  S9R                  5       R                  5       R                  S5      SS Ul        UR                  R                  R                  S5      Ul        U$ )	z
Reconstruct all the public instance variables of this L{URLPath} from
its underlying L{_URL}.

@param urlInstance: the object to base this L{URLPath} on.
@type urlInstance: L{_URL}

@return: a new L{URLPath}
 )r-   r   T)r-   rooted)r.   r	   N)__new__replacer-   r:   r+   r   r&   	authorityr'   r7   asURIasTextr(   r.   r)   r/   r*   )clsurlInstancer   s      r   _fromURLURLPath._fromURLY   s    {{3''[-=-=-E"'F	yy''..w7yy**,33G<diinnT288:AACJJ7S 	
 $))//288:AACJJ7SUVUWX++227;r   c                     U R                   R                  nS nU(       a  U4S jnS/U Vs/ s H
  oT" U5      PM     sn-   $ s  snf )z
Split this URL's path into its components.

@param unquote: whether to remove %-encoding from the returned strings.

@param copy: (ignored, do not use)

@return: The components of C{self.path}
@rtype: L{list} of L{bytes}
c                 $    U R                  S5      $ )Nr   )r   xs    r   r   "URLPath.pathList.<locals>.<lambda>{   s    188G,r   c                 $    U" [        U 5      5      $ r   )
urlunquote)rL   ms     r   r   rM   }   s    :a=)9r   r   )r:   r-   )r   r   copysegmentsmappersegments         r   pathListURLPath.pathListo   sD     99>>,!'9Fux@xGwx@@@@s   Ac                     [        U[        5      (       d  [        S5      eU R                  [        R
                  " U5      5      $ )z
Make a L{URLPath} from a L{str} or L{unicode}.

@param url: A L{str} representation of a URL.
@type url: L{str} or L{unicode}.

@return: a new L{URLPath} derived from the given string.
@rtype: L{URLPath}
z'url' must be a str)r   str
ValueErrorrG   r7   r8   )klassurls     r   
fromStringURLPath.fromString   s5     #s##233~~dmmC011r   c                     [        U[        5      (       d  [        S5      e[        U[        S9nU R                  U5      $ )z
Make a L{URLPath} from a L{bytes}.

@param url: A L{bytes} representation of a URL.
@type url: L{bytes}

@return: a new L{URLPath} derived from the given L{bytes}.
@rtype: L{URLPath}

@since: 15.4
z'url' must be bytesr3   )r   r   rY   r5   r6   r\   )rZ   r[   quoteds      r   	fromBytesURLPath.fromBytes   s:     #u%%233#I.''r   c                 @    U R                  UR                  5       5      $ )z
Make a L{URLPath} from a L{twisted.web.http.Request}.

@param request: A L{twisted.web.http.Request} to make the L{URLPath}
    from.

@return: a new L{URLPath} derived from the given request.
@rtype: L{URLPath}
)r`   
prePathURL)rZ   requests     r   fromRequestURLPath.fromRequest   s     w11344r   c                     U R                  UR                  SU(       a  U R                  R                  S95      $ SS95      $ )a  
Return a modified copy of C{self} using C{newURL}, keeping the query
string if C{keepQuery} is C{True}.

@param newURL: a L{URL} to derive a new L{URLPath} from
@type newURL: L{URL}

@param keepQuery: if C{True}, preserve the query parameters from
    C{self} on the new L{URLPath}; if C{False}, give the new L{URLPath}
    no query parameters.
@type keepQuery: L{bool}

@return: a new L{URLPath}
r>    )r/   r.   )rG   rA   r:   r.   )r   newURL	keepQuerys      r   _modURLPath._mod   sA     }}NNBdiiooNS
 	
PRNS
 	
r   c                 v    U R                  U R                  R                  UR                  S5      5      U5      $ )a=  
Get the sibling of the current L{URLPath}.  A sibling is a file which
is in the same directory as the current file.

@param path: The path of the sibling.
@type path: L{bytes}

@param keepQuery: Whether to keep the query parameters on the returned
    L{URLPath}.
@type keepQuery: L{bool}

@return: a new L{URLPath}
r   )rk   r:   siblingr9   r   r-   rj   s      r   rn   URLPath.sibling   s-     yy**4;;w+?@)LLr   c                 v    U R                  U R                  R                  UR                  S5      5      U5      $ )z
Get the child of this L{URLPath}.

@param path: The path of the child.
@type path: L{bytes}

@param keepQuery: Whether to keep the query parameters on the returned
    L{URLPath}.
@type keepQuery: L{bool}

@return: a new L{URLPath}
r   )rk   r:   childr9   ro   s      r   rr   URLPath.child   s+     yyW)=>	JJr   c                 X    U R                  U R                  R                  S5      U5      $ )z
Get the parent directory of this L{URLPath}.

@param keepQuery: Whether to keep the query parameters on the returned
    L{URLPath}.
@type keepQuery: L{bool}

@return: a new L{URLPath}
z..rk   r:   clickr   rj   s     r   parentURLPath.parent   s"     yy.	::r   c                 X    U R                  U R                  R                  S5      U5      $ )z
Get the current directory of this L{URLPath}.

@param keepQuery: Whether to keep the query parameters on the returned
    L{URLPath}.
@type keepQuery: L{bool}

@return: a new L{URLPath}
.ru   rw   s     r   hereURLPath.here   s"     yy-y99r   c                 t    U R                  U R                  R                  UR                  S5      5      5      $ )z
Return a path which is the URL where a browser would presumably take
you if you clicked on a link with an HREF as given.

@param st: A relative URL, to be interpreted relative to C{self} as the
    base URL.
@type st: L{bytes}

@return: a new L{URLPath}
r   )rG   r:   rv   r9   )r   sts     r   rv   URLPath.click   s)     }}TYY__RYYw-?@AAr   returnc                 n    [        [        U R                  R                  5       R	                  5       5      $ )z-
The L{str} of a L{URLPath} is its URL text.
)r   rX   r:   rC   rD   r   s    r   __str__URLPath.__str__  s%     C*11344r   c                     SR                  U R                  U R                  U R                  U R                  U R
                  5      $ )zc
The L{repr} of a L{URLPath} is an eval-able expression which will
construct a similar L{URLPath}.
zGURLPath(scheme={!r}, netloc={!r}, path={!r}, query={!r}, fragment={!r}))formatr+   r,   r-   r.   r/   r   s    r   __repr__URLPath.__repr__  s;    
 Y__KKKKIIJJMM
 	
r   )r*   r'   r(   r)   r&   r:   N)r   s	   localhostr   r   r   )FT)F)__name__
__module____qualname____firstlineno____doc__r0   r   r    r+   r,   r-   r.   r/   classmethodrG   rU   r\   r`   re   rk   rn   rr   rx   r|   rv   rX   r   r   __static_attributes__rh   r   r   r"   r"   )   s    ( NQ
K h'Fh'FF#DW%E
+H *A" 2 2 ( (" 
5 
5
&M K
;
:B5 5
# 
r   r"   N)r   typingr   urllib.parser   r5   r   rO   r   	hyperlinkr   r7   joinrangechrr   r6   r    r"   rK   s   0r   <module>r      s_   
  M M !HHeAsmDmc!fmmG,mDE	0m
 m
7 Es   !A%