
    > /i7              
       *   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	m
Z
 d dlmZ d dlZddlmZ ej                   rddlmZ ddd	Zej)                   ed
      D  ci c]   } | dk7  s	 e|       dj/                  |       " c}         ej0                  dj3                  ej5                         D  cg c]  }  ej6                  |        c}             Z	 d9dej:                  eef   de dejB                  e   defdZ"	 d9dej:                  eef   dejB                  e   defdZ#dddefdZ$dede fdZ%dededefdZ&dejB                  e   fdZ'dedejP                  ejR                  eef      fdZ*dedejB                  e   fdZ+ddhZ,dejZ                  ej\                  ej^                  ej^                  f      dej`                  ej\                  ej^                  ej^                  f      fd Z1d!d"dejB                  e2   fd#Z3d!d"d$d"de fd%Z4d!d"d&d"de fd'Z5dejR                  eejB                  e   f   fd(Z6d:dej:                  eef   dedefd)Z7d:dej:                  eef   dedefd*Z8ded+ej^                  dej^                  fd,Z9dedefd-Z:d.ejB                  e   dejB                  e   fd/Z;d0ejx                  dejB                  e2   fd1Z= G d2 d3      Z> G d4 d5      Z?d6ede fd7Z@d6ede fd8ZAyc c} w c c} w );    N)Path)
getproxies   )PrimitiveDataURLz%22z\\)"\       z%{:02X}|valuelowerencodingreturnc                 z    t        | t              r| }n| j                  |xs d      }|r|j                         S |S )zE
    Coerce str/bytes into a strictly byte-wise HTTP header key.
    ascii)
isinstancebytesencoder   )r   r   r   bytes_values       B/srv/sistema/bot/venv/lib/python3.12/site-packages/httpx/_utils.pynormalize_header_keyr      s<     %ll8#6w7"';8[8    c                 P    t        | t              r| S | j                  |xs d      S )zG
    Coerce str/bytes into a strictly byte-wise HTTP header value.
    r   )r   r   r   r   r   s     r   normalize_header_valuer   -   s'     %<<+G,,r   r   c                 2    | du ry| du ry| yt        |       S )z
    Coerce a primitive data type into a string value.

    Note that we prefer JSON-style 'true'/'false' for boolean values here.
    TtrueFfalse )strr   s    r   primitive_value_to_strr$   8   s*     }	%	u:r   c                 N    	 t        j                  |        y# t        $ r Y yw xY w)z7
    Return `True` if `encoding` is a known codec.
    FT)codecslookupLookupError)r   s    r   is_known_encodingr)   G   s,    h   s    	$$namec                     dt         j                  t           dt        fd}t        j	                  ||      }|  d| dj                         S )z;
    Encode a name/value pair within a multipart form.
    matchr   c                 2    t         | j                  d         S )Nr   )!_HTML5_FORM_ENCODING_REPLACEMENTSgroup)r,   s    r   replacerz#format_form_param.<locals>.replacerW   s    0Q@@r   z="r	   )typingMatchr"   _HTML5_FORM_ENCODING_REsubr   )r*   r   r0   s      r   format_form_paramr5   R   sQ    
AS) Ac A $''%8EV2eWA%%''r   c                  (   dt         j                  v r7t        t         j                  d         } | j                         rt	        |       S dt         j                  v r7t        t         j                  d         }|j                         rt	        |      S y )NSSL_CERT_FILESSL_CERT_DIR)osenvironr   is_filer"   is_dir)ssl_filessl_paths     r   get_ca_bundle_from_envr?   ^   sm    "**$

?34x= #

