
    %`i                        U d dl Z d dlZd dlZd dlmZmZ d dlmZmZm	Z	m
Z
mZ d dlmZmZ dZdaee         ed<   daee         ed<   dZd	a ej        e          Zd
 Zdee         fdZdedeeef         defdZdedefdZdS )    N)DictOptional)	parse_qslunquote	urlencodeurlparse
urlunparse)Versionparse!RAY_DISABLE_PYARROW_VERSION_CHECK_PYARROW_INSTALLED_PYARROW_VERSION9.0.0Fc                     t           j                            dd          dk    rdS t          st           j                            t          d          dk    rdadS t                      } | 4| t          t                    k     rt          dt           d|  d          n#t          
                    d	t           d
           dadS dS )z=Checks that Pyarrow's version is within the supported bounds.RAY_DOC_BUILD01NTzDataset requires pyarrow >= z, but z: is installed. Reinstall with `pip install -U "pyarrow"`. zYou are using the 'pyarrow' module, but the exact version is unknown (possibly carried as an internal component by another module). Please make sure you are using pyarrow >= z+ to ensure compatibility with Ray Dataset. )osenvironget_PYARROW_VERSION_VALIDATED"_RAY_DISABLE_PYARROW_VERSION_CHECKget_pyarrow_versionparse_version_PYARROW_SUPPORTED_VERSION_MINImportErrorloggerwarning)versions    l/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/_private/arrow_utils.py_check_pyarrow_versionr!      s     
z~~os++s22% *:>><cBBcII)-&F%'''EFFFF!43Q 4 44 4 4   G NN36T3 3 3   &*"""+* *    returnc                      t           du rdS t           >	 ddl} da t          | d          rt          | j                  an# t          $ r da Y nw xY wt
          S )z@Get the version of the pyarrow package or None if not installed.FNr   T__version__)r   pyarrowhasattrr   r%   r   ModuleNotFoundError)r&   s    r    r   r   9   s     U""t!	'NNN!%w.. F#01D#E#E " 	' 	' 	'!&	' s   *? AAurlparamsc                 |   t          |           } t          |           }|}t          t          |j                            }|                    |           |                    d |                                D                        t          |d          }|                    |          }t          |          S )a  Add params to the provided url as query parameters.

    If url already contains query parameters, they will be merged with params, with the
    existing query parameters overriding any in params with the same parameter name.

    Args:
        url: The URL to add query parameters to.
        params: The query parameters to add.

    Returns:
        URL with params added as query parameters.
    c                 v    i | ]6\  }}t          |t          t          f          !|t          j        |          7S  )
isinstancebooldictjsondumps).0kvs      r    
<dictcomp>z)_add_url_query_params.<locals>.<dictcomp>c   sJ     	
 	
 	
1!dD\**	
tz!}}	
 	
 	
r"   T)doseq)query)
r   r   r0   r   r8   updateitemsr   _replacer	   )r)   r*   
parsed_urlbase_paramsencoded_paramss        r    _add_url_query_paramsr?   L   s     #,,C#JK)J,--..Fv	
 	
#))++	
 	
 	
   {$777N$$>$::Jj!!!r"   uric                     t                      }||t          d          k     r| S t          |           }|j        dk    rt	          | ddi          } | S )aD  If the provided URI is an S3 URL, add allow_bucket_creation=true as a query
    parameter. For pyarrow >= 9.0.0, this is required in order to allow
    ``S3FileSystem.create_dir()`` to create S3 buckets.

    If the provided URI is not an S3 URL or if pyarrow < 9.0.0 is installed, we return
    the URI unchanged.

    Args:
        uri: The URI that we'll add the query parameter to, if it's an S3 URL.

    Returns:
        A URI with the added allow_bucket_creation=true query parameter, if the provided
        URI is an S3 URL; uri will be returned unchanged otherwise.
    Nr   s3allow_bucket_creationT)r   r   r   schemer?   )r@   pyarrow_version
parsed_uris      r    %add_creatable_buckets_param_if_s3_urirG   r   s_      *++O"w9O9O'O'O
#JD  #C*A4)HIIJr"   )r1   loggingr   typingr   r   urllib.parser   r   r   r   r	   packaging.versionr
   r   r   r   r   r/   __annotations__r   r   r   	getLogger__name__r   r!   r   strr?   rG   r-   r"   r    <module>rP      s^     				 ! ! ! ! ! ! ! ! L L L L L L L L L L L L L L = = = = = = = =%H " &* HTN ) ) )&* (7# * * * ") "  
	8	$	$* * *>Xg.    &#"s #"DcN #"s #" #" #" #"Ls s      r"   