
    h                    ~    S SK Jr  S SKJr  S SKJrJrJrJr  \	" S5      r
SSS jjrSSS jjrSS jrSS jrSS	 jrg
)    )annotations)time)ParseResultquoteurlparse
urlunparse0123456789ABCDEFabcdefc                    U R                  U5      u  p#[        [        USS 5      [        USS 5      5      n[        [        USS 5      [        USS 5      5      nXE4$ )zFParse a string with a time period into a tuple of start and end times.N   )splitr   int)time_period	separatorstart_time_strend_time_str
start_timeend_times         U/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/protego/_utils.py_parse_time_periodr   	   sf    #.#4#4Y#? Nc.!,-s>"#3F/GHJCRa()3|BC/@+ABH    c                ^   SU ;  a  U $ U Vs1 s H  n[        U5      S iM     nnU R                  S5      nUS   R                  S5      /nUSS  H  n[        U5      S:  a  [	        USS 5      R                  [        5      (       aY  USS R                  5       nUSS n	X;  a8  UR                  [        R                  U5      U	R                  S5      -   5        M  X-   nUR                  SUR                  S5      -   5        M     S	R                  U5      R                  SU5      $ s  snf )
z9Replace %xy escapes by their single-character equivalent.%02Xr   zutf-8   Nr      %r   )ordr   encodelensetissubset_HEX_DIGITSupperappendbytesfromhexjoindecode)
urlignoreerrorsc
ignore_setpartsparts_encodedparthexcodeleftovers
             r   _unquoter3      s   
#~
 ,226aSVCL/6J2IIcNE"'(//'":!;Mab	t9>c$r(m44[AA2Ahnn&GABxH($$U]]7%;hoog>V%VW%D 	TDKK$889  88M"))'6::' 3s   D*c                ~    [        [        U 5      5      SS R                  5       n[        U5      S:X  a  SU 3nSU 3$ )z!Escape char as RFC 2396 specifiesr   Nr   0r   )hexr   r#   r   )charhex_reprs     r   
_hexescaper9   .   sB    3t9~ab!'')H
8}xj>xj>r   c                    [        U 5      n[        UR                  SS9n [        U SS9n [	        SSXR
                  UR                  UR                  5      n[        U5      n U =(       d    S$ )zReturn percent encoded path.z/%r*   safe /)	r   r3   pathr   r   paramsqueryfragmentr   )r@   r.   s     r   _quote_pathrD   6   sY    TNEEJJt,DD!DBllEKKPEeD;3r   c                   U R                  S5      (       a  SU -   n U R                  S5      (       a  SU -   n SnU S   S:X  d  U S   S:X  d	  U S   S:X  a
  U S   nU S S n [        U 5      n[        UR                  S	S
9n [	        U SS9n [        SSX-   UR                  UR                  UR                  5      n[        U5      $ )N)zhttps://zhttp://r?   z//r>   ?;$z/*$%r;   z/*%=r<   )

startswithr   r3   r@   r   r   rA   rB   rC   r   )pattern	last_charr.   s      r   _quote_patternrM   A   s    122-$. Ir{cWR[C/72;#3EBK	#2,WEuzz&1GG&)G
B#U\\5;;E er   N)-)r   strr   rO   returnztuple[time, time])r>   replace)r)   rO   r*   rO   r+   rO   rP   rO   )r7   rO   rP   rO   )r@   rO   rP   rO   )rK   rO   rP   rO   )
__future__r   datetimer   urllib.parser   r   r   r   r    r"   r   r3   r9   rD   rM    r   r   <module>rV      s5    "  A A*+ ;:r   