>23??x= r   c                    g }d}| j                  |      } | s|S t        j                  d|       D ]  }	 |j                  dd      \  }}d|j                  d      i}|j                  d      D ]:  }	 |j                  d      \  }} | j                  |      ||j                  |      <   < |j	                  |        |S # t        $ r |d}}Y w xY w# t        $ r Y  4w xY w)	a7  
    Returns a list of parsed link headers, for more info see:
    https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
    The generic syntax of those is:
    Link: < uri-reference >; param1=value1; param2="value2"
    So for instance:
    Link; '<http:/.../front.jpeg>; type="image/jpeg",<http://.../back.jpeg>;'
    would return
        [
            {"url": "http:/.../front.jpeg", "type": "image/jpeg"},
            {"url": "http://.../back.jpeg"},
        ]
    :param value: HTTP Link entity-header field
    :return: list of parsed link headers
    z '"z, *<;r   r!   urlz<> '"=)stripresplit
ValueErrorappend)	r   linksreplace_charsvalrB   paramslinkparamkeys	            r   parse_header_linksrP   j   s      13EMKK&Exx& 	"))C+KC syy*+\\#& 	HE"[[-
U .3[[-GD=)*	H 	T L  	"rC	"  s#   B?1C?CC	CCcontent_typec                 l    t         j                  j                         }| |d<   |j                  d       S )Nzcontent-type)failobj)emailmessageMessageget_content_charset)rQ   msgs     r   parse_content_type_charsetrY      s4     --


!C&C""4"00r   authorizationzproxy-authorizationitemsc              #      K   | D ]7  \  }}t        |j                               t        v rt        d|      }||f 9 y w)Nz[secure])match_type_of)to_strr   SENSITIVE_HEADERSto_bytes_or_str)r[   kvs      r   obfuscate_sensitive_headersrc      sD       1!'') 11
!<Ad
s   >A rB   r   c                 n    | j                   | j                   S dddj                  | j                        S )NP     )httphttps)portgetscheme)rB   s    r   port_or_defaultrl      s/    
xxxx%))#**55r   otherc                     | j                   |j                   k(  xr2 | j                  |j                  k(  xr t        |       t        |      k(  S )z@
    Return 'True' if the given URLs share the same origin.
    )rk   hostrl   )rB   rm   s     r   same_originrp      sE    
 	

ell" 	;HH

"	;C OE$::r   locationc                     | j                   |j                   k7  ry| j                  dk(  xr/ t        |       dk(  xr |j                  dk(  xr t        |      dk(  S )zA
    Return 'True' if 'location' is a HTTPS upgrade of 'url'
    Frg   re   rh   rf   )ro   rk   rl   )rB   rq   s     r   is_https_redirectrs      sa     xx8==  	

