o
    ADi                     @  s   U d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZ d dl
mZ d dl
mZ d d	l
mZ d d
l
mZ d dl
mZ d dl
mZ d dl
mZ d dl
mZ d dl
mZ d dl
mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dlm!Z! d dl"m#Z# d dl"m$Z$ d dl"m%Z% d dl&m'Z' d dl&m(Z( d dl)m*Z* d dl+m,Z, erd d lm-Z- ej.d!krd d"l
m/Z/ nd d"l0m/Z/ d#gZ1d$d% Z2da3d&d' Z4d(d) Z5e6 Z7d*e8d+< eZ9G d,d# d#eeZ:dS )-    )annotationsN)copy)Path)MappingProxyType)IO)TYPE_CHECKING)Any)BinaryIO)	Generator)Literal)Mapping)Sequence)TextIO)TypeVar)overload)urlsplit)get_filesystem_class)AbstractFileSystem)FSSpecAccessorShim)PathlibPathShim)method_and_classmethod)str_remove_prefix)str_remove_suffix)LazyFlavourDescriptorupath_get_kwargs_from_url)upath_urijoin)compatible_protocol)get_upath_protocol)UPathStatResult)get_upath_class)SplitResult)      )SelfUPathc                 C  sT   | dkrddl m} tjdtdd |S | dkr&tjdtdd tdd	d
S t| )N_UriFlavourr   )default_flavourzupath.core._UriFlavour should not be used anymore. Please follow the universal_pathlib==0.2.0 migration guide at https://github.com/fsspec/universal_pathlib for more information.   
stacklevelPTzupath.core.PT should not be used anymore. Please follow the universal_pathlib==0.2.0 migration guide at https://github.com/fsspec/universal_pathlib for more information.r%   )bound)upath._flavourr'   warningswarnDeprecationWarningr   AttributeError)namer'    r3   C/var/www/Datamplify/venv/lib/python3.10/site-packages/upath/core.py__getattr__1   s    r5   c                  C  sR   ddl m}  td| fi dgd }|d |d t|dd	k }a|S )
Nr   )MemoryFileSystem_M )storepseudo_dirsza.txtzf/b.txtz**/*.txtr(   )fsspec.implementations.memoryr6   typetouchlenglob_FSSPEC_HAS_WORKING_GLOB)r6   mgr3   r3   r4   _check_fsspec_has_working_globO   s   

rC   c                 C  s   | |i |S )z#helper for pickling UPath instancesr3   )clsargskwargsr3   r3   r4   _make_instanceZ   s   rG   r   _unsetc                      s8  e Zd ZU dddgejdddR ZerYded< ded	< d
ed< ded< ded< ded< ded< ded< ded< dddZdddZ	dddZ
ded< ded< ded< ded< d Zd!ed"< e Zejd#krieZd d$dd)d*Zd d$d fd,d-Zedd.d/Zedd1d2Zedd3d4Zed fd5d6Zdd9d:Zed d>d?ZeddAdBZeddCdDZdEdF ZedGdH ZedIdJ ZeddLdMZ esdNdO Z!edPdQ Z"edRdS Z#edTdU Z$e$j%dVdU Z$edWdX Z&e&j%dYdX Z&e fdZd[Z'e'j%d\d[ Z'ed]d^ Z(d_d` Z)ddbdcZ*ddddeZ+ddgdhZ,ddidjZ-e.dkdl Z/e.dmdn Z0dodp Z1dqdr Z2dsdt Z3ddudvZ4ddxdyZ5dd|d}Z6dddZ7ddd	 fddZ8d fddZ9edddZ:ddd
ddZ;d
ddZ<dddddZ=dddZ>dddZ?dddZ@dddZAdddZBdddZCdddZDdddZEdddZFdddZGeH					ddddZIeH				ddddZI	ddddZIdddZJdd ZK fddZLd ddddZMd ddddÄZNedddńZOedddǄZPd	ddɄZQddd˄ZRdddd΄ZSdddЄZTddd҄ZUd	ddԄZVddddׄZWddddڄZXddddd݄ZYddd߄ZZddddZ[ddddZ\e]e]ddddZ^dddZ_	dd ddZ`d!ddZad	ddZb  ZcS ("  r%   	_protocol_storage_options
_fs_cached__drv__root__partsstranchordriver$   parentzSequence[Self]parentsztuple[str, ...]partsrootstemsuffixz	list[str]suffixesr2   returnc                 C     d S Nr3   )selfr2   r3   r3   r4   	with_name}       zUPath.with_namec                 C  rZ   r[   r3   )r\   rV   r3   r3   r4   	with_stem~   r^   zUPath.with_stemc                 C  rZ   r[   r3   )r\   rW   r3   r3   r4   with_suffix   r^   zUPath.with_suffixdict[str, Any]r   _tailNzbool | None_protocol_dispatch)r"      protocolrf   
str | Nonestorage_optionsr   c                O  sp  |sd}|^}}|s|st || rt|S d|v r&tjdtdd |d}t|||d}| js5| jd u rFt|d}|d u rEt	d|n| }| t
u rVt|}||_|S t| |ret| }||_|S t| t
rt|}	|st|	d	7 }	| jd
|	d|j d| j d| jd|j d| j d|	d}
tj|
tdd t|}||_|j|g|R d|i| |S td)N.schemez(use 'protocol' kwarg instead of 'scheme'r(   r)   )rf   rh   re   zUnsupported filesystem: z (empty string)z(...) detected protocol z and returns a z* instance that isn't a direct subclass of z. This will raise an exception in future universal_pathlib versions. To prevent the issue, use UPath(...) to create instances of unrelated protocols or you can instead derive your subclass z(...) from z8 or alternatively override behavior via registering the z implementation with protocol z& replacing the default implementation.rf   z2UPath.__new__ expected cls to be subclass of UPath)
isinstancer   r.   r/   r0   popr   rc   r    
ValueErrorr%   object__new__rI   
issubclassrepr__name____init__RuntimeError)rD   rf   rE   rh   part0rT   pth_protocol	upath_clsobjmsg_protocolmsgr3   r3   r4   rp      sz   



(

!

zUPath.__new__Nonec                  s   t | di }t| ||p| ji ||\}}}| j|kr#|r#|| _|rP|d }t|tr7i |j|| _nt|drA|	 }nt
|}t| |||| _n| | _t| jg|R  sbtdt| drid S t j|  d S )NrJ   r   
__fspath__z*can't combine incompatible UPath protocols
_raw_paths)getattrr<   _transform_init_argsrI   rl   r%   rh   rJ   hasattrr}   rO   _parse_storage_optionsr   r   rn   superrt   )r\   rf   rE   rh   base_optionsargs0_args0	__class__r3   r4   rt      s,   





zUPath.__init__c                 C     | j S )z!The fsspec protocol for the path.)rI   r\   r3   r3   r4   rf        zUPath.protocolMapping[str, Any]c                 C  s
   t | jS )z(The fsspec storage options for the path.)r   rJ   r   r3   r3   r4   rh        
zUPath.storage_optionsc                 C  s<   z| j W S  ty   | t| | j| j }| _ | Y S w )z3The cached fsspec filesystem instance for the path.)rK   r1   _fs_factoryrO   rf   rh   )r\   fsr3   r3   r4   r     s   
zUPath.fsc                   s
   t   S )z*The path that a fsspec filesystem can use.)r   __str__r   r   r3   r4   path%  r   z
UPath.pathuristr | os.PathLike[str]c                 C  sH   t |}|r|| jkrt|S ttt| t|fd|p| ji| jS )z.Join with urljoin behavior for UPath instancesrf   )r   rI   r%   r   rO   rh   )r\   r   other_protocolr3   r3   r4   joinuri*  s   zUPath.joinurirE   tuple[str | os.PathLike, ...]9tuple[tuple[str | os.PathLike, ...], str, dict[str, Any]]c                 C  s
   |||fS )z.allow customization of init args in subclassesr3   )rD   rE   rf   rh   r3   r3   r4   r   8  s   
zUPath._transform_init_argsurlpathc                 C  s   t |}i ||S )z&Parse storage_options from the urlpathr   )rD   r   rf   rh   pth_storage_optionsr3   r3   r4   r   B  s   zUPath._parse_storage_optionsc                 C  s*   t |}||}|| |di |S )z0Instantiate the filesystem_spec filesystem classNr3   )r   _get_kwargs_from_urlsupdate)rD   r   rf   rh   fs_clsso_dctr3   r3   r4   r   J  s   

zUPath._fs_factoryc                 K  s   | j tj uo
| jdv}|r"| jdu r"tjd| jdtdd d| _t| dd}|duo4t|t	o4|t	u}|j
t	j
up?t|d	}|rg|ritjd
| jdtdd ddd}ddd}t|| _t|| _dS dS dS )z9provide a clean migration path for custom user subclasses>   
PosixUPathWindowsUPathNz3Detected a customized `__new__` method in subclass z. Protocol dispatch will be disabled for this subclass. Please follow the universal_pathlib==0.2.0 migration guide at https://github.com/fsspec/universal_pathlib for more information.r(   r)   F_default_accessor_fsziDetected a customized `__init__` method or `_fs` attribute in the provided `_FSSpecAccessor` subclass of z. It is recommended to instead override the `UPath._fs_factory` classmethod to customize filesystem instantiation. Please follow the universal_pathlib==0.2.0 migration guide at https://github.com/fsspec/universal_pathlib for more information.r   rO   rf   rh   r   rY   r   c                 S  s0   t |}|r|j|d}| j|fi |}|jS N)rk   )r   _replacer   r   cls_r   rf   rh   urlinstr3   r3   r4   r     s
   z,UPath.__init_subclass__.<locals>._fs_factoryra   c                 S  s2   t |}|r|j|d}| j|fi |}|jjS r   )r   r   r   r   rh   r   r3   r3   r4   r     s
   z7UPath.__init_subclass__.<locals>._parse_storage_optionsr   rO   rf   rO   rh   r   rY   r   r   rO   rf   rO   rh   r   rY   ra   )rp   r%   rs   rc   r.   r/   r0   r   rq   r   rt   r   classmethodr   r   )rD   rF   has_custom_new_methodaccessor_clshas_custom_legacy_accessorhas_customized_fs_instantiationr   r   r3   r3   r4   __init_subclass__V  sD   


	
	zUPath.__init_subclass__c                 C     t jdtdd | jS )NzUPath._path is deprecated and should not be used. Please follow the universal_pathlib==0.2.0 migration guide at https://github.com/fsspec/universal_pathlib for more information.r(   r)   )r.   r/   r0   r   r   r3   r3   r4   _path  s   zUPath._pathc                 C  r   )NzUPath._kwargs is deprecated. Please use UPath.storage_options instead. Follow the universal_pathlib==0.2.0 migration guide at https://github.com/fsspec/universal_pathlib for more information.r(   r)   )r.   r/   r0   rh   r   r3   r3   r4   _kwargs  s   	zUPath._kwargsr!   c                 C  s   t |  S r[   )r   as_posixr   r3   r3   r4   _url  s   z
UPath._urlc                 C  s@   |dkrt jdtdd t| dr| j}nt}|| S t|)N	_accessorzUPath._accessor is deprecated. Please use UPath.fs instead. Follow the universal_pathlib==0.2.0 migration guide at https://github.com/fsspec/universal_pathlib for more information.r(   r)   r   )r.   r/   r0   r   r   r   	from_pathr1   )r\   itemr   r3   r3   r4   r5     s   
	
zUPath.__getattr__c                 K  sl   t jdtdd |dd }|r"|j }r||d< |j }r"||d< tj| |fi |}|j|i | |S )NzUPath._from_parts is deprecated and should not be used. Please follow the universal_pathlib==0.2.0 migration guide at https://github.com/fsspec/universal_pathlib for more information.r(   r)   r   rf   netloc)	r.   r/   r0   rm   rk   r   r%   rp   rt   )rD   rT   rF   
parsed_urlrf   r   ry   r3   r3   r4   _from_parts  s   

zUPath._from_partsc                 C  s&   t jdtdd | jj| }| |S )NzUPath._parse_args is deprecated and should not be used. Please follow the universal_pathlib==0.2.0 migration guide at https://github.com/fsspec/universal_pathlib for more information.r(   r)   )r.   r/   r0   _flavourjoin_parse_path)rD   rE   pthr3   r3   r4   _parse_args  s   	
zUPath._parse_argsc                 C  *   z| j W S  ty   |   | j  Y S w r[   )_UPath__drvr1   _load_partsr   r3   r3   r4   _drv     
z
UPath._drvc                 C  
   || _ d S r[   )r   r\   valuer3   r3   r4   r        
c                 C  r   r[   )_UPath__rootr1   r   r   r3   r3   r4   _root  r   zUPath._rootc                 C  r   r[   )r   r   r3   r3   r4   r     r   c                   s8   z| j W S  ty   |   t j| _ t| j  Y S w r[   )_UPath__partsr1   r   r   rT   listr   r   r3   r4   _parts  s   
zUPath._partsc                 C  r   r[   )r   r   r3   r3   r4   r     r   c                 C  r   r[   )rT   r   r3   r3   r4   _cparts   r   zUPath._cpartsc                 C  s,   t | j}d| ji| j}tt| ||ffS Nrf   )tupler~   rI   rJ   rG   r<   )r\   rE   rF   r3   r3   r4   
__reduce__'  s   
zUPath.__reduce__pathsegmentsc                 G  s   t | |d| ji| jS r   )r<   rI   rJ   r\   r   r3   r3   r4   with_segments/  s   zUPath.with_segmentsc                 G  s   | j | g|R  S r[   )r   r   r3   r3   r4   joinpath6  s   zUPath.joinpathkeyc                 C  s$   z|  |W S  ty   t Y S w r[   )r   	TypeErrorNotImplementedr\   r   r3   r3   r4   __truediv__9  s
   zUPath.__truediv__c                 C  s&   z|  || W S  ty   t Y S w r[   )r   r   r   r   r3   r3   r4   __rtruediv__?  s
   zUPath.__rtruediv__c           
      C  sF  t | trtjdtdd | j}|jrO||\}}}|s g }n*tt	t
j||j}|d dkr6d|d< dd |D }|jsJ|d dkrJ|  |||fS |sVddg fS |j}|j}|rd|||}||\}}}|s||r||s||}	t|	d	kr|	d d
vr|}nt|	dkr|}dd ||D }|||fS )NzUPath._parse_path should not be used as a classmethod. Please file an issue on the universal_pathlib issue tracker and describe your use case.r(   r)   rj   r8   c                 S  s   g | ]}|d kr|qS ri   r3   .0xr3   r3   r4   
<listcomp>`  s    z%UPath._parse_path.<locals>.<listcomp>   z?.   c                 S  s&   g | ]}|r|d krt t|qS ri   )sysinternrO   r   r3   r3   r4   r   s  s   & )rl   r<   r.   r/   r0   r   supports_empty_parts	splitrootr   mapr   r   splitsephas_meaningful_trailing_slashrm   altsepreplace
startswithendswithr>   )
self_or_clsr   flavourdrvrU   relparsedr   r   	drv_partsr3   r3   r4   r   L  sB   




zUPath._parse_pathc                 K  s   t | trtjdtdd | j}|r1tjdtdd d|v r1|d d | | gkr1|dd  }|s5|r?|| |j| S |rO||d d rOdg| }|j|S )	NzUPath._format_parsed_path should not be used as a classmethod. Please file an issue on the universal_pathlib issue tracker and describe your use case.r(   r)   zUPath._format_parsed_parts should not be used with additional kwargs. Please follow the universal_pathlib==0.2.0 migration guide at https://github.com/fsspec/universal_pathlib for more information.r      r   rj   )	rl   r<   r.   r/   r0   r   r   r   
splitdrive)r   r   rU   tailrF   r   r3   r3   r4   _format_parsed_partsv  s(   
"	
zUPath._format_parsed_partsc                 C  s   | j r| j  d| j S | jS )Nz://)rI   r   r   r3   r3   r4   r     s   zUPath.__str__c                 C  s   d}t j|tdd t| S Nzhin a future version of UPath this will be set to None unless the filesystem is local (or caches locally)r(   r)   )r.   r/   PendingDeprecationWarningrO   r\   r{   r3   r3   r4   r}     s   zUPath.__fspath__c                 C  s   d}t j|tdd t| S r   )r.   r/   r   osfsencoder   r3   r3   r4   	__bytes__  s   
zUPath.__bytes__c                 C  s   t | S r[   )rO   r   r3   r3   r4   as_uri  s   zUPath.as_uriboolc                 C     dS NFr3   r   r3   r3   r4   is_reserved     zUPath.is_reservedotherro   c                 C  s2   t |tstS | j|jko| j|jko| j|jkS )zZUPaths are considered equal if their protocol, path and
        storage_options are equal.)rl   r%   r   r   rf   rh   )r\   r  r3   r3   r4   __eq__  s   


zUPath.__eq__intc                 C  s   t | j| jfS )zThe returned hash is based on the protocol and path only.

        Note: in the future, if hash collisions become an issue, we
          can add `fsspec.utils.tokenize(storage_options)`
        )hashrf   r   r   r3   r3   r4   __hash__  s   zUPath.__hash__F)walk_upc                 sH   t |tr| j|jkrtd| jd|jt j|g|R d|iS )Nz&paths have different storage_options: z != r
  )rl   r%   rh   rn   r   relative_to)r\   r  r
  _deprecatedr   r3   r4   r    s   zUPath.relative_toc                  s.   t |tr| j|jkrdS t j|g|R  S r  )rl   r%   rh   r   is_relative_to)r\   r  r  r   r3   r4   r    s   zUPath.is_relative_toc                 C  s2   | j }|sdS |d }|st|dkr|d S |S )Nr8   r   r(   )rb   r>   )r\   r   r2   r3   r3   r4   r2     s   z
UPath.nameTfollow_symlinksr   c                C  s4   |st jt| j dtdd t| j| j	S )Nz3.stat(follow_symlinks=False): is currently ignored.r(   r)   )
r.   r/   r<   rs   UserWarningr   	from_infor   statr   r\   r  r3   r3   r4   r    s   z
UPath.statc                 C  s   | j ddS )NFr  )r  r   r3   r3   r4   lstat  s   zUPath.lstatc                C     | j | jS r[   )r   existsr   r  r3   r3   r4   r       zUPath.existsc                 C  r  r[   )r   isdirr   r   r3   r3   r4   is_dir  r  zUPath.is_dirc                 C  r  r[   )r   isfiler   r   r3   r3   r4   is_file  r  zUPath.is_filec                 C  r  r  r3   r   r3   r3   r4   is_mount  r  zUPath.is_mountc                 C  s@   z| j | j}d|v rt|d W S W dS  ty   Y dS w )NislinkF)r   infor   r   FileNotFoundError)r\   r  r3   r3   r4   
is_symlink  s   zUPath.is_symlinkc                 C  r  r  r3   r   r3   r3   r4   is_junction  r  zUPath.is_junctionc                 C  r  r  r3   r   r3   r3   r4   is_block_device  r  zUPath.is_block_devicec                 C  r  r  r3   r   r3   r3   r4   is_char_device  r  zUPath.is_char_devicec                 C  r  r  r3   r   r3   r3   r4   is_fifo  r  zUPath.is_fifoc                 C  r  r  r3   r   r3   r3   r4   	is_socket  r  zUPath.is_socketc                 C  s8   |   }t|tr|  }||kS | |  }||kS r[   )r  rl   r%   r   )r\   
other_pathstother_str3   r3   r4   samefile  s   
zUPath.samefiler.modeLiteral['r', 'w', 'a']	bufferingencodingerrorsnewlinefsspec_kwargsr   c                 K  rZ   r[   r3   r\   r,  r.  r/  r0  r1  r2  r3   r3   r4   open%     	z
UPath.openLiteral['rb', 'wb', 'ab']r	   c                 K  rZ   r[   r3   r3  r3   r3   r4   r4  0  r5  IO[Any]c                 O  sv   t g d|D ]\}}||v rtt| j d| d|||< qd|v r.|d|d | jj| jfd|i|S )a  
        Open the file pointed by this path and return a file object, as
        the built-in open() function does.

        Parameters
        ----------
        mode:
            Opening mode. Default is 'r'.
        buffering:
            Default is the block size of the underlying fsspec filesystem.
        encoding:
            Encoding is only used in text mode. Default is None.
        errors:
            Error handling for encoding. Only used in text mode. Default is None.
        newline:
            Newline handling. Only used in text mode. Default is None.
        **fsspec_kwargs:
            Additional options for the fsspec filesystem.
        )r.  r/  r0  r1  z!.open() got multiple values for ''r.  
block_sizer,  )	zipr   r<   rs   
setdefaultrm   r   r4  r   )r\   r,  rE   r2  r   r   r3   r3   r4   r4  ;  s   
Generator[UPath, None, None]c                 c  sj    | j | jD ]*}t|tr|d}|dv rqt|d| jj	\}}}| j
g | j|R  V  qd S )Nr2   >   rj   ../)r   listdirr   rl   dictgetr   
rpartitionr   r   r   rT   )r\   r2   _r3   r3   r4   iterdir`  s   

zUPath.iterdirc                 C     t r[   NotImplementedErrorr   r3   r3   r4   _scandirl  r  zUPath._scandirc                   s   t  |}|`|S r[   )r   _make_child_relpath_str)r\   r2   r   r   r3   r4   rI  o  s   zUPath._make_child_relpath)case_sensitivepatternc                c  sV    |  |j}| jj}| j| j}| j|D ]}tt|||}|  |V  qd S r[   )r   r   r   r   r   _strip_protocolr?   r   )r\   rL  rK  path_patternr   baser2   r3   r3   r4   r?   t  s   z
UPath.globc          
      c  s    t d u rt  t r5| d|j}| jj}| j| j}| j|D ]}t	t	|||}| |V  q"d S | |j}| d|j}| jj}| j| j}t
 }||fD ]#}	| j|	D ]}t	t	|||}||v rkq\|| | |V  q\qTd S )Nz**)r@   rC   r   r   r   r   r   rM  r?   r   setadd)
r\   rL  rK  r_path_patternr   rO  r2   rN  seenpr3   r3   r4   rglob~  s2   
zUPath.rglobc                 C     | t u r
td S tNr8   )r%   r    cwdrG  rD   r3   r3   r4   rX       z	UPath.cwdc                 C  rV  rW  )r%   r    homerG  rY  r3   r3   r4   r[    rZ  z
UPath.homec                 C     | S r[   r3   r   r3   r3   r4   absolute  r  zUPath.absolutec                 C  s   | j t| S r[   )r   isabsrO   r   r3   r3   r4   is_absolute  s   zUPath.is_absolutestrictc                 C  sx   | j }d|vrd|vr| S g }|dd  }|D ]}|dkr$|r#|  q|dkr-|| q| jg |d d |R  S )Nr=  rj   r   )rT   rm   appendr   )r\   r`  r   resolvedresolvable_partspartr3   r3   r4   resolve  s   
zUPath.resolvec                 C  rE  r[   rF  r   r3   r3   r4   owner  r  zUPath.ownerc                 C  rE  r[   rF  r   r3   r3   r4   group  r  zUPath.groupc                 C  rE  r[   rF  r   r3   r3   r4   readlink  r  zUPath.readlink  c              	   C  sn   | j | j}|r|stt| |s| j j| jdd d S z| j j| jdd W d S  ttfy6   Y d S w )NT)truncateF)r   r  r   FileExistsErrorrO   r=   rG  rn   )r\   r,  exist_okr  r3   r3   r4   r=     s   zUPath.touch  c                 C  sp   |r|s|   rtt| z| jj| j||d W d S  ty7   |s*tt| |  s4tt| Y d S w )N)create_parentsr,  )r  rk  rO   r   mkdirr   r  )r\   r,  rS   rl  r3   r3   r4   ro    s   zUPath.mkdirr  c                C  rE  r[   rF  )r\   r,  r  r3   r3   r4   chmod  r  zUPath.chmodc                 C  rE  r[   rF  )r\   r,  r3   r3   r4   lchmod  r  zUPath.lchmod
missing_okc                 C  s2   |   s|stt| d S | jj| jdd d S )NF	recursive)r  r   rO   r   rmr   )r\   rr  r3   r3   r4   unlink  s
   zUPath.unlinkrt  c                 C  sH   |   s
tt| |st|  rtd|  | jj| j|d d S )Nz'Not recursive and directory not empty: rs  )	r  NotADirectoryErrorrO   nextrD  OSErrorr   ru  r   )r\   rt  r3   r3   r4   rmdir  s
   zUPath.rmdir)rt  maxdepthtargetstr | os.PathLike[str] | UPathr{  
int | NonerF   c                K  s  t |tr| jrt|fi | j}t|}|rG|| jkr'td| jd|t |ts6t|fi | j}n|}d|jv sBd|jv rF| }n| j	}d|jv sTd|jv rX| }|
tj|}t |t| slJ d|turt||d< |tur|||d< | jj| j|jfi | |S )Nzexpected protocol z, got: r=  rj   z"identical protocols enforced abovert  r{  )rl   rO   rh   r%   r   rf   rn   rT   re  rR   r   r   r   normpathr<   rH   r   mv)r\   r|  rt  r{  rF   target_protocoltarget_rR   r3   r3   r4   rename  s<   

zUPath.renamec                 C  rE  r[   rF  r\   r|  r3   r3   r4   r   "  r  zUPath.replacetarget_is_directoryc                 C  rE  r[   rF  )r\   r|  r  r3   r3   r4   
symlink_to%  s   zUPath.symlink_toc                 C  rE  r[   rF  r  r3   r3   r4   hardlink_to,  s   zUPath.hardlink_toc                 C  r\  r[   r3   r   r3   r3   r4   
expanduser2  r  zUPath.expanduser)r2   rO   rY   r$   )rV   rO   rY   r$   )rW   rO   rY   r$   )rf   rg   rh   r   rY   r%   )rf   rg   rh   r   rY   r|   )rY   rO   )rY   r   )rY   r   )r   r   rY   r%   )rE   r   rf   rO   rh   ra   rY   r   r   r   )rY   r!   )r   r   rY   r$   )r   r   rY   r$   )rY   r   )r  ro   rY   r   )rY   r  )rY   r$   )rY   r   )r+  ....)r,  r-  r.  r  r/  rO   r0  rO   r1  rO   r2  r   rY   r   )....)r,  r6  r.  r  r/  rO   r0  rO   r1  rO   r2  r   rY   r	   )r+  )r,  rO   rE   r   r2  r   rY   r7  )rY   r<  )rL  rO   rY   r<  )rY   r%   )F)r`  r   rY   r$   )ri  T)rY   r|   )rm  FF)r,  r  r  r   rY   r|   )r,  r  rY   r|   )rr  r   rY   r|   )T)rt  r   rY   r|   )
r|  r}  rt  r   r{  r~  rF   r   rY   r$   )r|  r}  rY   r%   )r|  r}  r  r   rY   r|   )r|  r}  rY   r|   )drs   
__module____qualname__r   __missing_py312_slots__	__slots__r   __annotations__r]   r_   r`   rc   r   r   r   version_infoparserrp   rt   propertyrf   rh   r   r   r   r   r   r   r   r   r   r   r   r5   r   r   r   setterr   r   r   r   r   r   r   r   r   r   r   r   r}   r   r   r  r  r	  r  r  r2   r  r  r  r  r  r  r!  r"  r#  r$  r%  r&  r*  r   r4  rD  rH  rI  r?   rU  rX  r[  r]  r_  re  rf  rg  rh  r=   ro  rp  rq  rv  rz  rH   r  r   r  r  r  __classcell__r3   r3   r   r4   r%   f   sB  
 




X*

	E




	

	



)
"
	
%

));
__future__r   r   r   r.   r   pathlibr   typesr   typingr   r   r   r	   r
   r   r   r   r   r   r   urllib.parser   fsspec.registryr   fsspec.specr   upath._compatr   r   r   r   r   r-   r   r   r   upath._protocolr   r   upath._statr   upath.registryr    r!   r  r$   typing_extensions__all__r5   r@   rC   rG   ro   rH   r  _FSSpecAccessorr%   r3   r3   r3   r4   <module>   s\    
