
    hE                       d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZmZmZ 	 ddlZdZn# e$ r d	ZY nw xY wd
dlmZ  eed          Z ee          Z G d de          Zd Zd ZeZ	 	 ddZddZddZd ZdS )zURL Utilities.    )annotations)Mapping)partial)
NamedTuple)	parse_qslquoteunquoteurlparseNTF   )
get_logger )safec                  Z    e Zd ZU dZded<   ded<   ded<   ded<   ded<   ded	<   d
ed<   dS )urlpartsz*Named tuple representing parts of the URL.strschemehostnameintportusernamepasswordpathr   queryN)__name__
__module____qualname____doc____annotations__     O/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/kombu/utils/url.pyr   r      sU         44KKKMMMIIIMMMMMMIIINNNNNr    r   c           
        t          |           \  }}}}}}}|rd |                                D             }|D ]}	|	dk    r"||	                                         dk    ||	<   n@|	dk    r:t          ||	                   ||	<   ||	         t                              d           d|vri |d<   ||	         |d         |	<   ||	= t          d	||||||d|S )
z%Parse URL into mapping of components.c                <    g | ]}|                     d           |S )ssl_)
startswith).0keys     r!   
<listcomp>zparse_url.<locals>.<listcomp>(   s)    FFFs~~f/E/EFFFFr    ssl_check_hostnamefalsessl_cert_reqsNz%Defaulting to insecure SSL behaviour.ssl)	transportr   r   useridr   virtual_hostr   )
_parse_urlkeyslowerparse_ssl_cert_reqsloggerwarningdict)
urlr   hostr   userr   r   r   r1   r'   s
             r!   	parse_urlr:   #   s    7Aoo3FD$he FFuzz||FFF 	 	C***"3Z--//7:c

''0s<<c
:%NN#JKKKE!!!e %c
E%Lc

 ?&4$!? ?8=? ? ?r    c                   t          |           j        }| t          |          dz   d         }t          d|z             }|j        pd}|r|d         dk    r
|dd         n|}t	          |t          |j        pd          pd|j        t          |j        pd          pdt          |j	        pd          pdt          |pd          pdt          t          |j                                      S )z5Parse URL into :class:`urlparts` tuple of components.   Nzhttp://r   r   /   )r
   r   lenr   r   r	   r   r   r   r   r6   r   r   )r7   r   
schemelesspartsr   s        r!   url_to_partsrB   <   s     c]]!FS[[1_%%&JY+,,E:D8Q3488DD$"%%-
$"%%-$"%%-
#tYu{##$$  r    **c	                   |  dg}	|s|r~|r"|	                     t          |                     |rC|r|	                    |rd|gndg           n$|	                    dt          |          g           |	                     d           |	                     |rt          |          nd           |r|	                    d|g           |	                    d|g           d                    d |	D                       S )z"Generate URL from component parts.://:@r   r=   c              3  8   K   | ]}|t          |          V  d S )N)r   )r&   parts     r!   	<genexpr>zas_url.<locals>.<genexpr>e   s-      77$73t99777777r    )append	safequoteextendjoin)
r   r8   r   r9   r   r   r   sanitizemaskrA   s
             r!   as_urlrQ   S   s    ^^^E x  	*LL4))) 	9 9D;c4[[se<<<<c9X#6#67888S	LLD04b111 "c4[!!!	LL#t7777777777r    c                6    t          t          |           d|dS )z)Return copy of URL with password removed.T)rO   rP   )rQ   r0   r7   rP   s     r!   sanitize_urlrT   h   s     :c??T====r    c                X    t          | t                    rd| v rt          | |          S | S )z-Sanitize url, or do nothing if url undefined.rE   )
isinstancer   rT   rS   s     r!   maybe_sanitize_urlrW   n   s3     #s 'C&&&Jr    c                    t           rMt          j        t          j        t          j        t          j        t          j        t          j        d}||          S dS )zMGiven the query parameter for ssl_cert_reqs, return the SSL constant or None.)CERT_REQUIREDCERT_OPTIONAL	CERT_NONErequiredoptionalnoneN)ssl_availabler,   rY   rZ   r[   )query_valuequery_value_to_constants     r!   r3   r3   v   sM       . .))M#
 #
 '{33tr    )NNNNNNFrC   )rC   )r   
__future__r   collections.abcr   	functoolsr   typingr   urllib.parser   r   r	   r
   r,   r_   ImportErrorlogr   rL   r   r4   r   r:   rB   r0   rQ   rT   rW   r3   r   r    r!   <module>ri      s     # " " " " " # # # # # #             < < < < < < < < < < < <JJJMM   MMM      GE###		H			 	 	 	 	z 	 	 	? ? ?2  ( 
 >B7;8 8 8 8*> > > >       s   / 99