f 	-C B&	-OOw&	- H%,	r   c                     t               } i }dD ]*  }| j                  |      s| |   }d|v r|nd| || d<   , | j                  dd      j                  d      D cg c]  }|j                          }}|D ][  }|dk(  ri c S |st	        |      r	d|d	| <   #t        |      r
d|d
| d<   8|j                         dk(  r	d|d	| <   Td|d| <   ] |S c c}w )z+Gets proxy information from the environment)rg   rh   allz://zhttp://nor!   ,*Nzall://zall://[]	localhostzall://*)r   rj   rF   rD   is_ipv4_hostnameis_ipv6_hostnamer   )
proxy_infomountsrk   hostnamero   no_proxy_hostss         r   get_environment_proxiesr      s    J57F* >>&!!&)H!X-WXJ3G fXS>" 0:~~dB/G/M/Mc/RStdjjlSNS" 4 s?
 I  ).2z*+!(+04
!,-![0.2z*+/3
+,144 M7 Ts   Cc                 H    t        | t              r| j                  |      S | S Nr   r"   r   r   s     r   to_bytesr      s    %/s%;5<<!FFr   c                 H    t        | t              r| S | j                  |      S r   )r   r"   decoder   s     r   r^   r^      s    uc*5FX0FFr   r]   c                 F    t        |t              r| S | j                         S r   r   )r   r]   s     r   r`   r`      s    }c25FFr   c                 8    | d   | d   cxk(  rdk(  rn n| dd S | S )Nr   r	   r    r#   s    r   unquoter      s'    (eBi63652;AEAr   filenamec                 @    | rt        j                  |       d   xs dS y )Nr   zapplication/octet-stream)	mimetypes
guess_type)r   s    r   guess_content_typer     s$    ##H-a0N4NNr   streamc                 B   	 | j                         }t        j                  |      j                  }|S # t        t
        f$ r\ 	 | j                         }| j                  dt        j                        }| j                  |       Y |S # t        t
        f$ r Y Y yw xY ww xY w)zs
    Given a file-like stream object, return its length in number of bytes
    without reading it into memory.
    r   N)	filenor9   fstatst_sizeAttributeErrorOSErrortellseekSEEK_END)r   fdlengthoffsets       r   peek_filelike_lengthr     s    
]]_"%% M G$ 
	 [[]F[[BKK0FKK
 M	 ( 		
s(   /3 BABBBBBc                   @    e Zd ZdefdZddZddZdefdZdefdZy)	Timerr   c                   K   t        j                         }|dk(  rdd l}|j                         S |dk(  r4dd l}t        j                  t        |j                          d {         S dd l	}|j                         j                         S 7 *w)Ntrior   curio)sniffiocurrent_async_libraryr   current_timer   r1   castfloatclockasyncioget_event_looptime)selflibraryr   r   r   s        r   	_get_timezTimer._get_time"  ss     //1f$$&&;;uEKKM&9::%%',,..	 ':s   AB B
!+BNc                 6    t        j                         | _        y r   r   perf_counterstartedr   s    r   
sync_startzTimer.sync_start1  s    ((*r   c                 J   K   | j                          d {   | _        y 7 
wr   r   r   r   s    r   async_startzTimer.async_start4  s     !^^---s   #!#c                 H    t        j                         }|| j                  z
  S r   r   r   nows     r   sync_elapsedzTimer.sync_elapsed7  s    !T\\!!r   c                 \   K   | j                          d {   }|| j                  z
  S 7 wr   r   r   s     r   async_elapsedzTimer.async_elapsed;  s)     NN$$T\\!! %s   ,*,)r   N)	__name__
__module____qualname__r   r   r   r   r   r   r   r   r   r   r   !  s0    / /+."e ""U "r   r   c                       e Zd ZdZdeddfdZdddefdZede	j                  eeef   fd	       Zdefd
Zdd defdZde	j                  defdZy)
URLPatterna  
    A utility class currently used for making lookups against proxy keys...

    # Wildcard matching...
    >>> pattern = URLPattern("all://")
    >>> pattern.matches(httpx.URL("http://example.com"))
    True

    # Witch scheme matching...
    >>> pattern = URLPattern("https://")
    >>> pattern.matches(httpx.URL("https://example.com"))
    True
    >>> pattern.matches(httpx.URL("http://example.com"))
    False

    # With domain matching...
    >>> pattern = URLPattern("https://example.com")
    >>> pattern.matches(httpx.URL("https://example.com"))
    True
    >>> pattern.matches(httpx.URL("http://example.com"))
    False
    >>> pattern.matches(httpx.URL("https://other.com"))
    False

    # Wildcard scheme, with domain matching...
    >>> pattern = URLPattern("all://example.com")
    >>> pattern.matches(httpx.URL("https://example.com"))
    True
    >>> pattern.matches(httpx.URL("http://example.com"))
    True
    >>> pattern.matches(httpx.URL("https://other.com"))
    False

    # With port matching...
    >>> pattern = URLPattern("https://example.com:1234")
    >>> pattern.matches(httpx.URL("https://example.com:1234"))
    True
    >>> pattern.matches(httpx.URL("https://example.com"))
    False
    patternr   Nc                 8   ddl m} |rd|vrt        d| d| d       ||      }|| _        |j                  dk(  rdn|j                  | _        |j
                  d	k(  rdn|j
                  | _        |j                  | _        |j
                  r|j
                  d	k(  rd | _        y |j
                  j                  d
      rAt        j                  |j
                  dd        }t        j                  d| d      | _        y |j
                  j                  d	      rAt        j                  |j
                  dd        }t        j                  d| d      | _        y t        j                  |j
                        }t        j                  d| d      | _        y )Nr   r   :zUProxy keys should use proper URL forms rather than plain scheme strings. Instead of "z", use "z://"ru   r!   rx   z*.   z^.+\.$z^(.+\.)?^)_urlsr   rG   r   rk   ro   ri   
