
    3in                         S SK JrJrJrJr  S SKJrJrJr  S SK	r	S SK
rS SKrS SKJr  S SKJr  \	R"                  " \5      r " S S5      rg)    )AnyDictOptionalTypeVar)quoteurlparse
urlunparseN)Settingsc                       \ rS rSr% \\S'   Sr\\S'   Sr\	\S'   \
S\SS4S	 j5       r\
   SS
\S\\   S\\   S\\	   S\4
S jj5       r\" S\\\4   S9r\
S\S\4S j5       r\
S\R*                  SS4S j5       rSrg)BaseHTTPClient   	_settingsNpre_flight_checks(   keepalive_secshostreturnc                     [        U 5      nSU ;   a)  UR                  S;  a  [        SUR                   S35      eSU ;   a"  U R                  S5      (       d  [        S5      eg g )N/>   httphttpsz%Invalid URL. Unrecognized protocol - .r   zInvalid URL. Seems that you are trying to pass URL as a host but without                   specifying the protocol. Please add http:// or https:// to the host.)r   scheme
ValueError
startswith)r   parseds     W/home/james-whalen/.local/lib/python3.13/site-packages/chromadb/api/base_http_client.py_validate_hostBaseHTTPClient._validate_host   sk    $$;6==0AA:6==/K  $; 7 7>  !8;    chroma_server_hostchroma_server_ssl_enableddefault_api_pathchroma_server_http_portc           
         SnU n[         R                  U5        UR                  S5      (       a  [        R	                  S5        Sn[        U5      nU(       a  SOUR                  =(       d    SnUR                  =(       d    UR                  =(       d    U nU(       d!  S[        UR                  =(       d    U5      -   OSn	UR                  =(       d    Un
U
(       a  X:X  a  U(       a  UOSn
U
R                  U=(       d    S5      (       d  U(       a  X-   OSn
[        Xx U	 3[        U
R                  SS	5      5      SSS45      nU$ )
NFr   z/Skipping port as the user is passing a full URLTr   : z//r   )r   r   r   loggerdebugr   r   netlochostnamestrportpathendswithr	   r   replace)r!   r"   r#   r$   
_skip_port_chroma_server_hostr   r   net_locr-   r.   full_urls               r   resolve_urlBaseHTTPClient.resolve_url!   s    
0%%&9:))&11LLJKJ-.56==;RF--H6??H6HEOC#fkk<%<==UW 	 {{..t'7#RD}}-344.>4*BDy't||D#/F)GRQST
 r    T)boundparamsc                 b    U R                  5        VVs0 s H  u  pUc  M
  X_M     snn$ s  snnf )z&Remove None values from provided dict.)items)r9   kvs      r   _clean_paramsBaseHTTPClient._clean_paramsD   s*     "(A1AAAs   	++respc                     U R                  5         g! [        R                   a     Of = fSn [        R                  " U R
                  5      nSU;   a^  US   [        R                  ;   aG  [        R                  US      " US   5      nU R                  R                  S5      nU(       a  X1l
        O! [         a     Of = fU(       a  Ue U R                  5         g! [        R                   aS    U R                  R                  S5      nU(       a  [        U R
                   SU S35      e[        U R
                  5      ef = f)zKRaises an error if the response is not ok, using a ChromaError if possible.Nerrormessagezchroma-trace-idz (trace ID: ))raise_for_statushttpxHTTPStatusErrorjsonloadstexterrorserror_typesheadersgettrace_idBaseException	Exception)r@   chroma_errorbodyrO   s       r   _raise_chroma_error"BaseHTTPClient._raise_chroma_errorI   s&   	!!#$$ 		 	::dii(D$=F$6$66#)#5#5d7m#DT)_#UL#||//0ABH08- 		 	)!!#$$ 	)||''(9:H499+\(1 EFFTYY'(		)s+    **BB5 5
CCC   A'E )Fr'   i@  )__name__
__module____qualname____firstlineno__r
   __annotations__r   r   r   intstaticmethodr,   r   r   boolr5   r   r   r7   r>   rF   ResponserT   __static_attributes__rV   r    r   r   r      s    !s!NCS T    5:*,15	#+D> #3- "*#	
 
 @ 	4S>*ABa BA B B )%.. )T ) )r    r   )typingr   r   r   r   urllib.parser   r   r	   loggingorjsonrH   rF   chromadb.errorsrK   chromadb.configr
   	getLoggerrW   r(   r   rV   r    r   <module>rh      s<    / / 4 4      $			8	$\) \)r    