
    ,h]                         d dl m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	 ej                  rddlmZ ddZddZddd	Zddd
ZddZddZddZ G d d      ZddZddZy)    )annotationsN)
getproxies   )PrimitiveDataURLc                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values    N/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/httpx/_utils.pyprimitive_value_to_strr      s*     }	%	u:    c                    t               } i }dD ]*  }| j                  |      s| |   }d|v r|nd| || d<   , | j                  dd      j                  d      D cg c]  }|j                          }}|D ]e  }|dk(  ri c S |sd|v rd||<   t	        |      r	d|d	| <   -t        |      r
d|d
| d<   B|j                         dk(  r	d|d	| <   ^d|d| <   g |S c c}w )z+Gets proxy information from the environment)httphttpsallz://zhttp://nor   ,*Nzall://zall://[]	localhostzall://*)r   getsplitstripis_ipv4_hostnameis_ipv6_hostnamelower)
proxy_infomountsschemehostnamehostno_proxy_hostss         r   get_environment_proxiesr(      s1    J$&F* >>&!!&)H!X-WXJ3G fXS>" 0:~~dB/G/M/Mc/RStdjjlSNS" 4 s?
 I  #'x !(+.2z*+!(+04
!,-![0.2z*+/3
+,548 M; Ts   C$c                H    t        | t              r| j                  |      S | S N
isinstancer   encoder   encodings     r   to_bytesr0   O   s    %/s%;5<<!FFr   c                H    t        | t              r| S | j                  |      S r*   )r,   r   decoder.   s     r   to_strr3   S   s    uc*5FX0FFr   c                F    t        |t              r| S | j                         S r*   r+   )r   match_type_ofs     r   to_bytes_or_strr6   W   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   s    r   unquoter;   [   s'    (eBi63652;AEAr   c                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)	filenoosfstatst_sizeAttributeErrorOSErrortellseekSEEK_END)streamfdlengthoffsets       r   peek_filelike_lengthrJ   _   s    
]]_"%% M G$ 
	 [[]F[[BKK0FKK
 M	 ( 		
s(   /3 BABBBBBc                  J    e Zd ZdZd	dZd
dZedd       ZddZddZ	d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
    c                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://"r   r   r   z*.   z^.+\.$z^(.+\.)?^)_urlsr   
ValueErrorpatternr$   r&   port
host_regex
startswithreescapecompile)selfrT   r   urldomains        r   __init__zURLPattern.__init__   sI   s')&ixy>  'lJJ%/bSZZ((c/Bsxx	HH	xx388s?:>DOXX  &YYsxx|,F jj6&);<DOXX  %YYsxx|,F jj9VHA)>?DO YYsxx(F jj1VHA7DOr   c                   | j                   r| j                   |j                   k7  ry| j                  r2| j                  &| j                  j                  |j                        sy| j                  | j                  |j                  k7  ryy)NFT)r$   r&   rV   matchrU   r[   others     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   )rU   lenr&   r$   )r[   port_priorityhost_priorityscheme_prioritys       r   priorityzURLPattern.priority   sA     "YY2TYYt{{++}o>>r   c                ,    t        | j                        S r*   )hashrT   )r[   s    r   __hash__zURLPattern.__hash__   s    DLL!!r   c                4    | j                   |j                   k  S r*   )ri   ra   s     r   __lt__zURLPattern.__lt__   s    }}u~~--r   c                X    t        |t              xr | j                  |j                  k(  S r*   )r,   rL   rT   ra   s     r   __eq__zURLPattern.__eq__   s!    %,N1NNr   N)rT   r   returnNone)rb   r   rq   bool)rq   ztuple[int, int, int])rq   int)rb   rL   rq   rs   )rb   
typing.Anyrq   rs   )__name__
__module____qualname____doc__r^   rc   propertyri   rl   rn   rp   r:   r   r   rL   rL   x   s6    'R8< ? ?".Or   rL   c                r    	 t        j                  | j                  d      d          y# t        $ r Y yw xY wN/r   FT)	ipaddressIPv4Addressr   	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~   IPv6Addressr   r   r   s    r   r    r       r   r   )r   r   rq   r   )rq   zdict[str, str | None])zutf-8)r   str | bytesr/   r   rq   bytes)r   r   r/   r   rq   r   )r   r   r5   typing.AnyStrrq   r   )r   r   rq   r   )rF   ru   rq   z
int | None)r%   r   rq   rs   )
__future__r   r~   r>   rX   typingurllib.requestr   _typesr   TYPE_CHECKINGrR   r   r   r(   r0   r3   r6   r;   rJ   rL   r   r    r:   r   r   <module>r      sg    "  	 	  % !	.bGGGB2jO jOZr   