host_regex
startswithrE   escapecompile)r   r   r   rB   domains        r   __init__zURLPattern.__init__j  sI   s')&ixy>  'lJJ%/bSZZ((c/Bsxx	HH	xx388s?DHDOXX  &YYsxx|,F jj6&);<DOXX  %YYsxx|,F jj9VHA)>?DO YYsxx(F jj1VHA7DOr   rm   r   c                    | j                   r| j                   |j                   k7  ry| j                  r2| j                  &| j                  j                  |j                        sy| j                  | j                  |j                  k7  ryy)NFT)rk   ro   r   r,   ri   r   rm   s     r   matcheszURLPattern.matches  sd    ;;4;;%,,6II+OO))%**599 TYY%**%<r   c                     | j                   dnd}t        | j                         }t        | j                         }|||fS )z
        The priority allows URLPattern instances to be sortable, so that
        we can match from most specific to least specific.
        r   r   )ri   lenro   rk   )r   port_priorityhost_priorityscheme_prioritys       r   priorityzURLPattern.priority  sA     "YY2TYYt{{++}o>>r   c                 ,    t        | j                        S r   )hashr   r   s    r   __hash__zURLPattern.__hash__  s    DLL!!r   c                 4    | j                   |j                   k  S r   )r   r   s     r   __lt__zURLPattern.__lt__  s    }}u~~--r   c                 X    t        |t              xr | j                  |j                  k(  S r   )r   r   r   r   s     r   __eq__zURLPattern.__eq__  s!    %,N1NNr   )r   r   r   __doc__r"   r   boolr   propertyr1   Tupleintr   r   r   Anyr   r   r   r   r   r   @  s    'R8 8 8<U t  ?&,,sC}5 ? ?"# ".L .T .OFJJ O4 Or   r   r   c                 r    	 t        j                  | j                  d      d          y# t        $ r Y yw xY wN/r   FT)	ipaddressIPv4AddressrF   	Exceptionr   s    r   r{   r{     <    hnnS1!45      '* 	66c                 r    	 t        j                  | j                  d      d          y# t        $ r Y yw xY wr   )r   IPv6AddressrF   r   r   s    r   r|   r|     r   r   r   )zutf-8)Br&   email.messagerT   r   r   r9   rE   r   r1   pathlibr   urllib.requestr   r   _typesr   TYPE_CHECKINGr   r   r.   updaterangechrformatr   joinkeysr   r3   Unionr"   r   r   Optionalr   r   r$   r)   r5   r?   ListDictrP   rY   r_   Iterabler   AnyStrIteratorrc   r   rl   rp   rs   r   r   r^   r`   r   r   r   r   r   r   r{   r|   )cs   0r   <module>r     s       	 	    %  !	 +0v$> ! ! ( (*//GQQ$YSVYa  G %"**II%F%K%K%MNyryy|NO  &*9<<U
#99 ooc"9 	9" GK-<<U
#-/5s/C-
-/ c   	(C 	( 	( 	(	 4 	"c "fkk&++c3h2G&H "J1S 1V__S5I 1 %&;< ??6<<v}}(DEF__V\\&--">?@6 66??3#7 6U 5 T 5 E d ,S&//#2F-F!G ,^GFLLe, G G% GG&,,sEz* Gc G GG3 Gv}} G GB3 B3 B!5 &//#:N  0D 2" ">jO jOZs t s t  H Os   #
L.L8L