ó
    ­[j  ã            
       ó¬   • S r SSKJrJrJrJr  SSKJr  SSKJ	r	  SSK
JrJrJr  S\\\   \4   S\\\   \4   S	\\\\   \4   \\\   \4   4   4S
 jrg)z=Utility functions for handling URL and file path conversions.é    )ÚTupleÚUnionÚOptionalÚcast)ÚPath)Úurlparseé   )ÚOmitÚ	FileTypesÚomitÚfileÚfile_urlÚreturnc                 óü   • U[         L d  Uc  X4$ [        [        U5      n[        U5      nUR                  S;   a  X4$ [        U5      nUR                  5       (       a  UR                  5       (       a  U[         4$ X4$ )a  
Convert a URL parameter to a file parameter if it's a local file path.

If the file_url is a local file path that exists, it will be converted to a Path object
and returned as the file parameter, with the file_url parameter set to omit.

If the file_url is a remote URL (http/https) or doesn't exist as a local file,
it will be returned unchanged.

Args:
    file: The existing file parameter
    file_url: The URL parameter that might be a local file path

Returns:
    A tuple of (file, file_url) where one will be set and the other omit
)ÚhttpÚhttpsÚftpÚftps)r   r   Ústrr   Úschemer   ÚexistsÚis_file)r   r   Úurl_strÚparsedÚpaths        ÚX/home/mande/repo/quber/.venv/lib/python3.13/site-packages/landingai_ade/lib/url_utils.pyÚconvert_url_to_file_if_localr   
   s|   € ð* ”4Ò˜8Ñ+Øˆ~Ðô ”3˜Ó!€Gô �gÓ€FØ‡}�}Ð8Ó8àˆ~Ðô �‹=€DØ‡{�{‡}�}˜Ÿ™Ÿ™à”TˆzÐð ˆ>Ðó    N)Ú__doc__Útypingr   r   r   r   Úpathlibr   Úurllib.parser   Ú_typesr
   r   r   r   r   © r   r   Ú<module>r%      s}   ðÙ Cç /Ó /Ý Ý !ç *Ñ *ð)Ø
�˜Ñ# TÐ)Ñ
*ð)à�H˜S‘M 4Ð'Ñ(ð)ð ˆ5�˜)Ñ$ dÐ*Ñ+¨U°8¸C±=À$Ð3FÑ-GÐGÑHõ)r   