o
    ADiD	                     @  s   d dl mZ d dlZd dlZd dlmZ d dlmZ d dlmZ er(d dl	m
Z
 g dZedZed	ZdddZddddddZdddZd ddZdS )!    )annotationsN)PurePath)TYPE_CHECKING)Any)UPath)get_upath_protocolnormalize_empty_netloccompatible_protocolzA^(?P<protocol>[A-Za-z][A-Za-z0-9+]+):(?P<slashes>//?)(?P<path>.*)z^data:[^,]*,pthstrreturnc                 C  s*   t |  }r|dS t| rdS dS )Nprotocoldata )_PROTOCOL_REmatchgroup_DATA_URI_RE)r
   m r   H/var/www/Datamplify/venv/lib/python3.10/site-packages/upath/_protocol.py_match_protocol   s
   

r   )r   storage_optionsstr | PurePath | os.PathLiker   
str | Noner   dict[str, Any] | Nonec                C  s   t | tr
t| }nt | trt| dd}nt| dr"t|  }ntt| }|r;|r;||s;td|d||p@|p@dS )z#return the filesystem spec protocolr   r   
__fspath__zrequested protocol z incompatible with )	
isinstancer   r   r   getattrhasattrr   
startswith
ValueError)r
   r   r   pth_protocolr   r   r   r   $   s   



r   c                 C  sF   t |  }r!t|ddkr!|d}|d}| d| } | S )Nslashes   r   pathz:///)r   r   lenr   )r
   r   r   r%   r   r   r   r   <   s   

r   argsstr | os.PathLike[str] | UPathboolc                 G  s6   |D ]}t |}|dd }|r|| kr dS qdS )z'check if UPath protocols are compatible+r   FT)r   	partition)r   r'   argother_protocolr   r   r   r	   E   s   r	   )r
   r   r   r   )r
   r   r   r   r   r   r   r   )r   r   r'   r(   r   r)   )
__future__r   osrepathlibr   typingr   r   
upath.corer   __all__compiler   r   r   r   r   r	   r   r   r   r   <module>   s&    


	