
    LKi                         S SK Jr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JrJr  \
R(                  " \5      r " S S\5      rg)    )AnyDictMappingOptionalTypeVar)quoteurlparse
urlunparseN)	ComponentSettingsSystemc                     ^  \ rS rSr% \\S'   Sr\\S'   Sr\	\S'   S\
4U 4S jjrS	\R                  4S
 jr\S	\R                  4S j5       r\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\R8                  S	S4S j5       rS	\\\4   4S jrS	\4S jr Sr!U =r"$ )BaseHTTPClient   	_settingsNpre_flight_checksg      D@DEFAULT_KEEPALIVE_SECSsystemc                    > [         TU ]  U5        UR                  U l        U R                  R                  nUb  UO[
        R                  U l        U R                  5       U l	        g N)
super__init__settingsr   chroma_http_keepalive_secsr   r   keepalive_secs_build_limits_http_limits)selfr   keepalive_setting	__class__s      _/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/chromadb/api/base_http_client.pyr   BaseHTTPClient.__init__   s\      NNEE !, 66 	
 !..0    returnc                     0 nU R                   b  U R                   US'   U R                  R                  nUb  X!S'   U R                  R                  nUb  X1S'   [        R
                  " S0 UD6$ )Nkeepalive_expirymax_connectionsmax_keepalive_connections )r   r   chroma_http_max_connections%chroma_http_max_keepalive_connectionshttpxLimits)r   limit_kwargsr'   r(   s       r!   r   BaseHTTPClient._build_limits   ss    ')*/3/B/BL+,..DD&.=*+$(NN$X$X!$08Q45||+l++r#   c                     U R                   $ r   )r   r   s    r!   http_limitsBaseHTTPClient.http_limits.   s       r#   hostc                     [        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 - .r7   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)r4   parseds     r!   _validate_hostBaseHTTPClient._validate_host2   sk    $$;6==0AA:6==/K  $; 7 7>  !8;r#   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$ )
NFr7   z/Skipping port as the user is passing a full URLTr8   : z//r6   )r   r>   r<   loggerdebugr	   r:   netlochostnamestrportpathendswithr
   r   replace)r@   rA   rB   rC   
_skip_port_chroma_server_hostr=   r:   net_locrL   rM   full_urls               r!   resolve_urlBaseHTTPClient.resolve_urlA   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)rX   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_statusr,   HTTPStatusErrorjsonloadstexterrorserror_typesheadersgettrace_idBaseException	Exception)r_   chroma_errorbodyrm   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c                     0 $ )z&Return headers used for HTTP requests.r)   r1   s    r!   get_request_headers"BaseHTTPClient.get_request_headers   s    	r#   c                     g)z#Return the API URL for this client.rF   r)   r1   s    r!   get_api_urlBaseHTTPClient.get_api_url   s    r#   )r   r   r   )FrF   i@  )#__name__
__module____qualname____firstlineno__r   __annotations__r   r   r   floatr   r   r,   r-   r   propertyr2   staticmethodrK   r>   r   boolintrT   r   r   rV   r]   Responserr   r   ru   rx   __static_attributes____classcell__)r    s   @r!   r   r      s]   !s!$(E(	1v 	1,u|| , !U\\ ! ! S T    5:*,15	#+D> #3- "*#	
 
 @ 	4S>*ABa BA B B )%.. )T ) )BWS#X%6 S  r#   r   )typingr   r   r   r   r   urllib.parser   r	   r
   loggingorjsonrf   r,   chromadb.errorsri   chromadb.configr   r   r   	getLoggerrz   rG   r   r)   r#   r!   <module>r      sA    8 8 4 4      7 7			8	$
BY Br#   